Search Tutorials


Java Operators MCQ - Multiple Choice Questions And Answers | JavaInUse

Java Operators MCQ - Multiple Choice Questions And Answers

Q. What is the result of the expression 5 + 3 * 2?

A. 10
B. 16
C. 11
D. 13

Q. What is the result of the expression "Hello " + "World"?

A. "Hello"
B. "World"
C. "Hello World"
D. Error

Q. What is the result of the expression 9 % 4?

A. 2
B. 3
C. 4
D. 1

Q. What is the result of the expression 10 / 3?

A. 3
B. 3.33
C. 3.0
D. Error

Q. What is the result of the expression true || false?

A. true
B. false
C. Error
D. None of the above

Q. What is the result of the expression !(5 > 3 && 2 < 4)?

A. true
B. false
C. Error
D. None of the above

Q. What is the result of the expression "Hello" == "Hello"?

A. true
B. false
C. Error
D. None of the above

Q. What is the result of the expression 5 > 3 ? "Yes" : "No"?

A. Yes
B. No
C. Error
D. None of the above

Q. What is the result of the expression 10 >= 10?

A. true
B. false
C. Error
D. None of the above

Q. What is the result of the expression "apple".equals("Apple")?

A. true
B. false
C. Error
D. None of the above

Q. What is the output of the following code snippet?

int x = 5;
int y = 3;
System.out.println(x + y * 2);
A. 11
B. 23
C. 14
D. 8





Q. What will the following code snippet print?

int a = 5;
int b = 2;
int c = a / b;
System.out.println(a + " divided by " + b + " equals " + c);
A. 5 divided by 2 equals 2
B. 5 divided by 2 equals 2.5
C. 5 divided by 2 equals 2.0
D. 5 divided by 2 equals 2.00

Q. What will be the output of the following code snippet?

int x = 10;
x++;
System.out.println(x++);
A. 10
B. 11
C. 12
D. Compilation error

Q. What will be the value of x after executing the following code snippet?

int x = 5;
x *= 2;
x -= 3;
A. 2
B. 5
C. 7
D. 9

Q. What will be the output of the following code snippet?

int a = 5;
int b = 7;
System.out.println(a == b);
A. true
B. false
C. Compile error
D. Runtime exception

Q. What will be the value of x after executing the following code snippet?

int x = 10;
x += 5;
x *= 2;
x -= 8;
A. 12
B. 15
C. 24
D. 27

Q. What will be the output of the following code snippet?

int a = 10;
int b = 5;
int c = 2;
System.out.println(a > b && b > c);
A. true
B. false
C. Compile error
D. Runtime exception

Q. What will be the value of x after executing the following code snippet?

int x = 10;
int y = 5;
x = x % y;
A. 0
B. 1
C. 2
D. 5

Q. What will be the output of the following code snippet?

int a = 2;
int b = 3;
int c = 4;
System.out.println(a < b || b < c);
A. true
B. false
C. Compile error
D. Runtime exception