Java Control Statement MCQ Questions and Answers

Java Control Statement MCQ Questions and Answers

Home | Java | Control Statement

Java Control Statement MCQ Questions and Answers: Here learn quiz questions on Java and download pdf of 50 most important objective questions for all competitive exam.

Page: 1/3

1) Which of these selection statements test only for equality?

2) Which of these are selection statements in Java?

3) Which of the following loops will execute the body of loop even when condition controlling the loop is initially false?

4) Which of these jump statements can skip processing remainder of code in its body for a particular iteration?

5) Which of these statement is incorrect?

6) What is the output of this program?

class selection_statements
{
public static void main(String args[])
{
int var1 = 5;
int var2 = 6;
if ((var2 = 1) == var1)
System.out.print(var2);
else
System.out.print(++var2);
}
}

7) What is the output of this program?

class comma_operator
{
public static void main(String args[])
{
int sum = 0;
for (int i = 0, j = 0; i < 5 & j < 5; ++i, j = i + 1)
sum += i;
System.out.println(sum);
}
}

8) __________ statement provides an easy way to dispatch execution to different parts of your code based on the value of an expression.

9) The conditional statement, _______ can only test for equality, whereas _________ can evaluate any type of Boolean expression.

10) What will be the output of the following code snippet?

  int a=15;
int b=25;
if ((a15)
System.out.println(a);
else
System.out.println(b);

Download MCQ PDF