Complete Subject Question Bank
Using Java we can develop ___________________.
Correct answer: Both the options.
The main method in java should ___________.
Correct answer: be public static.
The break statement cannot be present for _____________ construct.
Correct answer: if.
A continue statement makes the execution jump to ______________.
Correct answer: the next iteration of the loop.
Identify the features of java.
Correct answer: Exception Handling.
a for loop, if the number of statements are greater than one, which of the following needs to be inserted at the beginning and the end of the loop?
Correct answer: French curly braces{ }.
JRE comprises of ___________ and ___________.
Correct answer: JVM; API.
1What will be the output of the program? public class Sample { final static short a = 2; public static int b = 0; public static void main(String [] args) { for (int c=0; c < 4; c++) { switch (c) { case a: System.out.print("a "); default: System.out.print("default "); case a-1: System.out.print("a-1 "); break; case a-2: System.out.print("a-2 "); } } } }
Correct answer: a-2 a-1 a default a-1 default a-1.
The ________________ statement causes the program execution to stop and JVM to shut down.
Correct answer: System.exit.
JVM is independent of OS
JVM abstracts the OS; Java bytecode runs on any JVM regardless of OS.
To compile, debug and execute a program written in java, _______________ is required.
Correct answer: JDK.
State true or false. Java is a structured programming language.
Correct answer: Java is a structured programming languag.
Who is the father of Java?
Correct answer: James Gosling.
What is Polymorphism?
Correct answer: ability to have many forms.
How was Java initially named?
Correct answer: The Oak.
Java is _____________________________.
Correct answer: Platform independent.
1What is the output of this program? 1. class Crivitch { 2. public static void main(String [] args) { 3. int x = 10; 4. 5. do { } while (x++ < y); 6. System.out.println(x); 7. } 8. } Which statement, inserted at line 4, produces the output 12?
Correct answer: int y=11;.
1What will be the output of the program? Given: 10. int x = 0; 11. int y = 10; 12. do { 13. y--; 14. ++x; 15. } while (x < 5); 16. System.out.print(x + "," + y); What is the result?
Correct answer: 5,5.
1What is the output of this program? class selection_statements { public static void main(String args[]) { int var1 = 5; int var2 = 6; if ((var2 = 1) == var1) System.out.print(var2); else System.out.print(++var2); } }
Correct answer: 2.
1Fill in the appropriate data type for the Java switch statement: switch (____) { case value1: ... case value2: ... default: System.out.println("Hello"); }
Java switch supports byte, short, char, int, their wrapper classes, enums, and String. Among the options, byte is valid.
Based on our question bank analysis, master these concepts to score high in Java Programming.
Test your knowledge under real exam conditions with our curated mock assessment.
Start Preparing for Primers