c++ interview questions and answers

Top C++ Quiz Questions and Answers | C++ Quiz For Beginners

You can test your C++ skills with Quiz. The Test. The test contains 25 questions and there is no time limit. The test is not official, C++ Interview Questions For Freshers · 1. What are the different data types present in C++? · C++ Interview Questions for Freshers . Commonly Asked C++ Interview Questions . and Top C++ Interview Questions and Answers that cover almost all the major basic and advanced coding topics in C++ questions on advanced topics . top interview questions and the tips in facing the interview. 

1Q. Which of the following is a correct identifier in C++?

a) 7var_name
b) 7VARNAME
c) VAR_1234
d) $var_name

Option C – VAR_1234

2Q. Which of the following is called address operator?

a) *
b) &
c) _
d) %

Option B – &

3Q. What are the actual parameters in C++?

a) Parameters with which functions are called
b) Parameters which are used in the definition of a function
c) Variables other than passed parameters in a function
d) Variables that are never used in the function

Option A -Parameters with which functions are called

4Q. 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)

Option A -cin.get(ch)

5Q. Which function is used to write a single character to console in C++?

a) cout.put(ch)
b) cout.putline(ch)
c) write(ch)
d) printf(ch)

Option A -cout.put(ch)

6Q. Which of the following escape sequence represents carriage return?

a) \r
b) \n
c) \n\r
d) \c

Option A – \r

7Q. Who created C++?

a) Bjarne Stroustrup
b) Dennis Ritchie
c) Ken Thompson
d) Brian Kernighan

Option A -Bjarne Stroustrup

8Q. A language which has the capability to generate new data types are called ____

a) Extensible
b) Overloaded
c) Encapsulated
d) Reprehensible

Option A -Extensible

9Q. Wrapping data and its related functionality into a single entity is known as _

a) Abstraction
b) Encapsulation
c) Polymorphism
d) Modularity

Option B -Encapsulation

10Q. What does polymorphism in OOPs mean?

a) Concept of allowing overiding of functions
b) Concept of hiding data
c) Concept of keeping things in differnt modules/files
d) Concept of wrapping things into a single unit

Option A -Concept of allowing overiding of functions

11Q. Which concept allows you to reuse the written code?

a) Encapsulation
b) Abstraction
c) Inheritance
d) Polymorphism

Option C -Inheritance

12Q. 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 classes

Option B -They allows us to show only required things to outer world

13Q. Which of the following class allows to declare only one object of it?

a) Abstract class
b) Virtual class
c) Singleton class
d) Friend class

Option C -Singleton class

14Q. Out of the following, which is not a member of the class?

a) Static function
b) Friend function
c) Constant function
d) Virtual function

Option B -Friend function

15Q. Which of the following cannot be a friend?

a) Function
b) Class
c) Object
d) Operator function

Option C – Object

16Q. Why references are different from pointers?

a) A reference cannot be made null
b) A reference cannot be changed once initialized
c) No extra operator is needed for dereferencing of a reference
d) All of the mentioned

Option D – All of the mentioned

17Q. How many types of polymorphism are there in C++?

a) 1
b) 2
c) 3
d) 4

Option B – 2

18Q. How compile-time polymorphisms are implemented in C++?

a) Using Inheritance
b) Using Virtual functions
c) Using Templates
d) Using Inheritance and Virtual functions

Option C – Using Templates

19Q. Which of the following explains the overloading of functions?

a) Virtual polymorphism
b) Transient polymorphism
c) Ad-hoc polymorphism
d) Pseudo polymorphism

Option C – Ad-hoc polymorphism

20Q. Which of the following approach is used by C++?

a) Top-down
b) Bottom-up
c) Left-right
d) Right-left

Option B – Bottom-up

21Q. Which operator is overloaded for a cout object?

a) >>
b) <<

c) <

d) >

Option B – <<

22Q. Which of the following is correct?

a) C++ allows static type checking
b) C++ allows dynamic type checking.
c) C++ allows static member function to be of type const.
d) C++ allows both static and dynamic type checking

Option D – C++ allows both static and dynamic type checking

23Q. Which of the following is true?
I) All operators in C++ can be overloaded.
II) The basic meaning of an operator can be changed.

a) I only
b) II only
c) Both I and II
d) Neither I nor II

Option D – Neither I nor II

24Q. Which of the following is not a type of inheritance?

a) Multiple
b) Multilevel
c) Distributive
d) Hierarchical

Option C – Distributive

25Q. Which members are inherited but are not accessible in any case?

a) Private
b) Public
c) Protected
d) Both private and protected

Option A – Private

Leave a Comment

Your email address will not be published. Required fields are marked *