132). What would be the output of the following code snippet if variable a=10?
if(a<=0)
{
   if(a==0)
   {
     System.out.println("1 ");
   }
   else 
   { 
      System.out.println("2 ");
   }
}
System.out.println("3 ");

[A]1 2
[B] 2 3
[C]1 3
[D]3

Show Answer

133). The while loop repeats a set of code while the condition is not met?
if(a<=0)
{
   if(a==0)
   {
     System.out.println("1 ");
   }
   else 
   { 
      System.out.println("2 ");
   }
}
System.out.println("3 ");

[A]True
[B]False
[C]none
[D]none

Show Answer

134). What is true about a break?
if(a<=0)
{
   if(a==0)
   {
     System.out.println("1 ");
   }
   else 
   { 
      System.out.println("2 ");
   }
}
System.out.println("3 ");

[A]Break stops the execution of entire program
[B]Break halts the execution and forces the control out of the loop
[C] Break forces the control out of the loop and starts the execution of next iteration
[D]Break halts the execution of the loop for certain time frame

Show Answer

135). What is true about do statement?
if(a<=0)
{
   if(a==0)
   {
     System.out.println("1 ");
   }
   else 
   { 
      System.out.println("2 ");
   }
}
System.out.println("3 ");

[A]do statement executes the code of a loop at least once
[B]do statement does not get execute if condition is not matched in the first iteration
[C] do statement checks the condition at the beginning of the loop
[D]do statement executes the code more than once always

Show Answer

136). Which of the following is used with the switch statement?
if(a<=0)
{
   if(a==0)
   {
     System.out.println("1 ");
   }
   else 
   { 
      System.out.println("2 ");
   }
}
System.out.println("3 ");

[A]Continue
[B]Exit
[C]break
[D]do

Show Answer

137). What is the valid data type for variable “a” to print “Hello World”?
switch(a)
{
   System.out.println("Hello World");
}

[A] int and float
[B]byte and short
[C] char and long
[D]byte and char

Show Answer

138). Which of the following is not a decision making statement?
switch(a)
{
   System.out.println("Hello World");
}

[A]if
[B]if-else
[C]switch
[D]do-while

Show Answer

139). Which of the following is not a valid jump statement?
switch(a)
{
   System.out.println("Hello World");
}

[A]break
[B]goto
[C]continue
[D]return

Show Answer

140). From where break statement causes an exit?
switch(a)
{
   System.out.println("Hello World");
}

[A]Only from innermost loop
[B]Terminates a program
[C]Only from innermost switch
[D]From innermost loops or switches

Show Answer

141). Which of the following is not a valid flow control statement?
switch(a)
{
   System.out.println("Hello World");
}

[A]exit()
[B]break
[C]continue
[D]return

Show Answer