Search Tutorials


Java Abstraction MCQ - Multiple Choice Questions And Answers | JavaInUse

Java Abstraction MCQ - Multiple Choice Questions And Answers

Q. What is the purpose of abstraction in Java?

A. To produce results
B. To consume values
C. To filter elements based on a condition
D. To hide implementation details and provide a simplified interface

Q. Select the correct statement about abstraction in Java.

A. Abstraction is only applicable to classes, not interfaces
B. Abstraction is only useful in large-scale applications
C. Abstraction allows for code reuse and modularity
D. Abstraction is not supported in Java

Q. Which keyword is used to implement abstraction in Java?

A. abstract
B. implements
C. extends
D. class

Q. Which statement is true about abstract classes in Java?

A. An abstract class can be instantiated directly
B. An abstract class can have both abstract and non-abstract methods
C. An abstract class must implement all methods declared as abstract in its superclasses
D. An abstract class cannot have any constructors

Q. Which statement is true about interfaces in Java?

A. An interface can be instantiated directly
B. An interface can have instance variables
C. An interface can implement other interfaces
D. An interface can have both abstract and non-abstract methods

Q. Which of the following is an example of abstraction in Java?

A. ArrayList class
B. Scanner class
C. Math class
D. String class

Q. Which of the following statements is true about method overriding in Java?

A. In method overriding, the method names must be different in the superclass and the subclass
B. Method overriding can only be applied to abstract methods
C. Method overriding is not related to abstraction in Java
D. In method overriding, the method signature must be the same in the superclass and the subclass

Q. What is the purpose of an abstract method in Java?

A. To provide a default implementation
B. To define a method that must be implemented by any concrete subclass
C. To hide implementation details
D. To define a method that cannot be overridden

Q. What is the purpose of the Predicate functional interface in Java 8?

A. To produce results
B. To consume values
C. To filter elements based on a condition
D. To transform values

Q. What is the difference between abstract classes and interfaces in Java?

A. Abstract classes can have static methods, while interfaces cannot
B. Interfaces cannot have instance variables, while abstract classes can
C. Abstract classes can be inherited by multiple classes, while interfaces cannot
D. Interfaces can have default method implementations, while abstract classes cannot





Q. What is abstraction in Java?

A.
Abstraction is a process of hiding the implementation details and showing only the functionality to the user.
B.
Abstraction is a process of showing the implementation details and hiding only the functionality to the user.
C.
Abstraction is a process of hiding both the implementation details and functionality from the user.
D.
Abstraction is a process of showing both the implementation details and functionality to the user.

Q. Which of the following keyword is used in Java to achieve abstraction?

A.
private
B.
protected
C.
abstract
D.
static

Q. Which of the following is not a way to achieve abstraction in Java?

A.
Interfaces
B.
Abstract classes
C.
Inheritance
D.
Polymorphism

Q. Which of the following is true about abstraction in Java?

A.
Abstraction in Java is used to create objects.
B.
Abstraction in Java is used to simplify complex systems.
C.
Abstraction in Java is used to hide data members.
D.
Abstraction in Java is used to define implementation details.

Q. Which of the following is an example of abstraction in Java?

A.
Creating an instance of a class using the "new" keyword.
B.
Implementing an interface in a class.
C.
Using the "abstract" keyword to define a class.
D.
Invoking a method on an object.

Q. Which of the following statements is true about abstract classes in Java?

A.
Abstract classes can be instantiated using the "new" keyword.
B.
Abstract classes can have both abstract and non-abstract methods.
C.
Abstract classes can be directly instantiated.
D.
Abstract classes cannot have constructors.

Q. Which of the following is not true about interfaces in Java?

A.
Interfaces can have fields.
B.
A class can implement multiple interfaces.
C.
Interfaces can have static methods.
D.
Interfaces can be instantiated using the "new" keyword.

Q. Which of the following is true about abstract methods in Java?

A.
Abstract methods have a default implementation.
B.
Abstract methods can be private.
C.
Abstract methods can be final.
D.
Abstract methods do not have a body.

Q. Which of the following is not an example of abstraction in Java?

A.
Using a Scanner object to read user input.
B.
Creating a StringBuilder object to manipulate strings.
C.
Invoking the print() method on a PrintWriter object.
D.
Creating an ArrayList object to store a collection of elements.