1. When the operator ++ is placed after the variable name, the first assignment of the value of the variable takes place and then the value of the variable is incremented, this operation is also called ……………………………

A) pre-increment

B) post-increment

C) left to right increment

D) right to left increment

2. When the operators are having the same priority, they are evaluated from ………………………….. in the order they appear in the expression.

A) left to right

B) right to left

C) any of the above

D) none of the above

3. To change the order in which expressions are evaluated …………………. are placed around the expression that is to be evaluated first.

A) ampersand

B) equals

C) parentheses

D) greater than

4. What will be the result of the expression of 8|8.

A) 16

B) 1

C) 8

D) 64

5. What will be the values of x, y and z after execution of the following statements?

int x, y, z;

x=9, y=10;

z=++x=y++;

A) z=21, x=11, y=11

B) z=20, x=10, y=11

C) z=21, x=11, y=10

D) z=20, x=10, y=10

6. If j and k are int type variables, what will be the result of the expression j%k when j=10 and k=3?

A) 0

B) 1

C) 2

D) 3

7. Which of the following operators are overloaded for string objects?

i) – ii) + iii) += iv) &

A) i and ii only

B) ii and iii only

C) iii and iv only

D) ii, iii and iv only

8. When a=9, b=12 and c=3 what will be the value of x for the expression x=9-12/3+3*2-1

A) 10

B) 11

C) 7

D) 8

9. If int x=15; y=20; what will be the value of x after executing the following statement

x=(x<y) ? (y+x) : (y-x);

A) 5

B) 15

C) 25

D) 35

10. State whether the following statement for evaluating the expression (x== y && a<b) are True or False.

i) The Boolean expression x==y is evaluated first and then a<b is evaluated.

ii) The expression (x==y && a<b) is true if either x==y is true or a<b is true.

A) True, False

B) False, True

C) False, False

D) True, True

11. If a=20 and b=15 then the statement x=(a>b) ? a:b; will assign value of x.

A) 5

B) 15

C) 20

D) 35

12. State whether the following statements are true.

i) The modulus operator (%) can be used only with integer operands.

ii) All the bitwise operators have the same level of precedence in Java.

A) True, False

B) False, True

C) False, False

D) True, True

13. What will be the result of the expression -14%-3

A) 2

B) -2

C) 4

D) -4

14. If a and b are integers, then for a=14 and b=4 what will be the value of expression a/b.

A) 3

B) 2

C) 4

D) 1

15. State whether the following statements are True or False.

i) Unlike C and C++, modulus operator (%) in Java can be applied to the floating-point data as well.

ii) The floating-point modulus operator returns the floating-point equivalent of an integer division.

A) True, False

B) False, True

C) False, False

D) True, True

16. When one of the operands is real and the other is an integer, the expression is called a ……………………. expression.

A) hybrid

B) mix-mode-arithmetic

C) arithmetic

D) real-integer

17. Which of the following is/are the advantages of the use of shorthand assignment operators.

i) The statement is more concise and easier to read.

ii) The use of shorthand operators results in a more efficient code.

iii) It provides more accurate results than simple assignment operator.

A) i and ii only

B) ii and iii only

C) i and iii only

D) All i, ii and iii

18. In Java, the ……………………… is used to access the instance variables and methods of class objects.

A) dot operator(.)

B) instance of

C) bitwise

D) conditional

19. The …………………….. is an object reference operator and returns true if the object on the left-hand side is an instance of the class given on the right-hand side.

A) dot operator(.)

B) instance of

C) bitwise

D) conditional

20. State whether the following statements about bitwise operators are True or False.

i) Bitwise operators may not be applied to float or double.

ii) The >>> operator shift right with zero fill.

A) True, False

B) False, True

C) False, False

D) True, True

**Answers:**

1. B) post-increment

2. A) left to right

3. C) parentheses

4. C) 8

5. B) z=20, x=10, y=11

6. B) 1

7. B) ii and iii only

8. A) 10

9. D) 35

10. C) False, False

11. C) 20

12. C) False, False

13. B) -2

14. A) 3

15. D) True, True

16. B) mix-mode-arithmetic

17. A) i and ii only

18. A) dot operator(.)

19. B) instance of

20. D) True, True

#### Read Next: MCQ Questions On Control Flow Statements In Java

Read More: Java MCQ Questions

Comments are closed.