Quiz: Flow Control

To View Tricks: Login Required

Number of Questions: 15

Question: 6 -

Which of the following for loop declaration is not valid?

Options:
  1. for ( int i = 20; i >= 2; - -i )

  2. for ( int i = 99; i >= 0; i / 9 )

  3. for ( int i = 2; i <= 20; i = 2* i )

  4.  for ( int i = 7; i <= 77; i += 7 )

  5. Answer:

    for ( int i = 99; i >= 0; i / 9 )

    Solution not available.

Question: 7 -

_______ is not a flow control statement in Java.

Options:
  1. break

  2. return

  3. continue

  4. exit

  5. Answer:

    exit

    Solution not available.

Question: 8 -

What is the valid data type for variable "a" to print "Hello World"?

switch(a)
{
   System.out.println("Hello World");
}

Options:
  1. int and float

  2. byte and short

  3. byte and char

  4. char and long

  5. Answer:

    byte and char

    Solution not available.

Question: 9 -

The break statement causes an exit from ______ loop.

Options:
  1. innermost

  2. break statement causes an exit from program

  3. Depends on program

  4. outermost

  5. Answer:

    innermost

    Solution not available.

Question: 10 -

Which of the following is an iteration statement?

Options:
  1. if-elseif

  2. switch

  3. if

  4. do-while

  5. Answer:

    do-while

    Solution not available.