Class 12
Information Technology (802)
351 questions available
Refine
All questions
351 resultsJava provides which two statements for conditional (selection) execution of code?
Show answer
In an if statement with only ONE statement in its body, are curly braces mandatory?
Show answer
In the code: if(percentage >= 40) { System.out.println("PASSED"); } else { System.out.println("FAILED"); } — what is displayed if percentage = 35?
Show answer
Which combination of if-else and logical operator correctly checks if percentage is between 40 (inclusive) and 60 (exclusive) for Second Division?
Show answer
An if-else statement placed within another if or else statement is called:
Show answer
The switch statement's expression must evaluate to which of the following data types?
Show answer
In a switch statement, what does the 'break' statement after each case group do?
Show answer
In a switch statement, if the expression does not match any case constant, which block executes?
Show answer
Which loop structure evaluates its test condition BEFORE executing the loop body (entry-controlled loop)?
Show answer
Which loop structure is guaranteed to execute its body AT LEAST ONCE, regardless of the test condition?
Show answer
If int number = 6; and the loop is: while(number<=5){...}, how many times does the loop body execute?
Show answer
If int number = 6; and the loop is: do{...}while(number<=5);, how many times does the loop body execute?
Show answer
A loop that never terminates because its test condition is always true is called:
Show answer
What is the error in this code: int x = 1; while (x <= 5); { x = x + 1; }
Show answer
How many parts of a for loop are separated by semicolons?
Show answer
How many times does this loop execute: for(int count=1; count<5; count++) { ... }
Show answer
What is wrong with the loop: for(int count=5; count<=1; count++) { ... }
Show answer
What is the scope of a loop counter declared within a for loop statement, e.g., for(int count=1; ...)?
Show answer
Placing a semicolon at the end of a for statement, e.g., for(int count=1; count<=5; count++);, causes:
Show answer
The switch statement in Java can evaluate an expression of type float.