MCQ on OOPS – Object Oriented Programming MCQ with answers

Are you a student studying Object Oriented Programming (OOPS) and currently preparing for an upcoming exam? Are you searching for a reliable source of Multiple Choice Questions (MCQs) to test your knowledge and understanding of this subject? Look no further, as you have come to the right place. In this article, we will provide you with a curated list of MCQ on OOPS along with their detailed answers, enabling you to assess your proficiency in this fundamental programming paradigm.

Whether you are a beginner or an advanced learner, these MCQs will help strengthen your grasp on OOPS concepts and enhance your performance in exams or interviews related to programming. So let’s dive in and unlock the world of OOPS through these comprehensive question-answer sets!

1. Which of the following is not a feature of Object Oriented Programming?
B) Data Structure
C) Data encapsulation
D) Inheritance

2. Which feature allows users to define how basic operators work with objects?
B) Inheritance
C) Polymorphism
D) Data hiding

3. ___ are those which do not change during the execution of a program.
A) Keywords
B) Literals
C) Constants
D) Punctuators

A) Inheritance
C) Data hiding
D) Polymorphism

5. Which statement transfers the control to the next statement after the loop and all the remaining statements and the iterations in the loop are skipped?
A) Switch
B) Break
C) Continue
D) Goto

6. ___ are usually used to store data such as employee name, address, product description, password etc.
A) Arrays
B) Strings
C) Structures
D) Functions

7. Which function is used to find the length of a string?
A) Strcmp
B) Strcpy
C) Strlen
D) Strrev

8. Which is one of the popular control statement as it is compact and clear in the specification?
A) if the loop
B) while loop
C) do..while loop
D) for loop

9. Default variable in C++ is:
A) Automatic variables
B) External variables
C) Static variables
D) Internal variables

10. ___ are a group of dissimilar data that are related to each other.
A) Strings
B) Structures
C) Arrays
D) Functions

11. ___ provide good mechanism to organize data.
A) Structures
B) Functions
C) Arrays
D) Relations

12. A/an ___ is an assignment or a task that must be performed to support the other part of a program.
A) Function
B) Array
C) Relation
D) Class

13. Friend functions do not break ___, rather enhance a class interface.
A) Data hiding
B) Polymorphism
C) Abstraction
D) Encapsulation

14. An instance of a class is:
A) Structure
B) Object
C) Module
D) Functions

15. ___ are also defined by prefixing the keyword static.
A) Friend functions
B) Dynamic functions
C) Static functions
D) Functions

16. ___ stores the address of the class instance to enable pointer access of the members to the member functions of the class.
A) this pointer
B) Pointer
C) Structure
D) Object

17. A constructor only knows how to build an ___ of its own class.
A) Function
B) Module
C) Object
D) Structure

18. Constructors are just ___ with the same name as the class.
A) Objects
B) Structures
C) Modules
D) Functions

19. Both constructor and destructor are declared as ___, and they have no return value.
A) Public
B) Private
C) Public as well as private
D) Protected

20. Constructors are called ___ whenever an object of a class is created.
A) By class
B) By function
C) By structure
D) Automatically

21. Which operator works on two operands?
A) Relational
B) Unary
C) Arithmetic
D) Binary

22. Friend functions are external functions that can access the ___ data members of a class.
A) Private
B) Protected
C) Public as well as protected
D) Public

23. ___ allows programmers to specify how various arithmetic, relational, and many other operators work with user-defined data types or classes.
A) Operator overriding
B) Polymorphism
C) Abstraction

24. Which operator operates on only one operand and that operand itself invokes the operator?
A) Unary
B) Relational
C) Arithmetic
D) Binary

25. The derived class can also have multiple parents which is known as ___.
A) Hybrid inheritance
B) Multilevel inheritance
C) Single inheritance
D) Multiple inheritances

26. Every ___ has a default pointer known as this pointer.
A) Structure
B) Object
C) Function
D) Class

27. ___ helps the code to be reused in many situations.
A) Inheritance
B) Polymorphism
C) Encapsulation
D) Abstraction

28. Which feature of OOP allows reuse of code without modifying the original code?
A) Inheritance
B) Polymorphism
C) Encapsulation
D) Abstraction

29. ___ is a process of inheriting a class from more than one parent class.
A) Hybrid inheritance
B) Multiple inheritances
C) Multilevel inheritance
D) Single inheritance

30. Virtual functions are primarily used in___.
A) Encapsulation
B) Inheritance
C) Polymorphism
D) Abstraction

31. ___means same content, but different forms.
A) Encapsulation
B) Inheritance
C) Abstraction
D) Polymorphism

32. Which polymorphism is implemented with templates?
A) Compile-time
B) Run-time
C) Parametric

33. Which function is used with an object to write to a file?
B) write()
C) put()
D) get()

34. ___ are the name given for flow of data.
A) Arrays
B) Strings
C) Records
D) Streams

35. The function ___ reads one character at a time.
A) put()
B) get()
C) getc()
D) putc()

36. A ___ is an abstraction that represents a device on which input and output operations are performed.
A) String
B) Stream
C) Record
D) Structure

37. A/an ___ is a collection of data saved on a disk drive.
A) Information
B) Structure
C) File
D) Folder

38. of stream means:
A) Input/output file stream
B) Output file stream
C) Oriented file stream
D) Object file stream

39. The function bad() returns true, if the ___ flag is up.
B) goodbit
C) flagbit

40. The tellg() function returns an ___ type that shows the current position of the inside-pointer.
A) Float
B) Char
C) Int
D) Boolean

41. Which function returns the current status of the error-flags?
A) clear()
B) fail()
C) seekg()
D) rdstate()

42. A function generated from a function ___ is called a generated function.
A) Template
B) Member
C) Class
D) Data

43. A class template ___ is prefixed by the keyword template.
A) Member
B) Declaration
C) Description
D) Definition

44. What are very useful when implementing generic constructs?
A) Classes
B) Templates
C) Functions
D) Programs

45. ___ are useful for keeping and retrieving the state information in functions.
A) Algorithms
B) Containers
C) Functors
D) Iterators

46. Deque is:
A) Single queue
B) Double queue
C) Single-ended queue
D) Double-ended queue

47. Elements can be inserted or deleted in a ___ at either ends.
A) List
B) Vector
C) Deque
D) Container

48. Exception ____ allows you to concentrate on the problem that you are actually trying to solve in one place.
A) Specification
B) Handling
C) Catching
D) Throwing

49. With exception handling, you put everything in a ___ block without error checking.
A) Throw
B) Try
C) Catch
D) Unexpected

50. Exception handling is not like a ___ statement, where you need a break after each case to prevent the remaining ones from executing.
A) Switch
B) If else
C) Break
D) Nested if

25 Easy US History trivia questions and answers

51. Which of the following statement/s is/are true?
I. Objects are templates that provide definition to the objects of similar type.
II. Classes are like variables created whenever necessary in the program.
A) Both I and II
B) Only statement I
C) Only statement II
D) Both statements are incorrect

52. What are the two types of control statements in C++ which allows the programmer to modify the regular sequential execution of statements?
A) goto, switch
B) iteration, goto
C) selection, goto
D) selection, iteration

53. The elements stored in an array are accessed by using the array name followed by the ___ number within the ___ brackets.
A) Memory, circular
B) Memory, square
C) Index, circular
D) Index, square

54. Which of the following statement/s is/are true?
I. Strings are nothing but character arrays.
II. The size of a string is defined during declaration like any other array.
A) Both I and II
B) Only statement I
C) Only statement II
D) Both statements are incorrect

55. Data can be passed to functions in two ways:
A) passing by function, passing by reference
B) passing by value, passing by reference
C) passing by value, passing by function
D) passing by function, passing by variable

56. Which of the following statement/s is/are true?
I. Functions can also contain default arguments.
II. Default arguments are those whose values need not be explicitly passed during the function call.
A) Both I and II
B) Only statement I
C) Only statement II
D) Both statements are incorrect

57. Classes enable you to bind ___ and ___ that operate on data together.
A) Data, functions
B) Data, relations
C) Data, information
D) Functions, relations

58. You cannot have ___ and ___ member functions with the same names and the same number and type of arguments.
A) Static, dynamic
B) Static, non-static
C) Dynamic, non-static
D) Dynamic, non-dynamic

59. Which of the following statement/s is/are true?
I. Constructors are member functions of a class which have the same name as the class name.
II. A destructor only knows how to build an object of its own class.
A) Both I and II
B) Only statement I
C) Only statement II
D) Both statements are incorrect

60. Which of the following statement/s is/are true?
I. Constructors are usually used to deallocate memory and do another cleanup for a class object and its class members when the object is destroyed.
II. A constructor is called for a class object when that object passes out of scope or is explicitly deleted.
A) Both I and II
B) Only statement I
C) Only statement II
D) Both statements are incorrect

61. A function is made a friend by just prefixing the keyword ___ in the function declaration within the ___ definition.
A) Class, function
B) Friend, function
C) Friend, class
D) Class, structure

62. Which of the following statement/s is/are true?
I. Binary operators are those that work on two operands.
II. Arithmetic operators like +, * etc. and relational operators like <, > etc. are some examples of binary operators.
A) Both I and II
B) Only statement I
C) Only statement II
D) Both statements are incorrect

63. Which of the following statement/s is/are true?
I. Inheritance does not allow reuse of code without modifying the original code.
II. Inheritance is the process by which new classes called base classes are created from existing classes called derived classes.
A) Both I and II
B) Only statement I
C) Only statement II
D) Both statements are incorrect

64. Multiple inheritances is implemented the same as ___ inheritance except that both the ___ names have to be specified while defining the class.
A) Hybrid, child
B) Hybrid, parent
C) Single, parent
D) Single, child

65. Polymorphism enables the ___ program code calling ___ functions of different classes.
A) Different, different
B) Same, same
C) Same, different
D) Different, same

66. Which of the following statement/s is/are true?
I. Virtual functions in C++ are important to implement the concept of polymorphism.
II. Polymorphism means different content, but same forms.
A) Both I and II
B) Only statement I
C) Only statement II
D) Both statements are incorrect

67. Which of the following statement/s is/are true?
I. File processing in C++ is performed using the iostream class.
II. fstream is a complete C++ class with constructors, a destructor, and overloaded operators.
A) Both I and II
B) Only statement I
C) Only statement II
D) Both statements are incorrect

68. Which of the following statement/s is/are true?
I. Streams are the name given for flow of data.
II. All streams behave in the same way even though they are connected to different devices.
A) Both I and II
B) Only statement I
C) Only statement II
D) Both statements are incorrect

69. The get() function extracts a ___ character from the stream and ___ it.
A) Double, does not return
B) Double, returns
C) Single, does not return
D) Single, returns

70. Which of the following is/are characteristic/characteristics of I/O devices?
I. An input stream, such as cin, is a source of data that can be read into variables.
II. An output stream, such as cout, is a place where data can be sent for display, storage, or communication.
A) Both I and II
B) Only statement I
C) Only statement II
D) Both statements are incorrect

71. A ___ is an identifier that can be inserted into an output stream or ___ from an input stream.
A) Manipulator, inserted
B) Iterator, inserted
C) Manipulator, extracted
D) Iterator, extracted

72. The ___ function returns a ___ value if any I/O error has occurred.
A) get(), zero
B) fail(), nonzero
C) get(), nonzero
D) fail(), zero

73. Function templates are ___ with the keyword ___.
A) Prefixed, template
B) Prefixed, function
C) Suffixed, template
D) Suffixed, function

74. The ___ and ____ are used when elements are added to and deleted from containers.
A) Copy containers, paste containers
B) Copy constructors, copy assignment
C) Copy constructors, copy assignment
D) Copy constructors, paste assignment

75. The ___ gives you no possibility to have an argument or to know anything about the type of the ___.
A) Ellipses, error
B) Exceptions, ellipses
C) Exceptions, error
D) Ellipses, exception

Conclusion

We hope that our collection of MCQs on OOPS – Object Oriented Programming has been helpful to you in your exam preparation. We have carefully curated these questions to cover a wide range of topics within the subject, ensuring that you have a comprehensive understanding of OOPS concepts.

If you found our MCQs valuable, we encourage you to share them with your friends and peers on social media. By doing so, you can help others who may be seeking similar resources for their own exam preparations. Remember, knowledge is best shared and together we can achieve greater success in our academic pursuits.

Share on Social Media