ExamTray App is now Available on Google Play EXAMTRAY android app link

 

TOTAL QS = 15Time [ 00 : 00 : 00 ]
00:00:00

Java Basics: Bitwise Operators Online Test 2

Instructions

Total Questions: 12

Total Minutes: 12

This ExamTray Free Online Exam/Quiz/Trivia tests your Java Programming Skills on Java Bitwise Operators and their priority & associativity. You will be tested on Bitwise AND, OR, NOT, XOR/Exclusive OR. This test displays answers after finishing the exam for review. You can easily clear Competitive Exams and Job Interview Questions.

Go through Java Theory Notes on Bitwise Operators before attempting this test.

All the Best

Challenge SCORE

0 / 12

Take This Exam
1) What is the output of the Java program?
byte b = 0b0000101;
System.out.print(b + ",");
b &= 0b00001111;
System.out.print(b);

 
2) What is the output of the Java program?
byte b = 0b00000101;
System.out.print(b + ",");
b |= 0b00001111;
System.out.print(b);
3) What is the output of the Java Program?
byte b = 0b00000101;
System.out.print(b + ",");
b ^= 0b00001111;
System.out.print(b);
4) What is the output of the Java program?
byte b = 0b00000101;
System.out.print(b + ",");
b = (byte)~b;
System.out.print(b);
5) What is the output of the Java program with Left Shift Operator (<<)?
byte b = 0b00000101;
System.out.print(b + ",");
b = (byte)(b << 1);
System.out.print(b);
6) What is the output of Java program with Right Shift Operator (>>)?
byte b = 0b00000101;
System.out.print(b + ",");
b = (byte)(b >> 1);
System.out.print(b);
7) What is the output of the Java program with Right Shift (Without Fill Zeroes)?
byte num = (byte)0b1111_1000;
System.out.print(num + ",");
num = (byte)(num >> 1);
System.out.print(num);
8) What is the output of a Java Program with Shift Right Fill Zeroes (>>>) operator?
byte num = (byte)0b1111_1000;
System.out.print(num + ",");
num = (byte)(num >>> 1);
System.out.print(num);
9) What is the output of Java Program with Shift Right Fill Zeroes operator?
byte num = (byte)0b000_1000;
System.out.print(num + ",");
num = (byte)(num >>> 1);
System.out.print(num);
10) What is the output of the Java program?
byte num = (byte)0b000_1000;
if(num >> 1 > 6)
{
 System.out.print(num);
}
else
{
 System.out.println(num>>1);
}
11) What is the output of the Java Program?
byte num = (byte)0b000_1000;
if(num >> 1 > 6 || true)
{
System.out.print(num);
}
else
{
System.out.println(num>>1);
}
12) What is the output of the Java program?
byte num = (byte)0b000_1000;
if(num >> 1 > 6 || true | 2>3)
{
System.out.print(num+1);
}
else
{
System.out.println(num>>2);
}