Question 1 of 25
Hints left: 3
Q1
Which keyword is used to define a method in Java?
Q2
Decrement operator, - -, decreases the value of variable by what number?
Q3
Which of the following is not a valid flow control statement?
Q4
From where break statement causes an exit?
Q5
What is the valid data type for variable "a" to print "Hello World"? switch(a) { System.out.println("Hello World"); }
Q6
What is the output of relational operators?
Q7
Which of the following is not a valid jump statement?
Q8
Which of these have highest precedence?
Q9
Which of these statements is correct?
Q10
Which of these is returned by "greater than", "less than" and "equal to" operators?
Q11
Which of these selection statements test only for equality?
Q12
What will be the output of the following Java program? class selection_statements { public static void main(String args[]) { int var1 = 5; int var2 = 6; if ((var2 = 1) == var1) System.out.print(var2); else System.out.print(++var2); } }
Q13
Modulus operator, %, can be applied to which of these?
Q14
What is a constructor in Java?
Q15
What will be the output of the following Java code? class bool_operator { public static void main(String args[]) { boolean a = true; boolean b = !true; boolean c = a | b; boolean d = a & b; boolean e = d ? b : c; System.out.println(d + " " + e); } }
Q16
What is method overloading in Java?
Q17
What will be the output of the following Java code? class ternary_operator { public static void main(String args[]) { int x = 3; int y = ~ x; int z; z = x > y ? x : y; System.out.print(z); } }
Q18
In Java, which method is automatically called when an object is created?
Q19
What will be the output of the following Java program? class Output { public static void main(String args[]) { int a,b,c,d; a=b=c=d=20; a+=b-=c*=d/=20; System.out.println(a+" "+b+" "+c+" "+d); } }
Q20
What will be the output of the following Java program? class bitwise_operator { public static void main(String args[]) { int var1 = 42; int var2 = ~var1; System.out.print(var1 + " " + var2); } }
Q21
What would be the output of the following code snippet if variable a=10? if(a<=0) { if(a==0) { System.out.println("1 "); } else { System.out.println("2 "); } } System.out.println("3 ");
Q22
The while loop repeats a set of code while the condition is not met?
Q23
What should be expression1 evaluate to in using ternary operator as in this line? expression1 ? expression2 : expression3
Q24
What is true about a break?
Q25
Which of the following is not a decision making statement?