2. What is the correct way to declare a
1 ️
1️⃣
variable in Java?
• A. int x = 10;
• B. var x = 10;
• C. x := 10;
• D. declare int x = 10;
3. Java is a:
2 ️
2️⃣
• A. Procedural Language
• B. Functional Language
• C. Object-Oriented Programming Language
• D. Scripting Language
4. Which method is the entry point of a Java
3️⃣
program?
• A. start()
• B. main()
• C. run()
• D. init()
5. What will be the result of
4 ️
4️⃣
System.out.println(5 + 3 + "Java");?
• A. 8Java
• B. 53Java
• C. Java53
• D. Java8
6. Which keyword is used to create a class?
5️⃣
• A. new
• B. void
• C. class
• D. public
7. What is the default value of an int in Java (class
6 ️
6️⃣
level)?
• A. 0
• B. Null
• C. Undefined
• D. Garbage Value
8. What is the output of:
7 ️
7️⃣
int x = 5;
System.out.println(x++);
• A. 5
• B. 6
• C. Compilation error
• D. Runtime error
9. Which of the following is not a valid access
8 ️
8️⃣
modifier in Java?
• A. public
• B. private
• C. protected
• D. internal
10. What is the use of the final keyword in
9️⃣
Java?
• A. To create an object
• B. To define a constant
• C. To create a class
• D. To import a package
11. 🔟 Which of the following is a checked exception?
• A. NullPointerException
• B. ArithmeticException
• C. IOException
• D. ArrayIndexOutOfBoundsException
12. What does super keyword refer to in Java?
1 ️
1 ️
1️⃣
1️⃣
• A. Parent class
• B. Subclass
• C. Interface
• D. Abstract class
13. Can a class implement multiple interfaces in Java?
1 ️
2 ️
1️⃣
2️⃣
• A. Yes
• B. No
14. Which method is called before object is garbage collected?
1 ️
3 ️
1️⃣
3️⃣
• A. delete()
• B. finalize()
• C. destroy()
• D. dispose()
15. What does static keyword mean in Java?
1 ️
4 ️
1️⃣
4️⃣
• A. Belongs to instance
• B. Belongs to class
• C. Temporary variable
• D. None
16. What is the correct syntax of creating an ArrayList in Java?
1 ️
5 ️
1️⃣
5️⃣
• A. List list = new ArrayList();
• B. Array list = new ArrayList();
• C. ArrayList list = new list();
• D. new ArrayList = List();