adplus-dvertising

Welcome to the Operators and Control Statements MCQs Page

Dive deep into the fascinating world of Operators and Control Statements with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Operators and Control Statements, a crucial aspect of Java Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Operators and Control Statements, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within Java Programming.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Operators and Control Statements. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of Java Programming.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Operators and Control Statements. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Operators and Control Statements MCQs | Page 14 of 38

Explore more Topics under Java Programming

Q131.
What will be the output of the following code snippet?
int a=15;
int b=25;
if ((a < b ) || ( a = 5)>15)
 system.out.println(a);
else
 system.out.println(b);
Discuss
Answer: (b).15
Q132.
What will be the output of the program?
int x, y;
x=15; y=20;
if (x>15)
if(y>15)
{
 system.ptintln("y is "+y);
}
else
 system.out.ptintln("x is "+x);
Discuss
Answer: (c).x is 15
Q133.
Which two are acceptable types for x?
switch(x)
{
 default:
  System.out.println("Hello");
}
Discuss
Answer: (a).short
Q134.
Which of the following for loop declaration is not valid?
public void test(int x)
{
 int odd = 1;
 if(odd) /* Line 4 */
 {
  System.out.println("odd");
 }
 else
 {
  System.out.println("even");
 }
}public class While
{
 public void loop()
 {
  int x= 0;
  while ( 1 ) /* Line 6 */
  {
   System.out.print("x plus one is " + (x + 1)); /* Line 8 */
  }
 }
}
Discuss
Answer: (a).for ( int i = 99; i >= 0; i / 9 )
Q135.
_______ is not a flow control statement in Java.
Discuss
Answer: (c).exit()
Q136.
The break statement causes an exit from ______ loop.
Discuss
Answer: (a).innermost
Q137.
Which of the following is an iteration statement?
Discuss
Answer: (d).do-while
Q138.
What is the valid data type for variable "a" to print "Hello World"?
switch(a)
{
   System.out.println("Hello World");
}
Discuss
Answer: (d).byte and char
Q139.
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);
 }
}

a.

1

b.

2

c.

3

d.

4

Discuss
Answer: (b).2
Q140.
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);
 }
}
Discuss
Answer: (b).6

Suggested Topics

Are you eager to expand your knowledge beyond Java Programming? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!