Java MCQ Questions and Answers on Bitwise Operators 1

Study and learn Java MCQ Questions and Answers on Bitwise Operators and their priorities. Attend job interviews easily with these Multiple Choice Questions. You can print these Questions in default mode to conduct exams directly. You can download these MCQs in PDF format by Choosing Print Option first and Save As PDF option next using a Google Chrome browser or any other browser.

Go through Java Theory Notes on Bitwise Operators before reading the questions.



1) Identify the Bitwise NOT operator in Java below.
A)
!
B)
&
C)
~
D) None of the above
Answer [=]
Answer[=]
2) Bitwise operators in Java work with?
A) boolean data like true or false
B) Real numbers like float or double
C) Individual bits of integers like byte, short, int, long and char
D) All the above
Answer [=]
Answer[=]
3) Find operators that work as both Logical operators and Bitwise operators in Java?
A)
&, &=
B)
|, |=
C)
^, ^=
D) All the above
Answer [=]
Answer[=]
4) If relational operators are present in an expression, what type of other operators may be used?
A) Logical operators
B) Bitwise operators
C) A and B
D) None of the above
Answer [=]
Answer[=]
5) What is the name of << bitwise operator in Java?
A) Right Shift Operator
B) Left Shift Operator
C) Left Shift Fill Zero operator
D) Right Shift Fill Zero operator
Answer [=]
Answer[=]
6) What is this >> bitwise operator in Java?
A) Left shift operator
B) Right shift operator
C) Left Shift Fill Zero operator
D) Right Shift Fill Zero operator
Answer [=]
Answer[=]
7) What is this >>> bitwise operator in Java?
A) Left Shift operator
B) Left Shift Fill Zero operator
C) Right Shift Operator
D) Right Shift Fill Zero operator
Answer [=]
Answer[=]


 

8) Left Shift (<<) in Java is equivalent to?
A) Subtracting the number by 2
B) Dividing the number by 2
C) Multiplying the number by 2
D) Adding the number by 2
Answer [=]
Answer[=]
9) Right Shift >> in Java is equivalent to?
A) Multiplying the number by 2
B) Dividing the number by 2`
C) Subtracting the number by 2
D) Adding the number by 2
Answer [=]
Answer[=]
10) What is the output of the Java code snippet?
byte a = 0b0000_0001;
System.out.println(~a);
A) -1
B) -2
C) 254
D) +127
Answer [=]
Answer[=]
11) What does this Java code snippet prints?
int b=45;
String str="";
while(b > 0)
{
  str = str + b%2;
  b = b/2;
}
StringBuilder sb = new StringBuilder(str);
sb.reverse();
System.out.println(sb.toString());
A) Prints the remainder of a number
B) Prints Binary representation of a number
C) Prints Octal representation of a number
D) Prints Hexadecimal representation of a number
Answer [=]
Answer[=]
12) What is the output of the Java code snippet?
System.out.println(0b0000_1000);
A) 0b0000_1000
B) 1000
C) 8
D) 9
Answer [=]
Answer[=]
13) What is the output of a Bitwise AND (&) operation if both the inputs/operands are 1s?
A) 0
B) 1
C) 0 or 1
D) None of the above
Answer [=]
Answer[=]
14) What is the output of a Bitwise OR (|) operation if both the inputs are 1s?
A) 0
B) 1
C) 0 or 1
D) None of the above
Answer [=]
Answer[=]


 

15) What is the output of a Bitwise AND (&) operation if one of the inputs/operands is 0?
A) 0
B) 1
C) 0 or 1
D) None of the above
Answer [=]
Answer[=]
16) What is the output of a Bitwise OR (|) operation if one of the inputs/operands is 1?
A) 0
B) 1
C) 0 or 1
D) None of the above
Answer [=]
Answer[=]
17) What is the output of a Bitwise AND (&) operation if one of the inputs/operands is 1?
A) 0
B) 1
C) 0 or 1
D) None of the above
Answer [=]
Answer[=]
18) What is the output of a Bitwise OR (|) operation if one of the inputs/operands is 0?
A) 0
B) 1
C) 0 or 1
D) None of the above
Answer [=]
Answer[=]
19) What is the output of a Bitwise Exclusive OR (^) operation if both of the inputs/operands are 0s or 1s?
A) 0
B) 1
C) 0 or 1
D) None of the above
Answer [=]
Answer[=]
20) What is the output of a Bitwise Exclusive OR (^) operation if both the inputs/operands are different?
A) 0
B) 1
C) 0 or 1
D) None of the above
Answer [=]
Answer[=]


Like or Share

Show some care. Like or Subscribe. [FB]...[Youtube]

C MCQ App by ExamTray 

Android APP

Java MCQ App by ExamTray 

Android APP
ALL MCQ App by ExamTray Android APP

Ad

 

Try Some Java Books

Book Price
1. Java - The Complete Reference  Check Price
2. Core Java: An Integrated Approach, Black Book Check Price
3. Java All-in-One for Dummies Check Price
4. OCP Java SE 8: Programmer II Check Price
5. Programming with Java Check Price
6. Head First Java Check Price

We may get some affiliate commission for the above purchases.