Wipro TNT-2025_Mock-4
Sign in to Google to save your progress. Learn more
* Indicates required question
[20 MCQ, 20 Marks]
Which of the following is/are advantages of using Abstraction in Java? * 1 point
A. Reduces complexity by hiding implementation details
B. Increases dependency between classes
C. Helps achieve loose coupling
D. Forces programmers to always use inheritance
What is Encapsulation in Java? * 1 point
A. The process of converting one type into another.
B. Wrapping code and data together into a single unit to restrict direct access.
C. The ability of a method to behave differently based on input.
D. Executing multiple threads simultaneously.
What is the correct way to resolve the display() method conflict in class C * 1 point
below?
A. display() cannot be overridden in class C.
B. Call one interface method using super: A.super.display();
C. Delete one of the interfaces.
D. Declare display() as abstract in C.
How does Encapsulation improve software design? * 1 point
A. By speeding up the execution time.
B. By hiding implementation and protecting the integrity of data.
C. By avoiding the use of classes.
D. By using recursion and loops more efficiently.
Which of the following statements about Java interfaces and abstract * 1 point
classes are TRUE?
A. Both interfaces and abstract classes can have abstract methods
B. Interfaces can have constructors
C. Abstract classes can have non-abstract methods
D. Interfaces can have static and default methods (Java 8+)
Regarding Java 9 private methods in interfaces, which statement is TRUE? * 1 point
A. Private methods in interfaces can be overridden by implementing classes.
B. Private methods are abstract by default.
C. Private methods help avoid code duplication inside default methods.
D. Private methods are not allowed in interfaces.
You are designing a banking system using OOP concepts. What is the best * 1 point
approach to ensure encapsulation, abstraction, and interface usage?
A. Use an interface for account operations, make fields public, and inherit from an
abstract class.
B. Use public fields for flexibility and interface for multiple accounts.
C. Use private fields, define operations in an interface, and implement them in
concrete classes.
D. Make everything abstract for better design.
Rearrange the code to demonstrate abstraction using an abstract class. * 1 point
Statements:
1.public abstract class Animal {
2.public abstract void makeSound();
3.public void eat() { System.out.println("Eating..."); }
4.}
A. 1 – 2 – 3 – 4
B. 1 – 3 – 2 – 4
C. 2 – 3 – 1 – 4
D. 1 – 4 – 2 – 3
Which best describes Abstraction in Java? * 1 point
A. Hiding object data using access modifiers like private.
B. Making class members static for global access.
C. Hiding internal implementation details and showing only essential features.
D. Preventing inheritance using the final keyword.
Rearrange to form a valid Java class implementing two interfaces with * 1 point
method override.
Statements:
1.public interface A { void print(); }
2.public interface B { void print(); }
3.public class C implements A, B {
4.public void print() { System.out.println("Hello"); }
5.}
A. 1 – 2 – 3 – 4 – 5
B. 3 – 4 – 1 – 2 – 5
C. 1 – 3 – 2 – 4 – 5
D. 2 – 1 – 3 – 4 – 5
What is the result of the following code execution? * 1 point
A. -100.0
B. 0.0
C. 100.0
D. Throws an exception at runtime
Why is the following class considered encapsulated even though data can * 1 point
be accessed via getters?
A. Because private members can’t be changed by any code.
B. Because it hides implementation details and controls access via methods.
C. Because get and set methods expose the internal state
D. Because it uses public access modifiers for methods.
Arrange the following statements to form a valid encapsulated Java class. * 1 point
Statements:
1.public class Student {
2.private String name;
3.public void setName(String name) { this.name = name; }
4.public String getName() { return name; }
5.}
A. 1 – 2 – 5 – 3 – 4
B. 1 – 2 – 3 – 4 – 5
C. 2 – 1 – 3 – 4 – 5
D. 1 – 3 – 2 – 4 – 5
In Java, which of the following best represents the concept of abstraction in * 1 point
design?
A. Hiding the source code from users
B. Using polymorphism to reduce duplication
C. Separating interface from implementation
D. Encapsulating all methods in a class
Which of the following are key features of Encapsulation in Java? * 1 point
A. Data hiding using private access modifier
B. Providing access to data using getters/setters
C. Use of abstract keyword to define behavior
D. Allows direct access to class fields from other classes
Which statements are TRUE about Interfaces in Java (Java 8 and above)? * 1 point
A. Interfaces can have static methods
B. Interfaces can have private methods
C. Interfaces can have constructors
D. Interfaces support multiple inheritance of behavior
Which of the following best demonstrates a case of abstraction without * 1 point
encapsulation?
A. An interface that defines void sendMessage(String msg); without hiding
implementation details.
B. A class with private fields and public getters/setters.
C. An abstract class with protected variables.
D. A class that uses both private fields and implements an interface.
Which of the following are true differences between abstract classes and * 1 point
interfaces?
A. Abstract classes can have constructors; interfaces cannot
B. Interfaces can support multiple inheritance; abstract classes cannot
C. Interfaces can have instance variables
D. Abstract classes can contain both abstract and non-abstract methods
Which of the following is TRUE about Java Interfaces? * 1 point
A. Interfaces can have instance variables.
B. Interfaces support multiple inheritance in Java.
C. Interfaces cannot have default methods.
D. Interfaces must be extended, not implemented.
Rearrange the statements to define a proper Java interface with * 1 point
abstraction.
Statements:
1.public interface Vehicle {
2.void startEngine();
3.void stopEngine();
4.}
A. 1 – 2 – 3 – 4
B. 2 – 3 – 1 – 4
C. 1 – 3 – 2 – 4
D. 3 – 2 – 1 – 4
Back Submit Clear form
Never submit passwords through Google Forms.
This form was created inside Galgotias Educational Institutions.
Does this form look suspicious? Report
Forms