C++ Questions and Answers

C++ Interview Questions and Answers
Our C++ questions and answers focuses on all areas of C++ programming language covering 110+ topics in C++. These topics are chosen from the most authoritative book “The C++ Programming Language” by Bjarne Stroustrup, the Creater of C++.

– 1000+ Multiple Choice Questions & Answers in C++ with explanations
– Lots of MCQs with C++ code/programming snippet and its output
– Every MCQ set focuses on a specific topic in C++ Programming Language
– C++ programming code compiled and tested on x86-32 bit Linux systems

Who should Practice these C++ Questions?
– Anyone wishing to sharpen their skills on C++ programming language
– Anyone preparing for aptitude test in C++ (both objective type and coding written test)
– Anyone preparing for interviews (campus/off-campus interviews, walk-in interview and company interviews)
– Anyone preparing for entrance examinations and other competitive examinations (GATE & GRE)
– All – Experienced, Freshers and Students

Here’s list of Questions & Answers on C++ Programming with 110+ topics:


1. Questions & Answers on Basics Concepts of C++

The section contains questions and answers on basics, oops concepts, c++ concepts, static constant keyword, differences between c and c++.

C++ Basics
OOPs Concept – 1
OOPs Concept – 2
OOPs Concept – 3
OOPs Concept – 4
C++ vs C
C++ Concepts – 1
C++ Concepts – 2
C++ Concepts – 3
Static Constant Keyword

2. Questions on Types, Pointers, Arrays & Structures in C++

The section contains questions on integer, float, character and boolean types. It also contains questions on arrays, pointers, references and structures.

Character Types
Integer Types
Floating Point Types
Pointers into Arrays
References – 1
References – 2
References – 3
Pointer to Void
Character Classification

3. Questions & Answers on Functions, Namespaces & Exceptions in C++

The section contains questions and answers on function declaration and overloading, operators and statements, values and arguments, macros, namespaces and exceptions.

Comments and Indentation
Function Declarations
Argument Passing
Value Return
Overloaded Function Names
Default Arguments
Unspecified Number of Arguments
Pointer to Function
Modularization and Interfaces
Namespaces – 1
Namespaces – 2

4. Questions on Source Files, Classes and Operator Overloading in C++

The section contains questions on classes and functions, fiend function, objects and operators, operator overloading, constructors and destructors, subscripting and dereferencing and other string classes.

Header Files Usage
Classes – 1
Classes – 2
User Defined Types
Operator Functions
Operator Overloading – 1
Operator Overloading – 2
Complex Number Type
Conversion Operators
Friend Function
Large Objects
Essential Operators
Function Call
Increment and Decrement
String Class
String – 1
String – 2
Constructors and Destructors – 1
Constructors and Destructors – 2
Constructors and Destructors – 3

5. Questions & Answers on Derived Classes, Templates & Exception Handling in C++

The section contains questions and answers on different types of classes like abstract, derived and their hierarchies, different types of templates like simple string and function and their derivation and specialization. The section also has questions on error and exception handling, different types of exceptions and their resource management.

Derived Classes
Abstract Classes – 1
Abstract Classes – 2
Design of Class Hierarchies
Class Hierarchies & Abstract Classes
Simple String Template
Function Templates – 1
Function Templates – 2
Class Templates
Template Arguments for Policy Usage
Derivation and Templates
Standard Template Library
Error Handling
Grouping of Exceptions
Catching Exceptions
Resource Management
Exceptions That Are Not Errors
Exception Specifications
Uncaught Exceptions
Exceptions and Efficiency
Exception Handling – 1
Exception Handling – 2
Exception Handling – 3
Error Handling Alternatives
Standard Exceptions

6. Questions on Class Hierarchies, Library & Containers

The section contains questions on different aspects of a container which includes creation and design of new containers, vectors and sequences, types of inheritance and various class hierarchies, sequences like seq_con array class, seq_con vector class, stl – pair and heap, vtable, vptr, generators, array type manipulations, tuples, complex library, valarray, bitset and class relationships.

Class Hierarchies Introduction
Multiple Inheritance
Inheritance – 1
Inheritance – 2
Access Control
Run Time Type Information
Pointers to Members
Free Store
Standard Library Design
Container Design
Sequence Adapters
Associative Containers
Almost Containers
Defining a New Container
seq_con Array Class – 1
seq_con Array Class – 2
seq_con Vector Class – 1
seq_con Vector Class – 2
seq_con List
STL – Pair
STL Container Any – 1
STL Container Any – 2
STL- Heap
vtable and vptr
Array Type Manipulation
Tuples – 1
Tuples – 2
Complex Library – 1
Complex Library – 2
Bitset – 1
Bitset – 2
Bitset – 3
Class Relationships
More Containers

7. Questions & Answers on Algorithms, Objects & Iterators in C++

The section contains questions and answers on different types of algorithms like C style, standard library, modifying sequence and non modifying sequence, different types of iterators, stl algorithms, functors, sequences, containers and allocators.

Standard Library Algorithms
Sequences and Containers
Function Objects
Nonmodifying Sequence Algorithms
Modifying Sequence Algorithms
Stored Sequences
Min and Max
C Style Algorithms
Iterators and Sequences
Checked Iterators
STL Algorithms

8. Questions on Strings, Streams & Numerics in C++

The section contains questions on basic strings and their characters, I/O streams, file and string streams, standard library and mathematical applications like numeric limits, file handling, vector arithmetic and random numbers.

String Characters
Basic String
C Standard Library
Output Stream
Input Stream
File Streams and String Streams
C Input Output
Numeric Limits
Standard Mathematical Functions
Vector Arithmetic
Generalized Numeric Algorithms
Random Numbers
File Handling

9. Questions & Answers on C++ Advanced

The section contains questions and answers on lambda expressions and command line arguments.

Lambda Expressions Command Line Arguments
If you like to learn C++ thoroughly, you should attempt to work on the complete set of C++ questions and answers mentioned above. It will immensely help anyone trying to crack a C++ code or an interview.

Here’s the list of Best Reference Books in C++ Programming Language.

Wish you the best in your endeavor to learn and master C++ programming language!

Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn