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

Java Basics: Logical Operators Online Test 2

Instructions

Total Questions: 20

Total Minutes: 20

This ExamTray Free Online Exam/Quiz/Trivia tests your Java Programming Skills on Java Logical Operators or Boolean Operators. Logical operators work with boolean data type values like true or false. You will be tested on Logical AND, OR, NOT, XOR/Exclusive OR, Short Circuit AND/OR operators and their priority/associativity. 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 Logical Operators before attempting this test.

All the Best

Challenge SCORE

0 / 20

Take This Exam
1) What happens to the Second operand/expression if the first operand is FALSE with a Short Circuit AND (&&) operator?
2) What happens to the Second Operand/expression if the first operand is TRUE with a Short Circuit OR (||) operator in Java?
3) What is the output of an Exclusive OR (^) operation if one of the operands/expressions is TRUE?
4) What is the output of an Exclusive OR(^) operation, if one of the operands is false?
5) Which is the Logical operator in Java that has the highest priority among all other logical operators?
6) Among the Logical operators, AND (&) and Short Circuit AND (&&), which has higher priority?
7) Among the logical operators, OR (|) and Short Circuit OR (||), which operator has higher priority?
8) Among the logical operators, OR (|), Short Circuit OR (||) and Exclusive OR (^), which operator has higher priority?
9) Choose the correct version of Logical Compound Assignment operators in Java below?
10) What is the output of the Java code snippet below?
byte a= 1;
if(!a)
{
  System.out.println("FISH");
}
else
{
  System.out.println("CRAB");
}
11) What is the output of the Java code snippet?
int a=25, b=30;
boolean c = a>25 & b<40;
if(c)
{
  System.out.println("RABBIT");
}
else
{
  System.out.println("GOOSE");
}
12) What is the output of the Java code snippet?
int a=25, b=30;
boolean c = a>25 | b<40;
if(c)
{
  System.out.println("RABBIT");
}
else
{
  System.out.println("GOOSE");
}
13) What is the output of the Java code snippet?
int a=3, b=8;
boolean c = a>5 && ++b>6;
System.out.println(b);
14) What is the output of the Java code snippet?
int a=5, b=9;
boolean c = a>1 || b++<10;
System.out.println(b);
15) What is the output of the Java code snippet?
int a=4, b=6, c=8;
boolean d = a>5 && b>5 & c++<10;
System.out.println(c);
16) What is the output of the Java code snippet?
int a=4, b=8;
boolean c = a>1 ^ b<10;
if(c)
{
  System.out.println("TREE");
}
else
{
  System.out.println("BIRD");
}
17) What is the output of the Java code snippet?
int a=5;
boolean b = a>1 || false;
b ^= false;
System.out.println(b);
18) What is the output of the Java code snippet?
int a=4, b=8;
boolean c = a>2 ^ b<10 & false;
System.out.println(c);
19) What is the output of the Java code snippet?
int a=3, b=1;
int c = a & b;
System.out.println("CAT " + c);
20) If an AND (&) operator is applied with two integers, what is this operator?
Certification Group ID
3845

Open Certification Helper Popup Reset Popup