T4Tutorials .PK

NSCT – Object-Oriented Programming (OOP) MCQs

1. What does OOP stand for?

(A) Organized Object Programming


(B) Object-Oriented Programming


(C) Open Online Programming


(D) Operation-Oriented Programming




2. Which of the following is a feature of OOP?

(A) Linking


(B) Compilation


(C) Encapsulation


(D) Interpretation




3. What is encapsulation in OOP?

(A) Overloading functions


(B) Hiding internal details of an object and exposing only necessary parts


(C) Creating multiple objects


(D) Inheriting multiple classes




4. Which of the following allows a class to inherit properties of another class?

(A) Inheritance


(B) Polymorphism


(C) Abstraction


(D) Encapsulation




5. What is polymorphism?

(A) Hiding data in a class


(B) Ability of a function or object to take many forms


(C) Creating private and public variables


(D) Converting code to machine language




6. What is method overloading?

(A) Hiding data members


(B) Rewriting a method in the subclass


(C) Defining multiple methods with the same name but different parameters in the same class


(D) Making a method private




7. What is method overriding?

(A) Creating objects dynamically


(B) Changing the variable type


(C) Defining multiple constructors


(D) Rewriting a method in the subclass that already exists in the superclass




8. Which keyword is used in C++ to make a class inherit from another class?

(A) extends


(B) inherits


(C) (colon)


(D) super




9. In Java, which keyword is used for inheritance?

(A) inherit


(B) super


(C) extends


(D) implements




10. What is an abstract class?

(A) A class that is fully implemented


(B) A class that always has private variables


(C) A class that has only constructors


(D) A class that cannot have objects and may contain abstract methods




11. What is an interface in Java?

(A) A class with constructors


(B) A blueprint that contains only abstract methods and constants


(C) A variable container


(D) A function library




12. What is the difference between a class and an object?

(A) A class is always public; an object is private


(B) A class is an object; an object is a class


(C) A class is a blueprint; an object is an instance of a class


(D) A class stores data; an object stores code




13. Which of the following is true about constructors?

(A) They return a value


(B) They are used to initialize objects


(C) They can be called like normal functions


(D) They are optional in OOP




14. What does the keyword self mean in Python OOP?

(A) It refers to the class itself


(B) It calls the parent class


(C) It creates a new object


(D) It refers to the object calling the method




15. Which OOP principle allows hiding of data members?

(A) Abstraction


(B) Encapsulation


(C) Polymorphism


(D) Inheritance




16. Which of the following is an example of multiple inheritance?

(A) A class inheriting from two or more classes


(B) A class calling its own method


(C) A function with multiple parameters


(D) Creating many objects from a class




17. Which type of polymorphism occurs at runtime?

(A) Compile-time polymorphism


(B) Runtime polymorphism


(C) Method overloading


(D) Constructor overloading




18. Which type of polymorphism occurs at compile time?

(A) Runtime polymorphism


(B) Method overriding


(C) Method overloading


(D) Interface implementation




19. What does the private access modifier do?

(A) Makes variables or methods global


(B) Makes variables or methods accessible outside the class


(C) Makes variables or methods accessible to subclasses only


(D) Makes variables or methods accessible only within the class




20. What is the purpose of the super keyword in Java?

(A) To create an abstract class


(B) To declare static variables


(C) To refer to the parent class constructor or methods


(D) To define a private method




Exit mobile version