Question 1 of 25
Hints left: 3
Q1
Determine output: public class Test{ static int i = 5; public static void main(String... args){ System.out.println(i++); System.out.println(i); System.out.println(++i); System.out.println(++i+i++); } }
Q2
What is the output of the following program? class Numbers{ public static void main(String args[]){ int a=20, b=10; if((a < b) && (b++ < 25)){ System.out.println("This is any language logic"); } System.out.println(b); } }
Q3
What will be the output of the following Java code? class operators { public static void main(String args[]) { int var1 = 5; int var2 = 6; int var3; var3 = ++ var2 * var1 / var2 + var2; System.out.print(var3); } }
Q4
What will be the output after compiling and running following code? public class Test{ public static void main(String... args){ int x =5; x *= 3 + 7; System.out.println(x); } }
Q5
What will be the output of the following Java code? class Relational_operator { public static void main(String args[]) { int var1 = 5; int var2 = 6; System.out.print(var1 > var2); } }
Q6
Which of the following can be operands of arithmetic operators?
Q7
int ++a = 100 ; System.out.println( ++a ) ; What will be the output of the above fraction of code ?
Q8
Which of these are selection statements in Java?
Q9
What will be the output of the following Java program? class leftshift_operator { public static void main(String args[]) { byte x = 64; int i; byte y; i = x << 2; y = (byte) (x << 2) System.out.print(i + " " + y); } }
Q10
What will be the output of the following Java program? class comma_operator { public static void main(String args[]) { int sum = 0; for (int i = 0, j = 0; i < 5 & j < 5; ++i, j = i + 1) sum += i; System.out.println(sum); } }
Q11
What will be the output for the below code? class A{ public void printValue(){ System.out.println("A"); } } class B extends A{ public void printValue(){ System.out.println("B"); } } public class Test{ public static void main(String... args){ A b = new B(); newValue(b); } public static void newValue(A a){ if(a instanceof B){ ((B)a).printValue(); } } }
Q12
Which of these jump statements can skip processing the remainder of the code in its body for a particular iteration?
Q13
Which operator is used to invert all the digits in a binary representation of a number?
Q14
Which of these statements are incorrect?
Q15
On applying Left shift operator, <<, on integer bits are lost one they are shifted past which position bit?
Q16
With x = 0, which of the following are legal lines of Java code for changing the value of x to 1? 1. x++; 2. x = x + 1; 3. x += 1; 4. x =+ 1;
Q17
Which of the following is used with the switch statement?
Q18
What will be the output? public class Test{ public static void main(String args[]){ int a = 42; double b = 42.25; System.out.print((a%10)+" "+(b%10)); } }
Q19
What will be the output of the following Java program? class jump_statments { public static void main(String args[]) { int x = 2; int y = 0; for ( ; y < 10; ++y) { if (y % x == 0) continue; else if (y == 8) break; else System.out.print(y + " "); } } }
Q20
Select from among the following character escape code which is not available in Java.
Q21
What will be the output? public class Test{ public static void main(String args[]){ System.out.print(""==""); System.out.print(" "); System.out.print("A"=="A"); System.out.print(" "); System.out.print("a==A"); } }
Q22
Which of the following is the correct expression that evaluates to true if the number x is between 1 and 100 or the number is negative?
Q23
What will be the output? if(1 + 1 + 1 + 1 + 1 == 5){ System.out.print("TRUE"); } else{ System.out.print("FLASE"); }
Q24
Which of these operators can skip evaluating right hand operand?
Q25
Determine output: public class Test{ public static void main(String... args){ int a=5 , b=6, c=7; System.out.println("Value is "+ b + c); System.out.println(a + b + c); System.out.println("String " + (b+c)); } }