Explore topic-wise MCQs in Java Programming.

This section includes 2 Mcqs, each offering curated multiple-choice questions to sharpen your Java Programming knowledge and support exam preparation. Choose a topic below to get started.

1.

What is the output of this program?public class Result { public static void main(String args[]) { final int p=10, q=20; while(p>q) { System.out.println("Hello"); } System.out.println("Java"); } }

A. compile time error
B. Hello world
C. run time error
D. Hello
E. None of these
Answer» B. Hello world
2.

What is the output of this program?public class comma_operator { public static void main(String args[]) { int sum = 0; for (int k = 0, L = 0; k < 10 & L < 10; ++k, L = k + 1) sum += k; System.out.println(sum); } }

A. 46
B. 36
C. 26
D. 56
E. None of these
Answer» C. 26