NEW
Font size
WorksheetsMock-Up Academy OOP Online Test
Total questions: 10
Worksheet time: 20mins
Which of the following code snippets demonstrates the concept of Object-Oriented Programming (OOP)?
Which of the following code snippets best demonstrates the concept of encapsulation?
Given the following code, what will be the output?
What does OOP stand for?
Organization Oriented Programming
Operation Oriented Programming
Object Oriented Programming
Objective Oriented Programming
What is inheritance in OOP?
Creating an object from a class
Using the same method in different ways
Hiding implementation details
Inheriting attributes and methods from another class
What is a method called that is the same but behaves differently in different classes?
Encapsulation
Abstraction
Polymorphism
Inheritance
What is an abstract method in OOP?
Method that has a complete implementation
Method that does not have a name
Method that only has a declaration without implementation
Method that cannot be used in any class
Which of the following is true about encapsulation?
Hiding implementation details and providing a public interface
Allowing one class to inherit attributes and methods from another class
Allowing the same method to be used in different ways
Simplifying complexity by showing only essential details
Consider the following pseudocode involving an abstract class:
The program will create an instance of Shape successfully.
The program will call the area() method of the Shape class.
The program will automatically create an instance of a default subclass.
The program will throw an error because Shape is abstract and cannot be instantiated.
Which of the following statements about the child class in the code below is correct?
The Child class inherits the greet() method from Parent but does not override it.
The Child class does not inherit anything from Parent because it defines its own greet() method.
The Child class overrides the greet() method of Parent, so calling c.greet() prints "Hello from Child".
The Parent class is the child of the Child class.
