Skip to content

Java Operators Quiz Online Test – 1

Java operators quiz 1 contains 10 single and multiple choice questions. Java operators quiz 1 questions are designed in such a way that it will help you understand Java Operators. At the end of the quiz, result will be displayed along with your score and Java operators quiz answers.

There is no time limit to complete the quiz. Click Start Quiz button to start the Java operators quiz online.

  1. What will happen when you compile and run the following code?

    public class Test{
    	
    	public static void main(String[] args) {
    		int i = 0;
    		int j = i++ + ++i;
    		System.out.println( j );
    	}
    }
    
  2. What will happen when you compile and run the following code?

    public class Test{
    	
    	public static void main(String[] args) {
    		int i = 0;
    		int j = ++i + i++;
    		System.out.println( j );
    	}
    }
    
  3. What will happen when you compile and run the following code?

    public class Test{
    	
    	public static void main(String[] args) {
    		int i = 100;
    		int j = 10;
    		System.out.println( i%j );
    	}
    }
    
  4. What will happen when you compile and run the following code?

    public class Test{
    	
    	public static void main(String[] args) {
    		int i = 0;
    		int j = 1;
    		if(!i && j)
    			System.out.println("1");
    		else
    			System.out.println("2");
    	}
    }
    
  5. What will happen when you compile and run the following code?

    public class Test{
    	
    	public static void main(String[] args) {
    		boolean b1 = true, b2 = false, b3 = true;
    		System.out.println( b1&&b2&&!b3 );
    	}
    }
    
  6. What will happen when you compile and run the following code?

    public class Test{
    	
    	public static void main(String[] args) {
    		int i = 10, j = 12, k = 1;
    		k += i++ - --j;
    		System.out.println(k);
    	}
    }
    
  7. What will happen when you compile and run the following code?

    public class Test{
    	
    	public static void main(String[] args) {
    		int i = 10;
    		i++;i++;++i;
    		int j = i++;
    		System.out.println(j);
    	}
    }
    
  8. What will happen when you compile and run the following code?

    public class Test{
    	
    	public static void main(String[] args) {
    		byte b1 = 2;
    		b1 = b1 + 10;
    		
    		byte b2 = 2;
    		b2 += 10;
    		
    		System.out.println(b1 + " " + b2);
    	}
    }
    
  9. What will happen when you compile and run the following code?

    public class Test{
    	
    	public static void main(String[] args) {
    		int i = 19;
    		int j = -5;
    		System.out.println( i%j );
    	}
    }
    
  10. What will happen when you compile and run the following code?

    public class Test{
    	
    	public static void main(String[] args) {
    		int i = -21;
    		int j = 4;		
    		System.out.println( i%j );
    	}
    }