CSE MCQs :: JAVA MCQs
- Which of the following can be operands of arithmetic operators?
-
With x = 0, which of the following are legal lines of Java code for changing the value of x to 1?
1. x++;
2. x = x + 1;
3. x += 1;
4. x =+ 1;
- Which of these statements are incorrect?
-
What is the output of this program?class increment {public static void main(String args[]){double var1 = 1 + 5;double var2 = var1 / 4;int var3 = 1 + 5;int var4 = var3 / 4;System.out.print(var2 + " " + var4);}}
-
What is the output of this program?class Modulus {public static void main(String args[]){double a = 25.64;int b = 25;a = a % 10;b = b % 10;System.out.println(a + " " + b);}}
-
What is the output of this program?class increment {public static void main(String args[]){int g = 3;System.out.print(++g * 8);}}
-
What is the output of this program?class Output {public static void main(String args[]){int x , y;x = 10;x++;--x;y = x++;System.out.println(x + " " + y);}}
- Which operator is used to invert all the digits in binary representation of a number?
- On applying Left shift operator, <<, on an integer bits are lost one they are shifted past which position bit?