Java FRQ 001 - If condition

1. Classify Number

Write a Java program to get a number from the user and print whether it is positive, zero or negative.

2. Write a program to check whether a number is even or odd
3. Write a program to check whether a character is alphabet

4. How is the 'else if' statement used in Java?

a) To specify an alternate condition only if the 'if' condition is true

b) To execute a block of code regardless of the 'if' condition

c) To specify a new condition to test, if the first condition is false

d) To repeat the 'if' condition

5. In an 'if' statement, what is the correct way to check if a variable 'a' is not equal to 10?

a) if (a != 10)

b) if (a == 10)

c) if (a =! 10)

d) if (a < > 10)

360-34c5-7578-95ea-5407528c795c