Site icon DataFlair

Quiz on Java Operators

quiz on java operators

Get Job-ready: Java Course with 45+ Real-time Projects! - Learn Java

Operators are the building blocks of any programming language, and Java is no exception. Understanding how to effectively use operators is fundamental to writing clean, efficient, and maintainable Java code.

This interactive quiz provides a fun and engaging way to assess your grasp of core Java operators, from basic arithmetic operations to more advanced concepts like bitwise operators and conditional statements.

Whether you’re a seasoned Java programmer or just getting started, this quiz is a valuable tool for solidifying your knowledge and identifying areas for improvement. Let’s test your knowledge of Java Operators.

Time limit: 0

Quiz Summary

0 of 15 Questions completed

Questions:

Information

You have already completed the quiz before. Hence you can not start it again.

Quiz is loading…

You must sign in or sign up to start the quiz.

You must first complete the following:

Results

Quiz complete. Results are being recorded.

Results

0 of 15 Questions answered correctly

Your time:

Time has elapsed

You have reached 0 of 0 point(s), (0)

Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)

Categories

  1. Not categorized 0%
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  1. Current
  2. Review / Skip
  3. Answered
  4. Correct
  5. Incorrect
  1. Question 1 of 15
    1. Question

    What will be the output of the program ?

    1. class Operator {

    public static void main ( String args [ ] ) {

    int x = 1;

    int y = 2;

    int z = ++x + –y;

    system.out.println( “ Value of z is “ + z );

    }

    }

    Correct
    Incorrect
  2. Question 2 of 15
    2. Question

    What will be the output of the program?

    class modulus {

    public static void main ( String args [ ] )

    {

    int a = 5, b = 4 ;

    float c;

    system.out.println(c = a % b );

    }

    }

    Correct
    Incorrect
  3. Question 3 of 15
    3. Question

    What will be the output of the program?

    class Unary {

    public static void main ( String args [ ] ) {

    int a = 101;

    boolean b = true;

    system.out.println( ~ a + ~ b );

    }

    }

    Correct
    Incorrect
  4. Question 4 of 15
    4. Question

    Which of the following is the correct syntax for shift operator?

    Correct
    Incorrect
  5. Question 5 of 15
    5. Question

    What is the error in the program ?

    class Error {

    public static void main ( String args [ ] )

    {

    int a = 4;

    float b = 3;

    int c = ++a– + –b;

    system.out.println(c);

    }

    }

    Correct
    Incorrect
  6. Question 6 of 15
    6. Question

    What will be the output of the program?

     public class Test {

       public static void main( String args [ ] )

      {

          int a, b;

          a = 11;

          b = (a == 1) ? 12;

          System.out.println(   b );

          b = (a == 10) ? 12: 13;

          System.out.println( + b );

       }

    }

    Correct
    Incorrect
  7. Question 7 of 15
    7. Question

    What will be the output of the program?

    class operators {

    Public static void main ( String args [] )

    {

    Int x = 5;

     system.out.println( ++x + –x);

    }

    }

    Correct
    Incorrect
  8. Question 8 of 15
    8. Question

    What is the correct syntax for a Ternary Operator ?

    Correct
    Incorrect
  9. Question 9 of 15
    9. Question

    What is the output of the program?

    public class RelationalOperators {

    public static void main( String args [ ] ) {

    String a = “DataFlair”;

    String c = “Data”;

    String d = “Flair”;

    String b = c+d;

    if (a == b) {

    System.out.println(“a is equal to b”);

    }

    else {

    System.out.println(“a is NOT equal to b”);

    }

    }

    }

    Correct
    Incorrect
  10. Question 10 of 15
    10. Question

    What will be the value of b after execution ?

    class Shift {

    public static void main ( String args [ ] ) {

    int a = 10;

    int b = <<a;

    system.out.println(b);

    }

    }

    Correct
    Incorrect
  11. Question 11 of 15
    11. Question

    Which of the following operators will work on individual bits like int, short, double , float and char ?

    Correct
    Incorrect
  12. Question 12 of 15
    12. Question

    What will be the output of the following code?

    class Operators {

    public static void main ( String args [] ) 

    {

    int a = 16;

    int b = 5;

      int c = a % b;

    system.out.println(c);

    }

    }

    Correct
    Incorrect
  13. Question 13 of 15
    13. Question

    According to operator precedence in Java what will be the output of the program ?

    class Arithmetic {

    public static void main ( String args [ ] ) 

    {

    int a = 3, b= 4, c=5;

    int d = a + b * c;

    system.out.println(d);

    }

    }

    Correct
    Incorrect
  14. Question 14 of 15
    14. Question

     Which of the following operators in Java has the highest precedence ?

    Correct
    Incorrect
  15. Question 15 of 15
    15. Question

    Which operator will be executed first ?

    class precedence {

    public static void main ( String args [ ] ) 

    {

    int a,b,c,d,e,f,g,h;

    h = ( a + b ) * c – d % e + f / g;

    system.out.println(h);

    }

    }

    Correct
    Incorrect

Summary:

Congratulations on completing the Java Operator Quiz! By participating in this interactive assessment, you’ve gained valuable insights into your understanding of fundamental Java operators.

Did you ace the quiz? If so, great job! Your strong grasp of these core concepts will serve you well as you continue your Java development journey. Even if you encounter some challenges, don’t be discouraged. This quiz serves as a valuable learning tool, highlighting areas where you can focus your studies.

Exit mobile version