Question 1 of 25
Hints left: 3
Q1
What will be the output of the following Java code? class Output { public static void main(String args[]) { int x , y = 1; x = 10; if (x != 10 && x / 0 == 0) System.out.println(y); else System.out.println(++y); } }
Q2
What is the order of precedence (highest to lowest) of following operators? 1. & 2. ^ 3. ?:
Q3
What will be the output of the following Java program? class Output { public static void main(String args[]) { int a = 1; int b = 2; int c = 3; a |= 4; b >>= 1; c <<= 1; a ^= c; System.out.println(a + " " + b + " " + c); } }
Q4
Which of these statements are incorrect?
Q5
What will be the output of the following Java code? class Output { public static void main(String args[]) { boolean a = true; boolean b = false; boolean c = a ^ b; System.out.println(!c); } }
Q6
Which of these statements are incorrect?
Q7
Which of the following loops will execute the body of loop even when condition controlling the loop is initially false?
Q8
What will be the output of the following Java program? class rightshift_operator { public static void main(String args[]) { int x; x = 10; x = x >> 1; System.out.println(x); } }
Q9
Which of these lines of Java code will give better performance? 1. a | 4 + c >> b & 7; 2. (a | ((( 4 * c ) >> b ) & 7 ))
Q10
What will be the output of the following Java program? class Output { public static void main(String args[]) { final int a=10,b=20; while(a<b) { System.out.println("Hello"); } System.out.println("World"); } }
Q11
What will be the output of the following Java program? class Output { public static void main(String args[]) { int a = 1; int b = 2; int c; int d; c = ++b; d = a++; c++; b++; ++a; System.out.println(a + " " + b + " " + c); } }
Q12
What is the value stored in x in the following lines of Java code? int x, y, z; x = 0; y = 1; x = y = z = 8;
Q13
Which of these is not a bitwise operator?
Q14
What will be the output of the following Java code? class operators { public static void main(String args[]) { int x = 8; System.out.println(++x * 3 + " " + x); } }
Q15
What will be the output of the following Java program? class Modulus { public static void main(String args[]) { double a = 25.64; int b = 25; a = a % 10; b = b % 10; System.out.println(a + " " + b); } }
Q16
Can 8 byte long data type be automatically type cast to 4 byte float data type?
Q17
Which of the following operators can operate on a boolean variable? 1. && 2. == 3. ?: 4. +=
Q18
Which right shift operator preserves the sign of the value?
Q19
What will be the output of the following Java program? class Output { public static void main(String args[]) { int a = 5; int b = 10; first: { second: { third: { if (a == b >> 1) break second; } System.out.println(a); } System.out.println(b); } } }
Q20
Which of this statement is incorrect?
Q21
What is true about do statement?
Q22
What will be the output of the following Java code? class Output { public static void main(String args[]) { int x=y=z=20; } }
Q23
What will be the output of the following Java program? class increment { public static void main(String args[]) { double var1 = 1 + 5; double var2 = var1 / 4; int var3 = 1 + 5; int var4 = var3 / 4; System.out.print(var2 + " " + var4); } }
Q24
What will be the output of the following Java program? class increment { public static void main(String args[]) { int g = 3; System.out.print(++g * 8); } }
Q25
What will be the output of the following Java program? class bitwise_operator { public static void main(String args[]) { int a = 3; int b = 6; int c = a | b; int d = a & b; System.out.println(c + " " + d); } }