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.

Which of the following is the correct difference between cin and scanf()?(a) both are the same(b) cin is a stream object whereas scanf() is a function(c) scanf() is a stream object whereas cin is a function(d) cin is used for printing whereas scanf() is used for reading inputI had been asked this question in class test.Question is taken from C++ Concepts in portion Basics Concepts of C++ of C++

Answer»

Right choice is (b) cin is a stream object whereas scanf() is a FUNCTION

The EXPLANATION is: cin is a stream object available in C++ whereas scanf() is a function available in both C and C++. both are USED for reading input from USERS.

52.

Which of the following is not a type of inheritance?(a) Multiple(b) Multilevel(c) Distributive(d) HierarchicalThe question was asked by my school principal while I was bunking the class.This key question is from OOPs Concept topic in division Basics Concepts of C++ of C++

Answer» CORRECT answer is (c) DISTRIBUTIVE

To explain I WOULD say: Distributive is not a type of inheritance WHEREAS others are a type of inheritance having their own meaning.
53.

Out of the following, which is not a member of the class?(a) Static function(b) Friend function(c) Constant function(d) Virtual functionThe question was asked at a job interview.This key question is from OOPs Concept in section Basics Concepts of C++ of C++

Answer»

Right ANSWER is (b) Friend FUNCTION

For explanation: Friend function is not a member of the class. They are GIVEN the same access rights as the class member function have but they are not actual members of the class.

54.

Which members are inherited but are not accessible in any case?(a) Private(b) Public(c) Protected(d) Both private and protectedI got this question in an online quiz.The doubt is from OOPs Concept in portion Basics Concepts of C++ of C++

Answer»

Correct option is (a) PRIVATE

The best I can EXPLAIN: Private MEMBERS of a CLASS are inherited to the CHILD class but are not accessible from the child class.

55.

Which of the following provides a programmer with the facility of using object of a class inside other classes?(a) Inheritance(b) Composition(c) Abstraction(d) EncapsulationI got this question by my school teacher while I was bunking the class.Enquiry is from OOPs Concept in division Basics Concepts of C++ of C++

Answer»

The CORRECT answer is (B) Composition

Explanation: The concept of USING objects of one CLASS into another class is KNOWN as Composition.

56.

Wrapping data and its related functionality into a single entity is known as _____________(a) Abstraction(b) Encapsulation(c) Polymorphism(d) ModularityI have been asked this question in unit test.Enquiry is from OOPs Concept in section Basics Concepts of C++ of C++

Answer»

Right option is (b) ENCAPSULATION

Easiest explanation - In OOPs, the property of ENCLOSING data and its related FUNCTIONS into a SINGLE entity(in C++ we call them classes) is called encapsulation.

57.

Which of the following is called insertion/put to operator?(a) (c) >(d)

Answer»

The correct option is (a) <<

For EXPLANATION: << operator is CALLED INSERTION or PUT to operator i.e. insert/put THINGS to console/files.

58.

What happens if a class does not have a name?(a) It will not have a constructor(b) It will not have a destructor(c) It is not allowed(d) It will neither have a constructor or destructorThis question was posed to me in an internship interview.My enquiry is from OOPs Concept in section Basics Concepts of C++ of C++

Answer» RIGHT choice is (b) It will not have a DESTRUCTOR

Explanation: A CLASS without a name will not have a destructor. The OBJECT is made so constructor is REQUIRED but the destructor is not. Check the code below:
59.

Which of the following is called extraction/get from operator?(a) (c) >(d)

Answer»

The CORRECT ANSWER is (b) >>

For EXPLANATION: >> operator is called extraction or get from operator i.e. extract/get things from console/files.

60.

Which of the following is called address operator?(a) *(b) &(c) _(d) %I have been asked this question in a national level competition.Origin of the question is Basics in section Basics Concepts of C++ of C++

Answer»

The correct option is (B) &

To explain I would SAY: & OPERATOR is called ADDRESS operator and is used to access the address of a variable.

61.

What is dynamic binding?(a) The process of linking the actual code with a procedural call during run-time(b) The process of linking the actual code with a procedural call during compile-time(c) The process of linking the actual code with a procedural call at any-time(d) All of the mentionedI had been asked this question by my school principal while I was bunking the class.This key question is from C++ Concepts in chapter Basics Concepts of C++ of C++

Answer»

Correct choice is (a) The process of linking the actual CODE with a procedural CALL during run-time

The best explanation: BINDING of CALLS and variables with actual code at run-time is called dynamic binding. For example in the concept of polymorphism types are decided are defined during the execution of code which leads to the different function calls depending upon the types used this is called dynamic binding. As the function call is decided during the run-time therefore dynamic binding happens at run-time.

62.

C++ is ______________(a) procedural programming language(b) object oriented programming language(c) functional programming language(d) both procedural and object oriented programming languageThe question was asked in my homework.Asked question is from OOPs Concept topic in division Basics Concepts of C++ of C++

Answer»

Right choice is (d) both procedural and object oriented PROGRAMMING language

Easiest EXPLANATION - C++ SUPPORTS both procedural(step by step instruction) and object oriented programming(using CONCEPT of classes and objects).

63.

Which of the following is the correct syntax of including a user defined header files in C++?(a) #include (b) #include (c) #include “userdefined”(d) #include [userdefined]I had been asked this question by my school teacher while I was bunking the class.My question is taken from Basics in portion Basics Concepts of C++ of C++

Answer»

The correct CHOICE is (c) #INCLUDE “userdefined”

The BEST I can explain: C++ USES DOUBLE quotes to include a user-defined header file. The correct syntax of including user-defined is #include “userdefinedname”.

64.

Which of the following is an exit-controlled loop?(a) for(b) while(c) do-while(d) all of the mentionedThe question was asked during an interview for a job.Asked question is from C++ Concepts in portion Basics Concepts of C++ of C++

Answer» RIGHT option is (C) do-while

The explanation: do-while is called exit controlled loop because in do-while termination condition is checked when we have executed the BODY of the loop i.e. we are EXITING the body and then checking the condition, THEREFORE, it is called exit controlled loop.
65.

Which of the following is C++ equivalent for printf()?(a) cin(b) cout(c) print(d) inputI had been asked this question during an internship interview.The origin of the question is C++ Concepts in chapter Basics Concepts of C++ of C++

Answer»

The correct option is (b) COUT

The explanation is: C++ uses cout to PRINT output to console. HOWEVER C++ ALSO uses printf().

66.

How access specifiers in Class helps in Abstraction?(a) They does not helps in any way(b) They allows us to show only required things to outer world(c) They help in keeping things together(d) Abstraction concept is not used in classesI got this question during a job interview.The doubt is from OOPs Concept in chapter Basics Concepts of C++ of C++

Answer» CORRECT answer is (b) They allows us to SHOW only required things to outer world

To explain: Abstraction is the concept of hiding things from the outer world and showing only the required things to the world, which is where ACCESS specifiers private, PROTECTED and PUBLIC helps in keeping our knowledge hidden from the world.
67.

Which of the following cannot be a friend?(a) Function(b) Class(c) Object(d) Operator functionI had been asked this question in final exam.Question is taken from OOPs Concept topic in division Basics Concepts of C++ of C++

Answer»

Correct ANSWER is (c) Object

To EXPLAIN I would say: Objects of any class cannot be MADE a friend of any other or same class WHEREAS functions, classes and operator functions can be made a friend.

68.

Which of the following type is provided by C++ but not C?(a) int(b) bool(c) float(d) doubleI had been asked this question in semester exam.The question is from C++ vs C in chapter Basics Concepts of C++ of C++

Answer»

The CORRECT option is (b) bool

Explanation: C++ provides the BOOLEAN type to handle true and false VALUES whereas no such type is provided in C.

69.

Which of the following is correct?(a) Base class pointer object cannot point to a derived class object(b) Derived class pointer object cannot point to a base class object(c) A derived class cannot have pointer objects(d) A base class cannot have pointer objectsThe question was asked in class test.I want to ask this question from OOPs Concept topic in division Basics Concepts of C++ of C++

Answer»

Right OPTION is (b) Derived class pointer object cannot point to a base class object

Best EXPLANATION: C++ does not allow a derived class pointer to point a base class pointer whereas Base class can point to a derived class object. Both base class and derived class can have pointer OBJECTS.

70.

Which function is used to read a single character from the console in C++?(a) cin.get(ch)(b) getline(ch)(c) read(ch)(d) scanf(ch)I have been asked this question in an internship interview.This key question is from Basics topic in section Basics Concepts of C++ of C++

Answer»

The correct answer is (a) cin.get(CH)

To explain I WOULD say: C++ provides cin.get() function to read a single character from CONSOLE WHEREAS others are USED to read either a single or multiple characters.

71.

What are the formal parameters in C++?(a) Parameters with which functions are called(b) Parameters which are used in the definition of the function(c) Variables other than passed parameters in a function(d) Variables that are never used in the functionI have been asked this question during an interview.The above asked question is from Basics in section Basics Concepts of C++ of C++

Answer»

Right option is (b) Parameters which are USED in the definition of the function

The EXPLANATION is: Formal parameters are those which are used in the definition of a function. They are the parameters that REPRESENT the actual parameters passed and they are the ONE which is used inside the function.