1. |
Which of the following can be operands of arithmetic operators?
|
||||||||
Answer:
Option (d) |
2. |
Modulus operator, %, can be applied to which of these?
|
||||||||
Answer:
Option (c) |
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;
|
||||||||
Answer:
Option (c) |
4. |
Decrement operator, --, decreases the value of a variable by what number?
|
||||||||
Answer:
Option (a) |
5. |
Which of these statements are incorrect?
|
||||||||
Answer:
Option (d) |
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); } }
|
||||||||
Answer:
Option (c) |
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); } }
|
||||||||
Answer:
Option (a) |
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); } }
|
||||||||
Answer:
Option (c) |
9. |
Can 8 byte long data type be automatically type cast to 4 byte float data type?
|
||||
Answer:
Option (a) |
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); } }
|
||||||||
Answer:
Option (d) |