Java Operators Questions and Answers

This page consist of Java Operators quiz questions and answers., Java Interview questions. All questions are in the form of MCQs. You can also download the Java Operators Pdf from here.
1. Which of the following can be operands of arithmetic operators?
[A] Numeric
[B] Boolean
[C] Characters
[D] Both Boolean & Characters
Loading...
2. What is the output of the program.
class operators {

public static void main(String args[])

{

int x = 8;

System.out.println(++x * 3 + "," + x);

}

}
[A] 24,8
[B] 24,9
[C] 27,8
[D] 27,9
Loading...
3. What is the output of the program.
public class Test 

{

public static void leftshift(int i, int j)

{

i <<= j;

}

public static void main(String args[])

{

int i = 4, j = 2;

leftshift(i, j);

System.out.printIn(i);

}

}
[A] 2
[B] 4
[C] 8
[D] 16
Loading...
4. what is the output of the program ?
class Equals 

{

public static void main(String [] args)

{

int x = 100;

double y = 100.1;

boolean b = (x = y);

System.out.println(b);

}

}
[A] true
[B] false
[C] Compilation fails
[D] An exception is thrown at run time
Loading...
5. What is the output of the program ?
class Test 

{

public static void main(String [] args)

{

int x=20;

String sup = (x < 15) ? "small" : (x < 22)? "tiny" : "huge";

System.out.println(sup);

}

}
[A] small
[B] tiny
[C] huge
[D] compilaton fails
Loading...
6. Modulus operator, %, can be applied to which of these?
[A] Integers
[B] Floating – point numbers
[C] Both Integers and floating – point numbers
[D] None of the mentioned
Loading...
7. Decrement operator, –, decreases value of variable by what number?
[A] 1
[B] 2
[C] 3
[D] 4
Loading...
8. Which of these statements are incorrect?
[A] Assignment operators are more efficiently implemented by Java run-time system than their equivalent long forms.
[B] Assignment operators run faster than their equivalent long forms
[C] Assignment operators can be used only with numeric and character data type
[D] None
Loading...
9. What is the output of this program?
class increment {

public static void main(String args[])

{

int g = 3;

System.out.print(++g * 8);

}

}
[A] 25
[B] 24
[C] 32
[D] 33
Loading...
10. Which of these is not a bit-wise operator?
[A] &
[B] &=
[C] |=
[D] <=
Loading...
Are these questions helpful for you?

Comments: (Your feedback is valuable to us)