OOPS Concepts MCQs

OOPS Concepts MCQs

The following OOPS Concepts MCQs have been compiled by our experts through research, in order to test your knowledge of the subject of OOPS Concepts. We encourage you to answer these 60+ multiple-choice questions to assess your proficiency.
Please continue by scrolling down.

1: What is a primary motivation for using OOP?

A.   To increase reusability and maintainability of code.

B.   To increase speed of writing code.

C.   To increase data coupling.

D.   Because other programming paradigms have become obsolete.

2: Ref counts are:

A.   magic methods on all classes

B.   how wrestling referees determine a winner

C.   an optimization for compilers

D.   a way of managing object lifetimes

3: True or false? An interface is another name for a class.

A.   True

B.   False

4: True or false? Using traits gives single inheritance languages most of the power of multiple inheritance.

A.   True

B.   False

5: If a user were to observe Java code from the outside world, what would they be able to access?

A.   The public methods.

B.   All of the code in the program.

C.   The Java console.

D.   The private methods.

6: Which of the following classes allows only one object of it to be created?

A.   Singleton class

B.   Abstract class

C.   Friend class

D.   Virtual class

7: What is a simple way to think of inheritance?

A.   New properties written from scratch.

B.   One object generating another object.

C.   One object writing new properties for another.

D.   One object acquiring the properties of another.

8: True or false? A class can implement one or more interfaces.

A.   False

B.   True

9: Which of the following could be considered a polymorphism?

A.   The class, “clsCalculation” with two functions, both named “Add”.

B.   Two classes named “clsCalculation” with the single function, “add”.

C.   Two functions named “clsCalculation”.

D.   Two classes named “add”.

10: Lambda functions are allowed in class definitions

A.   False

B.   True

11: Which of the following is included in the field of formal semantics?

A.   The definition of semantic models.

B.   The understanding of programming models.

C.   The comprehension of relational models.

D.   The definition of logistic models.

12: A mutator method is also known as a:

A.   updater

B.   getter

C.   setter

D.   deleter

13: When a variable is defined within a class, what is it considered?

A.   A class variable.

B.   A varying variable.

C.   An early variable.

D.   An instance variable.

14: What is the most important trait of a polymorphism?

A.   The difference in interface.

B.   The total differences.

C.   The common interface.

D.   The multiple interfaces.

15: True or false? Abstract methods are only defined in the parent.

A.   True

B.   False

16: An abstract class can:

A.   Only contain abstract methods

B.   Be subclassed

C.   Be instantiated

17: True or false? Static variables are visible outside of the class

A.   True

B.   False

C.   depends

18: Semantically, what has happened if the result rendered is non-computational?

A.   A program corruption.

B.   Syntactically legal strings have occurred.

C.   Syntactically illegal strings have occurred.

D.   A system failure.

19: When two methods have the same name, what are they considered, and what kind of binding do they have?

A.   Overhauled, static.

B.   Overloaded, static.

C.   Overloaded, late.

D.   Overloaded, dynamic.

20: What are classes used for?

A.   Classes describe different features.

B.   Classes are used to manage metadata.

C.   Classes are used to define specific types.

D.   Classes define objects.

21: A clone method is needed to:

A.   make any copies of this object

B.   to create a second copy of all contained subobjects

C.   make any copies of the parent object

D.   make any copies of children objects

22: Programming languages supporting the OOPS paradigm are typically contained within what two classes?

A.   OOPS-based and object-based

B.   System based and program-based.

C.   Logic-based and inference-based.

D.   Prototype-based, or class-based.

23: Virtual inheritance is:

A.   where virtually nothing is inherited

B.   the base class is replicated for each derived class

C.   not an OOP term

D.   where only one base class object is created

24: What class and extension best demonstrate a HAS-A Relationship?

A.   Feline, Canine

B.   Canine, Mammal

C.   Feline, Animal

D.   Feline, Lion

25: If a system is systematically computing “metadata”, what would you use to define that system?

A.   Programming metadata.

B.   Accentuated grammars.

C.   Attribute phonetics.

D.   Attribute grammars.

26: True or false? Private variables are visible outside of the class.

A.   only to subclasses

B.   True

C.   only through methods

D.   False

27: What plays a critical role in testing for syntactic legality?

A.   Syntactic congruency.

B.   Logical assumptions.

C.   Mathematical truths.

D.   Termination proofs.

28: What is the difference between interfaces and abstract classes?

A.   interfaces cannot have properties whereas abstract classes can

B.   interfaces can provide default implementation whereas abstract classes cannot provide implementations

C.   abstract classes can provide default implementation whereas interfaces cannot provide implementations

D.   interfaces cannot have methods whereas abstract classes can

29: Why is composition considered a simpler method than inheritance?

A.   Composition has complex namespace clashes.

B.   It isn't considered a simpler method.

C.   Composition lacks the namespace clash, and the complicated inheritance hierarchies.

D.   It is filled with complicated inheritance hierarchies.

30: Which of the following statements are correct with regard to Prototype based programming?

A.   It is a means of achieving object-oriented behavior sharing.

B.   In Prototyping, a similar object can be defined by referring to the original one as a template and then listing how the new object differs from the original one.

C.   JavaScript is a common example of prototyping model.

D.   None of the above

31: Which of the following is not correct with regard to a virtual function in C++?

A.   It can be a friend of any other class

B.   It implements early binding

C.   Prototype of function in base and derived class must be identical

D.   It implements polymorphism

32: What does Data Hiding refer to?

A.   Insulating data from being accessed by the program

B.   Insulating data from being accessed by the program directly

C.   Insulating data from being accessed by the members directly

D.   None of the above 

33: Which of the following statements are correct?

A.   A class is an instance factory

B.   A class is a template for creating an entity

C.   A class is a set of all the instances of a pattern

D.   None of the above

34: Is it possible to call a main() inside another main() function in C++?

A.   Yes

B.   No

35: How much memory does a function use up within an object?

A.   2 bytes

B.   8 bytes

C.   16 bytes

D.   0 byte

36: Function Overloading is based upon the number and/or type of arguments passed.

A.   True

B.   False

37: In Java, how many times can classes be nested within a class?

A.   5

B.   8

C.   4

D.   Any number of times

38: Which of the following is an "Intermediate Base Class" with regard to the given figure:
Class A  --> Class B (Derived) --> Class C (Derived)

A.   Class A

B.   Class B

C.   Class C

D.   Class B and Class C

39: Which of the following is not valid for an inline function?

A.   It saves the overhead of calling function

B.   It must contain only a few lines of code

C.   It allows recursion

D.   It should not contain static variables

40: Which of the following is not a procedural language?

A.   C


C.   Small talk

D.   Cobol

41: Object-based programming languages do not support Inheritance and dynamic binding.

A.   True

B.   False

42: Which of the following types of Inheritance is not known?

A.   Single

B.   Multiple

C.   Hierarchical

D.   Ternary

E.   Multilevel

43: Which of the following statements are correct with regard to Polymorphism?

A.   Polymorphism is a process by which a class can exist in multiple forms

B.   Polymorphism is a process by which a class can exist in only two forms

C.   Polymorphism is a process by which different instances of a class displays different behavior

D.   Polymorphism is a process by which different instances of a class displays similar behavior

44: Which of the following helps convert a Class into an Abstract?

A.   Static keyword

B.   Converting all member functions into 'const'

C.   Converting a function into virtual

D.   Converting a function into pure virtual

45: What does the following classes (as shown in the given figure) represent?
A --> B --> C --> D

A.   Multiple inheritance

B.   Hybrid inheritance

C.   Multi-level inheritance

D.   Multi-class inheritance

A shared/static method is associated with a Class.

A.   True

B.   False

47: What is Function Overriding?

A.   Early binding

B.   Late binding

C.   Pre-Mature binding

D.   None of the above

48: You have three classes named A, B, and C. The class B is derived from class A and class C is derived from B. Which of the following relations are correct for the given classes?

A.   A is a B

B.   B is a A

C.   C is a B

D.   B is a C

49: Which of the following cannot be passed to a function?

A.   Array

B.   Class object

C.   Reference variable

D.   Header File

50: Two functions are defined with the same name and same return type. The first one accepts string input parameter type and the second one accepts integer. This represents Abstraction.

A.   True

B.   False