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 12 of 38

Explore more Topics under Java Programming

Q111.
What will be the output of the program?
class Main {
    public static void main(String [] args)
 {
  Main p = new Main();
  p.start(); 
 }
 void start()
 {
  boolean b1 = false;
  boolean b2 = fix(b1);
  System.out.println(b1 + " " + b2);
 }
 boolean fix(boolean b1) 
 {
  b1 = true;
  return b1;
 }
}
Discuss
Answer: (c).false true
Q112.
What will be the output of the program?
class Main {
   public static void main(String [] args)
 {
  Main p = new Main();
  p.start();
 }
 void start()
 {
   String s1 = "s";
  String s2 = fix(s1);
  System.out.println(s1 + " " + s2);
 }
 String fix(String s1)
 {
  s1 = s1 + "st";
  System.out.print(s1 + " ");
  return "st";
 }
}
Discuss
Answer: (d).sst s st
Q113.
Predict the output of following Java Program?
class Test {
 public static void main(String args[]) {
  int x = -4;
  System.out.println(x>>1);
  int y = 4;
  System.out.println(y>>1);
 }
}
Discuss
Answer: (b).-2
2
Q114.
With x = 0, which of the following are legal lines of Java code for changing the value of x to 1?

1. x++;
2. x = x + 1;
3. x += 1;
4. x =+ 1;
Discuss
Answer: (c).1, 2, 3 & 4
Q115.
What is the output of this program?
class Main {
   public static void main(String args[])
 {
  double var1 = 2 + 4;
  double var2 = var1 / 4;
  int var3 = 2 + 4;
  int var4 = var3 / 4;
  System.out.print(var2 + " " + var4);
 }
}
Discuss
Answer: (c).1.5 1
Q116.
What will be the output of the program?
class Main {
   public static void main(String [] args)
 {
  int x=20;
  String sup = (x < 15) ? "s" : (x < 22)? "t" : "h";
  System.out.println(sup);
 }
}
Discuss
Answer: (b).t
Q117.
What will be the output of the program?
class Bitwise
{
 public static void main(String [] args)
 {
  int x = 11 & 9;
  int y = x ^ 3;
  System.out.println( y | 12 );
 }
}

a.

7

b.

0

c.

14

d.

8

Discuss
Answer: (c).14
Q118.
What is the output of this program?
class increment
{
 public static void main(String args[])
 {
  int g = 5;
  System.out.print(++g * 8);
 }
}
Discuss
Answer: (c).48
Q119.
Which of these is returned by "greater than", "less than" and "equal to" operators?
Discuss
Answer: (c).Boolean
Q120.
Which of the following operators can operate on a boolean variable?
Discuss
Answer: (d).+=

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!