Curriculum
Course: Learn Java Programming
time left:
:
:
Login

Curriculum

Learn Java Programming

Quiz

Introduction to Operators in Java

Submit quiz
Once you submit, you will no longer be able to change your answers. Are you sure you want to submit the quiz?
1.

What will be the output of the following code?

int x = 7;
System.out.println(x++ + ++x);

15
16
17
14
2.

What is the result of the expression 5 | 3 in Java?

8
7
2
6
3.

What is the output of the statement System.out.println(3==3);

1
0
true
false
4.

What will be the output of this expression?

System.out.println((1 & 2) + (3 | 4) - (5 ^ 6));

1
0
-1
2
5.

Which of these is a bitwise operator in Java?

&&
||
!
&
6.

What will be the value of x after the following code executes?

int x = 5;
x *= 2 + 3;
System.out.println(x);

10
15
25
30
7.

What will be the output of the following code?

int a = 5;
int b = a++ * --a / ++a + a--;
System.out.println(b);

5
6
4
Compilation Error
8.

What will be the output of the following Java code?

int x = 8, y = 3, z = 2;
System.out.println(x / y * z + x % y);

4
6
5
3
9.

Consider the following Java expression. What will be the output?

System.out.println(2 << 3 + 1 >> 2);

4
8
2
1
10.

What will be the output of this code?

System.out.println(~(-5));

4
5
-6
6
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10