KEMBAR78
Answer MCQ Java | PDF | Multiple Choice | Computer Science
0% found this document useful (0 votes)
9 views14 pages

Answer MCQ Java

Uploaded by

Mayuri Falke
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views14 pages

Answer MCQ Java

Uploaded by

Mayuri Falke
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

11/15/23, 9:42 AM

Operators in Java MCQ


Operators in Java MCQ -
Javatpoint

Java is a popular programming language that is widely used for developing applications in
various

domains such as web development, mobile app development, and more. In Java, operators are

used to perform various operations on variables and values. In this section, we will discuss

frequently asked multiple-choice questions (MCQs) on operators in Java, along with their

answers and
explanations.

1) Which of the following is a relational operator in Java?

a. +

b. =

C.

d. &&

Show Answer
Workspace

2) Which of the following operators is used to perform addition in


Java?

a. +

b.

C.
d. /

Show Answer
Workspace

3) Which of the following operators is used to perform division in


Java?

a. %

b. &

c. |

d. /

Show Answer
Workspace

https://www.javatpoint.com/operators-in-java-
mcq
2/12
11/15/23, 9:42 AM
Operators in Java MCQ -
Javatpoint

4) Which of the following is a logical operator in Java?

a. ++

b. /

C. &&

d. =

Show Answer
Workspace
5) Which of the following is a unary operator in
Java?

a. +

b. /

C.

d. *

Show Answer
Workspace

6) Which of the following operators has the highest precedence in Java?

a. +

b. /

C. ++

d. &&

Show Answer
Workspace

7) Which of the following operators is used to perform modulo division in Java?

a. /

b. %

C.
*

d. &
https://www.javatpoint.com/operators-in-java-
mcq
3/12
11/15/23, 9:42 AM

Show Answer
Operators in Java MCQ -
Javatpoint

Workspace

8) Which of the following operators is used to perform bitwise AND in


Java?

a. &

b. &&

c. |

d. ^

Show Answer
Workspace

9) Which of the following operators is used to perform equality comparison


in Java?

a. =

b. ==

C. !=

d. >

Show Answer
Workspace
10) Which of the following operators is used to perform bitwise OR in Java?

a. |

b. ^

C. &

d. Il

Show Answer
Workspace

11) What is the output of the following code snippet?

int i = 0;

while (i < 3) {

System.out.print(i + "
");

https://www.javatpoint.com/operators-in-java-
mcq
4/12
11/15/23, 9:42
AM

}
itti

a. 012

b. 123

c. 0 123
d. Infinite loop

Show Answer
Workspace
Operators in Java MCQ -
Javatpoint

12) Which of the following is not a valid primitive data type in


Java?

a. int

b. float

c. double

d. string

Show Answer
Workspac
e

13) What is the output of the following code snippet?


int x = 5;

int y =
10;

if (x < y)
{

System.out.println("x is less
than y");
} else {

}
System.out.println("x is greater than or equal to
y");

a. x is less than
y

b. x is greater than or equal to y

c. Compilation error

https://www.javatpoint.com/operators-in-java-
mcq
5/12
11/15/23, 9:42 AM

d. Runtime error

Show Answer
Workspace
Operators in Java MCQ -
Javatpoint
14) Which of the following operators is used to perform decrement in
Java?

a.

b. +

C. *

d. &

Show Answer
Workspace

15) Which of the following operators is used to perform logical OR in Java?

a. &

b. &&

c.
||

d. ^

Show Answer
Workspac
e

16) Whatt is the output of the following code


snippet?

int a = 5;
int b = 2;

int c = a / b;

System.out.println(c)
;

a. 2

b. 2.5

c. 3

d. Compilation error

https://www.javatpoint.com/operators-in-java-
mcq
6/12
11/15/23, 9:42 AM

Show Answer
Operators in Java MCQ -
Javatpoint

Workspace

17) Which of the following operators is used to perform left shift in Java?

a. <<

b. >>

c. &

d. I

Show Answer
Workspace

18) Which of the following is not a valid identifier in Java?


a. $test

b. test

c. 123test

d. test123

Show Answer
Workspace

19) Which of the following is a conditional operator in


Java?

a. =

b. *

C. +

d. ?

Show Answer
Workspace

20) What is the output of the following code snippet?

int x = 10;

int y = 20;

int z = x+++++y;

https://www.javatpoint.com/operators-in-java-
mcq
7/12
11/15/23, 9:42 AM

System.out.println(z)
;

a. 31

b. 32

c. 33

d. 34

Show Answer
Workspace
Operators in Java MCQ -
Javatpoint

21) Which of the following is a unary logical operator in


Java?

a. !

b. &

c. |

d. ^

Show Answer
Workspace

22) What is the output of the following code snippet?

int i = 0;

do {

System.out.print(i + "
");

i++;

} while (i < 3);

a. 012

b. 123

c. 0123

d. Infinite loop

Show Answer

https://www.javatpoint.com/operators-in-java-
mcq
Workspace

8/12
11/15/23, 9:42 AM
Operators in Java MCQ -
Javatpoint

23) Which of the following operators is used to perform bitwise XOR in


Java?

а. ^

b. |
C. &

d. ~

Show Answer
Workspac
e

24) What is the output of the following code snippet?

int a = 5;

int b = 7;

System.out.println((a > b) ? "a is greater than b" : "a is less than or equal to
b");

a. a is greater than b

b. a is less than or equal to b

c. Compilation error

d. Runtime error

Show Answer

Prev
Workspac
e
You For Videos Join Our Youtube Channel: Join Now
Tub
e

Feedback

• Send your Feedback to feedback@javatpoint.com

https://www.javatpoint.com/operators-in-java-
mcq
Next →

9/12

You might also like