MCQOPTIONS
Saved Bookmarks
This section includes 4 Mcqs, each offering curated multiple-choice questions to sharpen your Technical MCQs knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
class Output{ public static void main(String args[]) { boolean a = true; boolean b = false; boolean c = a ^ b; System.out.println(!c); }}30.Which of these have highest precedence? |
| A. | () |
| B. | ++ |
| C. | * |
| D. | >> |
| E. | |
| Answer» B. ++ | |
| 2. |
class Output{ public static void main(String args[]) { int x , y = 1; x = 10; if (x != 10 && x / 0 == 0) System.out.println(y); else System.out.println(++y); }} 29.What is the output of this program? |
| A. | 0 |
| B. | 1 |
| C. | FALSE |
| D. | TRUE |
| Answer» D. TRUE | |
| 3. |
class ternary_operator{ public static void main(String args[]) { int x = 3; int y = ~ x; int z; z = x > y ? x : y; System.out.print(z); }}28.What is the output of this program? |
| A. | 1 |
| B. | 2 |
| C. | Runtime error owing to division by zero in if condition |
| D. | Unpredictable behavior of program |
| Answer» C. Runtime error owing to division by zero in if condition | |
| 4. |
class Relational_operator{ public static void main(String args[]) { int var1 = 5; int var2 = 6; System.out.print(var1 > var2); }} 27.What is the output of this program? |
| A. | 0 |
| B. | 1 |
| C. | 3 |
| D. | -4 |
| Answer» D. -4 | |