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.
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
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
- Not categorized 0%
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- Current
- Review / Skip
- Answered
- Correct
- Incorrect
-
Question 1 of 15
1. Question
What will be the output of the program ?
- 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 );
}
}
CorrectIncorrect -
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 );
}
}
CorrectIncorrect -
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 );
}
}
CorrectIncorrect -
Question 4 of 15
4. Question
Which of the following is the correct syntax for shift operator?
CorrectIncorrect -
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);
}
}
CorrectIncorrect -
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 );
}
}
CorrectIncorrect -
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);
}
}
CorrectIncorrect -
Question 8 of 15
8. Question
What is the correct syntax for a Ternary Operator ?
CorrectIncorrect -
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”);
}
}
}
CorrectIncorrect -
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);
}
}
CorrectIncorrect -
Question 11 of 15
11. Question
Which of the following operators will work on individual bits like int, short, double , float and char ?
CorrectIncorrect -
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);
}
}
CorrectIncorrect -
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);
}
}
CorrectIncorrect -
Question 14 of 15
14. Question
Which of the following operators in Java has the highest precedence ?
CorrectIncorrect -
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);
}
}
CorrectIncorrect
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.
