Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

51.

___________ underlines the feature of Polymorphism in a class.(a) Nested class(b) Enclosing class(c) Inline function(d) Virtual FunctionThe question was posed to me during an online exam.Asked question is from OOPs Features topic in division OOPs Concept & Features of Object Oriented Programming

Answer»

The correct option is (d) VIRTUAL FUNCTION

Easy explanation - Virtual Functions can be defined in any class USING the keyword virtual. All the classes which inherit the class containing the virtual function, DEFINE the virtual function as REQUIRED. Redefining the function on all the derived classes according to class and use represents polymorphism.

52.

Which among the following, for a pure OOP language, is true?(a) The language should follow 3 or more features of OOP(b) The language should follow at least 1 feature of OOP(c) The language must follow only 3 features of OOP(d) The language must follow all the rules of OOPThis question was addressed to me during an interview.I'd like to ask this question from OOPs Features topic in chapter OOPs Concept & Features of Object Oriented Programming

Answer»

The correct answer is (d) The LANGUAGE must follow all the RULES of OOP

Easiest explanation - The language must follow all the rules of OOP to be CALLED a PURELY OOP language. Even if a single OOP feature is not followed, then it’s known to be a PARTIALLY OOP language.

53.

Which feature in OOP is used to allocate additional function to a predefined operator in any language?(a) Operator Overloading(b) Function Overloading(c) Operator Overriding(d) Function OverridingI got this question in an internship interview.The doubt is from OOPs Features topic in chapter OOPs Concept & Features of Object Oriented Programming

Answer»

Right option is (a) OPERATOR Overloading

The BEST I can EXPLAIN: The feature is operator overloading. There is not a feature named operator OVERRIDING SPECIFICALLY. Function overloading and overriding doesn’t give addition function to any operator.

54.

Exception handling is a feature of OOP.(a) True(b) FalseI got this question in semester exam.The question is from OOPs Features topic in division OOPs Concept & Features of Object Oriented Programming

Answer»

The correct option is (a) True

Explanation: Exception handling is a feature of OOP as it includes classes CONCEPT in most of the CASES. Also it may come handy while using INHERITANCE.

55.

Which among doesn’t illustrates polymorphism?(a) Function overloading(b) Function overriding(c) Operator overloading(d) Virtual functionThe question was posed to me in exam.Origin of the question is OOPs Features topic in section OOPs Concept & Features of Object Oriented Programming

Answer»

Correct ANSWER is (B) Function overriding

Easy explanation - Function overriding doesn’t illustrate polymorphism because the FUNCTIONS are actually different and theirs scopes are different. Function and operator overloading illustrate proper polymorphism. VIRTUAL functions show polymorphism because all the CLASSES which inherit virtual function, define the same function in different ways.

56.

Which among the following is the language which supports classes but not polymorphism?(a) SmallTalk(b) Java(c) C++(d) AdaI have been asked this question during an online exam.Question is taken from Polymorphism in portion OOPs Concept & Features of Object Oriented Programming

Answer»

Right choice is (d) Ada

Explanation: Ada is the LANGUAGE which supports the CONCEPT of classes but doesn’t SUPPORT the polymorphism feature. It is an object-based PROGRAMMING language. NOTE that it’s not an OOP language.

57.

Which among the following best describes polymorphism?(a) It is the ability for a message/data to be processed in more than one form(b) It is the ability for a message/data to be processed in only 1 form(c) It is the ability for many messages/data to be processed in one way(d) It is the ability for undefined message/data to be processed in at least one wayI have been asked this question in an interview.This intriguing question comes from Polymorphism in division OOPs Concept & Features of Object Oriented Programming

Answer» RIGHT choice is (a) It is the ability for a message/data to be processed in more than one form

The EXPLANATION is: It is actually the ability for a message / data to be processed in more than one form. The word polymorphism INDICATES many-forms. So if a single ENTITY takes more than one form, it is known as polymorphism.
58.

Does OOP provide better security than POP?(a) Always true for any programming language(b) May not be true with respect to all programming languages(c) It depends on type of program(d) It’s vice-versa is trueI had been asked this question in class test.My doubt is from OOPs Features in portion OOPs Concept & Features of Object Oriented Programming

Answer»

Right CHOICE is (a) Always TRUE for any programming language

Explanation: It is always true as we have the facility of private and PROTECTED access specifiers. Also, only the public and global data are available GLOBALLY or else the program should have proper permission to access the private data.

59.

What do you call the languages that support classes but not polymorphism?(a) Class based language(b) Procedure Oriented language(c) Object-based language(d) If classes are supported, polymorphism will always be supportedI had been asked this question in examination.This key question is from Polymorphism topic in chapter OOPs Concept & Features of Object Oriented Programming

Answer» CORRECT choice is (c) Object-based LANGUAGE

Explanation: The languages which support classes but doesn’t support POLYMORPHISM, are known as object-based languages. Polymorphism is such an important FEATURE, that is a language doesn’t support this feature, it can’t be called as a OOP language.
60.

If same message is passed to objects of several different classes and all of those can respond in a different way, what is this feature called?(a) Inheritance(b) Overloading(c) Polymorphism(d) OverridingI had been asked this question in an internship interview.My question comes from Polymorphism topic in division OOPs Concept & Features of Object Oriented Programming

Answer»

Correct choice is (c) Polymorphism

Easy explanation - The feature defined in QUESTION defines polymorphism features. Here the DIFFERENT objects are capable of responding to the same MESSAGE in different ways, hence polymorphism.

61.

In case of using abstract class or function overloading, which function is supposed to be called first?(a) Local function(b) Function with highest priority in compiler(c) Global function(d) Function with lowest priority because it might have been halted since long time, because of low priorityI have been asked this question in examination.My question comes from Polymorphism in portion OOPs Concept & Features of Object Oriented Programming

Answer»

Correct answer is (b) Function with highest priority in compiler

The explanation: Function with highest priority is called. Here, it’s not about the thread SCHEDULING in CPU, but it focuses on whether the function in local SCOPE is PRESENT or not, or if scope resolution is used in some way, or if the function matches the argument signature. So all these things DEFINE which function has the highest priority to be called in runtime. Local function could be one of the answer but we can’t say if someone have used POINTER to another function or same function name.

62.

Which type of function among the following shows polymorphism?(a) Inline function(b) Virtual function(c) Undefined functions(d) Class member functionsThis question was posed to me by my college professor while I was bunking the class.The origin of the question is Polymorphism in portion OOPs Concept & Features of Object Oriented Programming

Answer» RIGHT CHOICE is (b) VIRTUAL function

The best explanation: Only virtual functions among these can show polymorphism. Class MEMBER functions can show polymorphism too but we should be sure that the same function is being overloaded or is a function of abstract class or something LIKE this, since we are not sure about all these, we can’t say whether it can show polymorphism or not.
63.

Which among the following can’t be used for polymorphism?(a) Static member functions(b) Member functions overloading(c) Predefined operator overloading(d) Constructor overloadingI got this question during an online exam.This interesting question is from Polymorphism topic in section OOPs Concept & Features of Object Oriented Programming

Answer»

The correct choice is (a) STATIC member FUNCTIONS

To EXPLAIN I would say: Static member functions are not property of any object. Hence it can’t be CONSIDERED for overloading/overriding. For polymorphism, function must be property of object, not only of class.

64.

Which among the following can show polymorphism?(a) Overloading ||(b) Overloading +=(c) Overloading

Answer»

The correct ANSWER is (c) Overloading <<

Easiest explanation - Only insertion operator can be OVERLOADED among all the given options. And the POLYMORPHISM can be ILLUSTRATED here only if any of these is applicable of being overloaded. Overloading is type of polymorphism.

65.

Which problem may arise if we use abstract class functions for polymorphism?(a) All classes are converted as abstract class(b) Derived class must be of abstract type(c) All the derived classes must implement the undefined functions(d) Derived classes can’t redefine the functionThe question was posed to me in final exam.The doubt is from Polymorphism topic in chapter OOPs Concept & Features of Object Oriented Programming

Answer»

Correct option is (c) All the derived CLASSES must implement the undefined functions

The best EXPLANATION: The undefined functions must be defined is a problem, because one may need to implement few undefined functions from abstract class, but he will have to DEFINE each of the functions DECLARED in abstract class. Being USELESS task, it is a problem sometimes.

66.

Polymorphism is possible in C language.(a) True(b) FalseI have been asked this question at a job interview.The doubt is from Polymorphism in portion OOPs Concept & Features of Object Oriented Programming

Answer»

The correct choice is (a) True

Explanation: It is possible to implement polymorphism in C LANGUAGE, even though it doesn’t support class. We can use structures and then declare pointers which in turn points to some function. In this way we simulate the functions LIKE MEMBER functions but not exactly member function. Now we can overload these functions, HENCE implementing polymorphism in C language.

67.

Which among the following is not true for polymorphism?(a) It is feature of OOP(b) Ease in readability of program(c) Helps in redefining the same functionality(d) Increases overhead of function definition alwaysI have been asked this question in exam.My query is from Polymorphism topic in division OOPs Concept & Features of Object Oriented Programming

Answer»

The correct ANSWER is (d) Increases overhead of FUNCTION definition always

For EXPLANATION: It never increases function definition overhead, one way or another if you don’t use polymorphism, you will use the definition in some other way, so it actually HELPS to write efficient codes.

68.

If 2 classes derive one base class and redefine a function of base class, also overload some operators inside class body. Among these two things of function and operator overloading, where is polymorphism used?(a) Function overloading only(b) Operator overloading only(c) Both of these are using polymorphism(d) Either function overloading or operator overloading because polymorphism can be applied only once in a programI had been asked this question in a national level competition.The above asked question is from Polymorphism topic in section OOPs Concept & Features of Object Oriented Programming

Answer»

The correct choice is (d) Either FUNCTION overloading or operator overloading because POLYMORPHISM can be applied only once in a program

The best explanation: Both of them are using polymorphism. It is not NECESSARY that polymorphism can be used only once in APROGRAM, it can be used anywhere, any number of times in a single program.

69.

Which among the following best describes encapsulation?(a) It is a way of combining various data members into a single unit(b) It is a way of combining various member functions into a single unit(c) It is a way of combining various data members and member functions into a single unit which can operate on any data(d) It is a way of combining various data members and member functions that operate on those data members into a single unitThe question was posed to me during an interview.My enquiry is from Encapsulation topic in chapter OOPs Concept & Features of Object Oriented Programming

Answer»

Right choice is (d) It is a way of COMBINING various data members and member functions that OPERATE on those data members into a single UNIT

Best explanation: It is a way of combining both data members and member functions, which operate on those data members, into a single unit. We call it a class in OOP generally. This feature have helped us modify the structures used in C LANGUAGE to be UPGRADED into class in C++ and other languages.

70.

If data members are private, what can we do to access them from the class object?(a) Create public member functions to access those data members(b) Create private member functions to access those data members(c) Create protected member functions to access those data members(d) Private data members can never be accessed from outside the classI have been asked this question in an interview.The question is from Encapsulation in portion OOPs Concept & Features of Object Oriented Programming

Answer»

Correct answer is (a) Create PUBLIC member functions to access those data members

Best EXPLANATION: We can define public member functions to access those private data members and get their value for use or ALTERATION. They can’t be ACCESSED directly but is possible to be access using member functions. This is done to ENSURE that the private data doesn’t get modified accidentally.

71.

Find which of the following uses encapsulation?(a) void main(){int a;void fun( int a=10;cout

Answer»

The correct option is (c) class student{INT a; PUBLIC: void disp(){ cout<
The explanation is: It is the class which uses both the data members and member functions being declared inside a single
UNIT. Only data members can be there in structures also. And the encapsulation can only be ILLUSTRATED if some data/operations are associated within class.

72.

While using encapsulation, which among the following is possible?(a) Code modification can be additional overhead(b) Data member’s data type can be changed without changing any other code(c) Data member’s type can’t be changed, or whole code have to be changed(d) Member functions can be used to change the data type of data membersThis question was addressed to me during an interview.My question is based upon Encapsulation in section OOPs Concept & Features of Object Oriented Programming

Answer»

Correct option is (b) Data member’s data TYPE can be changed without changing any other code

To explain I WOULD say: Data member’s data type can be changed without changing any further code. All the members using that data can continue in the same way without any modification. Member FUNCTIONS can NEVER change the data type of same class data members.

73.

Which feature can be implemented using encapsulation?(a) Inheritance(b) Abstraction(c) Polymorphism(d) OverloadingThe question was posed to me in an international level competition.I would like to ask this question from Encapsulation topic in portion OOPs Concept & Features of Object Oriented Programming

Answer»

Right option is (B) ABSTRACTION

Easiest explanation - Data abstraction can be achieved by using ENCAPSULATION. We can hide the OPERATION and structure of actual program from the user and can show only required information by the user.

74.

Encapsulation helps in writing ___________ classes in java.(a) Mutable(b) Abstract(c) Wrapper(d) ImmutableI have been asked this question during an internship interview.Asked question is from Encapsulation in section OOPs Concept & Features of Object Oriented Programming

Answer» CORRECT answer is (d) IMMUTABLE

Easy explanation - Immutable classes are USED for caching purpose GENERALLY. And it can be created by making the CLASS as final and making all its members private.
75.

Which among the following should be encapsulated?(a) The data which is prone to change is near future(b) The data prone to change in long terms(c) The data which is intended to be changed(d) The data which belongs to some other classThe question was asked during a job interview.Asked question is from Encapsulation topic in portion OOPs Concept & Features of Object Oriented Programming

Answer»

The correct answer is (a) The data which is prone to CHANGE is near FUTURE

To explain: The data prone to change in near future is usually encapsulated so that it doesn’t get changed ACCIDENTALLY. We ENCAPSULATE the data to hide the critical working of program from outside world.

76.

How can Encapsulation be achieved?(a) Using Access Specifiers(b) Using only private members(c) Using inheritance(d) Using AbstractionI have been asked this question in an international level competition.This is a very interesting question from Encapsulation in section OOPs Concept & Features of Object Oriented Programming

Answer»

The correct answer is (a) USING Access Specifiers

The explanation: Using access specifiers we can ACHIEVE encapsulation. Using this we can in turn IMPLEMENT data abstraction. It’s not necessary that we only use PRIVATE access.

77.

Which among the following violates the principle of encapsulation almost always?(a) Local variables(b) Global variables(c) Public variables(d) Array variablesI got this question at a job interview.My query is from Encapsulation in division OOPs Concept & Features of Object Oriented Programming

Answer»

Correct answer is (b) Global variables

Explanation: Global variables almost ALWAYS violates the principles of encapsulation. Encapsulation says the data should be ACCESSED only by required set of elements. But global variable is accessible everywhere, also it is most prone to changes. It doesn’t HIDE the internal WORKING of PROGRAM.

78.

Which among the following would destroy the encapsulation mechanism if it was allowed in programming?(a) Using access declaration for private members of base class(b) Using access declaration for public members of base class(c) Using access declaration for local variable of main() function(d) Using access declaration for global variablesI had been asked this question during an interview for a job.This intriguing question comes from Encapsulation topic in section OOPs Concept & Features of Object Oriented Programming

Answer» RIGHT option is (a) Using access declaration for private MEMBERS of base class

The best I can explain: If using access declaration for private members of base class was allowed in programming, it would have destroyed whole CONCEPT of encapsulation. As if it was possible, any class which gets inherited PRIVATELY, would have been able to inherit the private members of base class, and hence could access each and EVERY member of base class.
79.

Which among the following can be a concept against encapsulation rules?(a) Using function pointers(b) Using char* string pointer to be passed to non-member function(c) Using object array(d) Using any kind of pointer/array address in passing to another functionI had been asked this question by my school teacher while I was bunking the class.My question is taken from Encapsulation in chapter OOPs Concept & Features of Object Oriented Programming

Answer»

Correct choice is (d) Using any kind of pointer/array address in passing to ANOTHER function

To explain I would say: If we USE any kind of array or pointer as data member which should not be changed, but in some case its address is passed to some other function or similar VARIABLE. There are chances to MODIFY its whole data easily. Hence Against encapsulation.

80.

Encapsulation is the way to add functions in a user defined structure.(a) True(b) FalseThe question was asked in an interview.The query is from Encapsulation topic in division OOPs Concept & Features of Object Oriented Programming

Answer»

Correct option is (B) False

Easy explanation - False, because we can’t call these STRUCTURES if MEMBER functions are involved, it must be called class. Also, it is not just about adding functions, it’s about BINDING DATA and functions together.

81.

Using encapsulation data security is ___________(a) Not ensured(b) Ensured to some extent(c) Purely ensured(d) Very lowThis question was posed to me by my college director while I was bunking the class.I'm obligated to ask this question of Encapsulation topic in section OOPs Concept & Features of Object Oriented Programming

Answer»

Right choice is (b) ENSURED to some extent

For EXPLANATION: The encapsulation can only ensure DATA security to some extent. If POINTER and ADDRESSES are misused, it may violate encapsulation. Use of global variables also makes the program vulnerable, hence we can’t say that encapsulation gives pure security.

82.

Which among the following best defines abstraction?(a) Hiding the implementation(b) Showing the important data(c) Hiding the important data(d) Hiding the implementation and showing only the featuresThe question was posed to me in final exam.My doubt stems from Abstraction topic in portion OOPs Concept & Features of Object Oriented Programming

Answer»

Correct option is (d) Hiding the implementation and showing only the features

The BEST I can explain: It includes hiding the implementation part and showing only the required data and features to the user. It is done to hide the implementation COMPLEXITY and details from the user. And to provide a GOOD INTERFACE in programming.

83.

Hiding the implementation complexity can ____________(a) Make the programming easy(b) Make the programming complex(c) Provide more number of features(d) Provide better featuresI have been asked this question during a job interview.The doubt is from Abstraction topic in portion OOPs Concept & Features of Object Oriented Programming

Answer»

The correct ANSWER is (a) Make the programming EASY

The best I can explain: It can make programming easy. The programming need not KNOW how the inbuilt functions are WORKING but can use those complex functions directly in the program. It doesn’t provide more number of features or better features.

84.

Object is ________ abstraction.(a) Object(b) Logical(c) Real(d) HypotheticalThe question was posed to me in an online interview.The doubt is from Abstraction topic in section OOPs Concept & Features of Object Oriented Programming

Answer»

The CORRECT option is (c) Real

The EXPLANATION: OBJECT is real abstraction because it ACTUALLY contains those features of class. It is the implementation of overview GIVEN by class. Hence the class is logical abstraction and its object is real.

85.

Class is _________ abstraction.(a) Object(b) Logical(c) Real(d) HypotheticalI got this question in examination.This interesting question is from Abstraction topic in division OOPs Concept & Features of Object Oriented Programming

Answer»

The correct option is (b) LOGICAL

The BEST explanation: Class is logical abstraction because it provides a logical STRUCTURE for all of its objects. It gives an OVERVIEW of the features of an object.

86.

Abstraction gives higher degree of ________(a) Class usage(b) Program complexity(c) Idealized interface(d) Unstable interfaceI got this question in an international level competition.This intriguing question originated from Abstraction topic in chapter OOPs Concept & Features of Object Oriented Programming

Answer»

The correct choice is (c) IDEALIZED interface

The best explanation: It is to idealize the interface. In this way the programmer can use the programming features more efficiently and can code better. It can’t INCREASE the program COMPLEXITY, as the FEATURE itself is made to HIDE it.

87.

Abstraction can apply to ____________(a) Control and data(b) Only data(c) Only control(d) ClassesThis question was posed to me in an online quiz.My question is based upon Abstraction in division OOPs Concept & Features of Object Oriented Programming

Answer» RIGHT answer is (a) CONTROL and DATA

Easy explanation - Abstraction applies to both. Control abstraction involves use of subroutines and control FLOW abstraction. Data abstraction involves handling PIECES of data in meaningful ways.
88.

Which among the following can be viewed as combination of abstraction of data and code.(a) Class(b) Object(c) Inheritance(d) InterfacesThis question was posed to me in final exam.The query is from Abstraction topic in chapter OOPs Concept & Features of Object Oriented Programming

Answer»

The correct option is (B) OBJECT

The EXPLANATION is: Object can be viewed as abstraction of data and code. It uses data members and their functioning as data abstraction. Code abstraction as USE of object of inbuilt class.

89.

Abstraction principle includes___________(a) Use abstraction at its minimum(b) Use abstraction to avoid longer codes(c) Use abstraction whenever possible to avoid duplication(d) Use abstraction whenever possible to achieve OOPThis question was posed to me during an online exam.My question is based upon Abstraction topic in chapter OOPs Concept & Features of Object Oriented Programming

Answer»

Correct answer is (c) Use abstraction whenever possible to avoid duplication

Best explanation: Abstraction principle INCLUDES use of abstraction to avoid duplication (usually of code). It this way the PROGRAM doesn’t CONTAIN any redundant functions and MAKE the program efficient.

90.

Higher the level of abstraction, higher are the details.(a) True(b) FalseThis question was posed to me during an online exam.My doubt is from Abstraction in division OOPs Concept & Features of Object Oriented Programming

Answer»

The CORRECT answer is (B) False

To explain I WOULD SAY: Higher the level of abstraction, lower are the details. The best way to understand this is to CONSIDER a whole system that is highest level of abstraction as it hides everything inside. And next lower level would contain few of the computer components and so on.

91.

Encapsulation and abstraction differ as ____________(a) Binding and Hiding respectively(b) Hiding and Binding respectively(c) Can be used any way(d) Hiding and hiding respectivelyThe question was posed to me in class test.Query is from Abstraction topic in division OOPs Concept & Features of Object Oriented Programming

Answer»

The correct OPTION is (a) BINDING and HIDING respectively

Best explanation: Abstraction is hiding the complex code. For example, we directly use cout object in C++ but we don’t know how is it actually implemented. Encapsulation is data binding, as in, we TRY to combine a SIMILAR type of data and functions together.

92.

A phone is made up of many components like motherboard, camera, sensors and etc. If the processor represents all the functioning of phone, display shows the display only, and the phone is represented as a whole. Which among the following have highest level of abstraction?(a) Motherboard(b) Display(c) Camera(d) PhoneThis question was addressed to me by my school teacher while I was bunking the class.I'd like to ask this question from Abstraction in section OOPs Concept & Features of Object Oriented Programming

Answer»

The correct choice is (d) PHONE

Explanation: Phone as a whole have the highest level of abstraction. This is because the phone being a single unit represents the whole SYSTEM. Whereas motherboard, DISPLAY and CAMERA are its components.

93.

If two classes combine some private data members and provides public member functions to access and manipulate those data members. Where is abstraction used?(a) Using private access specifier for data members(b) Using class concept with both data members and member functions(c) Using public member functions to access and manipulate the data members(d) Data is not sufficient to decide what is being usedThe question was posed to me during an internship interview.My question is based upon Abstraction in section OOPs Concept & Features of Object Oriented Programming

Answer»

Correct answer is (c) Using PUBLIC member functions to access and manipulate the data members

The explanation is: It is the concept of hiding program complexity and actual working in background. Hence USE of public member functions ILLUSTRATES ABSTRACTION here.

94.

In terms of stream and files ____________(a) Abstraction is called a stream and device is called a file(b) Abstraction is called a file and device is called a stream(c) Abstraction can be called both file and stream(d) Abstraction can’t be defined in terms of files and streamThis question was addressed to me by my school teacher while I was bunking the class.This key question is from Abstraction in division OOPs Concept & Features of Object Oriented Programming

Answer»

Right choice is (a) Abstraction is called a stream and device is called a file

Explanation: Abstraction is called stream to provide a LEVEL of complexity hiding, for how the files operations are actually DONE. Actual devices are called file because in ONE WAY or ANOTHER, those can be considered as single entity and there is nothing hidden.

95.

Which among the following is not a level of abstraction?(a) Logical level(b) Physical level(c) View level(d) External levelI had been asked this question during an interview.My question is based upon Abstraction topic in section OOPs Concept & Features of Object Oriented Programming

Answer»

Correct answer is (d) External level

Explanation: Abstraction is generally DIVIDED into 3 different levels, namely, logical, PHYSICAL and view level. External level is not defined in TERMS of abstraction.

96.

Using higher degree of abstraction __________(a) May get unsafe(b) May reduce readability(c) Can be safer(d) Can increase vulnerabilityThe question was asked during an interview for a job.The origin of the question is Abstraction topic in section OOPs Concept & Features of Object Oriented Programming

Answer» RIGHT choice is (c) Can be SAFER

Best explanation: It will make the code safer. One may think it reduces the READABILITY, but the fact is, it actually helps us UNDERSTAND the code better. We don’t have to read the complex code which is of no USE in understanding the program.