Java Quiz 6 : Operators By Tejas Chaudhari - August 28, 2021 FacebookTwitterPinterestWhatsApp Welcome to your Java Quiz 6 : Operators 1. Which of the following can be operands of arithmetic operators?a) Numericb) Booleanc) Charactersd) Both Numeric & Characters 2. Modulus operator, %, can be applied to which of these?a) Integersb) Floating – point numbersc) Both Integers and floating – point numbersd) None of the mentioned 3. 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;a) 1, 2 & 3b) 1 & 4c) 1, 2, 3 & 4d) 3 & 2 4. Decrement operator, −−, decreases the value of variable by what number?a) 1b) 2c) 3d) 4 5. Which of these statements are incorrect?a) Assignment operators are more efficiently implemented by Java run-time system than their equivalent long formsb) Assignment operators run faster than their equivalent long formsc) Assignment operators can be used only with numeric and character data typed) None of the mentioned 6. What will be the output of the following Java 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); } } a) 1 1b) 0 1c) 1.5 1d) 1.5 1.0 7. What will be the output of the following Java 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); } } a) 5.640000000000001 5b) 5.640000000000001 5.0c) 5 5d) 5 5.640000000000001 8. What will be the output of the following Java program? class increment { public static void main(String args[]) { int g = 3; System.out.print(++g * 8); } } a) 25b) 24c) 32d) 33 9. Can 8 byte long data type be automatically type cast to 4 byte float data type?a) Trueb) False 10. What will be the output of the following Java program? class Output { public static void main(String args[]) { int a = 1; int b = 2; int c; int d; c = ++b; d = a++; c++; b++; ++a; System.out.println(a + " " + b + " " + c); } } a) 3 2 4b) 3 2 3c) 2 3 4d) 3 4 4 11. Which of these is not a bitwise operator?a) &b) &=c) |=d) <= 12. Which operator is used to invert all the digits in a binary representation of a number?a) ~b) <<<c) >>>d) ^ 13. On applying Left shift operator, <<, on integer bits are lost one they are shifted past which position bit?a) 1b) 32c) 33d) 31 14. Which right shift operator preserves the sign of the value?a) <<b) >>c) <<=d) >>= 15. Which of these statements are incorrect?a) The left shift operator, <<, shifts all of the bits in a value to the left specified number of timesb) The right shift operator, >>, shifts all of the bits in a value to the right specified number of timesc) The left shift operator can be used as an alternative to multiplying by 2d) The right shift operator automatically fills the higher order bits with 0 Time is Up!