Java Quiz 8 : Operators III & Control Statements

    Welcome to your Java Quiz 8 : Operators III & Control Statements

    1. Which of these have highest precedence?
    2. What should be expression1 evaluate to in using ternary operator as in this line?
     expression1 ? expression2 : expression3
    3. 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;
    4. What is the order of precedence (highest to lowest) of following operators?
     1. & 2. ^ 3. ?:
    5. Which of these statements are incorrect?
    6. What will be the output of the following Java code?
    1.  class operators 
    2.  {
    3.  public static void main(String args[])
    4.  {
    5.  int var1 = 5; 
    6.  int var2 = 6;
    7.  int var3;
    8.  var3 = ++ var2 * var1 / var2 + var2;
    9.  System.out.print(var3);
    10.  } 
    11.  }
    7. What will be the output of the following Java code?
    1.  class operators 
    2.  {
    3.  public static void main(String args[]) 
    4.  { 
    5.  int x = 8;
    6.  System.out.println(++x * 3 + " " + x);
    7.  } 
    8.  }
    8. What will be the output of the following Java code?
    1. class Output 
    2. {
    3.  public static void main(String args[]) 
    4.  { 
    5.  int x=y=z=20;
    6.  
    7.  } 
    8. }
    9. Which of these lines of Java code will give better performance?
     1. a | 4 + c >> b & 7; 2. (a | ((( 4 * c ) >> b ) & 7 ))
    10. What will be the output of the following Java program?
    1. class Output 
    2. {
    3.  public static void main(String args[]) 
    4.  { 
    5.  int a,b,c,d;
    6.  a=b=c=d=20
    7.  a+=b-=c*=d/=20
    8.  System.out.println(a+" "+b+" "+c+" "+d);
    9.  
    10.  } 
    11. }
    11. Which of these selection statements test only for equality?
    12. Which of these are selection statements in Java?
    13. Which of the following loops will execute the body of loop even when condition controlling the loop is initially false?
    14. Which of these jump statements can skip processing the remainder of the code in its body for a particular iteration?
    15. Which of this statement is incorrect?