Advanced Java Quiz (Day 1-15)

Last Updated :
Discuss
Comments

Question 1

Which of the following is true about primitive data types and wrapper classes in Java?

  • Wrapper classes store data more efficiently than primitives

  • Primitives can be used in collections

  • Wrapper classes are objects that wrap primitive types

  • Primitives can be directly cast to String

Question 2

What does method overloading allow you to do in Java?

  • Define multiple methods with the same name and same parameters

  • Define methods with different return types only

  • Define methods with the same name but different parameter types or count

  • Redefine a method from a superclass

Question 3

Which keyword is used to call the constructor of a parent class?

  • this()

  • parent()

  • super()

  • base()

Question 4

Which of these can be overloaded in Java?

  • Constructors

  • Main method

  • Static methods

  • All of the above

Question 5

What will be the output of this code?

Java
int x = 5;
System.out.println(x > 2 ? x < 4 ? 10 : 8 : 7);


  • 10

  • 8

  • 7

  • 5

Question 6

Which method is called during dynamic method dispatch?

  • The method of the reference class

  • The method of the object’s actual class

  • A private method

  • A static method

Question 7

Which type of inheritance is not directly supported in Java using classes?

  • Single

  • Multilevel

  • Hierarchical

  • Multiple

Question 8

Which class is mutable among these?

  • String

  • StringBuilder

  • Integer

  • Character

Question 9

What happens when you add a primitive to an ArrayList?

  • Compile-time error

  • Runtime error

  • It automatically converts using autoboxing

  • It is not allowed

Question 10

What is the main benefit of the Collections framework?

  • Faster file handling

  • Simplified array syntax

  • Reusable data structures and algorithms

  • Support for dynamic memory

Tags:

There are 25 questions to complete.

Take a part in the ongoing discussion