0% found this document useful (0 votes)
50 views

What Is C++?: C++ Interview Questions and Answers PDF

C++ is an object oriented programming language that maintains many aspects of C while adding object oriented features like classes. Object oriented programming uses objects that contain data and methods. The main features of OOP are encapsulation, polymorphism, and inheritance. OOP provides advantages like better manageable code and easier maintenance through features like encapsulation. Inheritance allows derived classes to inherit from base classes. Namespaces group global classes, objects, and functions under a name. An object contains variables and methods. Polymorphism allows objects to take different forms. Virtual functions are resolved at runtime based on the actual object type.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views

What Is C++?: C++ Interview Questions and Answers PDF

C++ is an object oriented programming language that maintains many aspects of C while adding object oriented features like classes. Object oriented programming uses objects that contain data and methods. The main features of OOP are encapsulation, polymorphism, and inheritance. OOP provides advantages like better manageable code and easier maintenance through features like encapsulation. Inheritance allows derived classes to inherit from base classes. Namespaces group global classes, objects, and functions under a name. An object contains variables and methods. Polymorphism allows objects to take different forms. Virtual functions are resolved at runtime based on the actual object type.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

C++ Interview Questions and Answers Pdf

Question: 1

What is C++?
C++ is an object oriented programming language created by Bjarne Stroustrup.

C++ maintains almost all aspects of the C language, while simplifying memory management and
adding several features – including a new data type known as a class to allow object oriented
programming.

C++ maintains the features of C which allowed for low level access but also gives the
programmer new tools to simplify memory management.

Question: 2

What is Object Oriented Programming?


Object Oriented Programming (OOP) is a programming paradigm where the complete software
operates as a bunch of objects talking to each other.

An object is a collection of data and methods that operate on its data.

Question: 3

What are the main features of OOP?


The main features of OOP:

Encapsulation

Polymorphism

Inheritance

Question: 4

What are advantages of OOP?


The main advantage of OOP is better manageable code that covers following
The overall understanding of the software is increases as the distance between the language
spoken by developers and that spoken by users.

Object orientation eases maintenance by the use of encapsulation.

One can easily change the underlying representation by keeping the methods same.

OOP paradigm is mainly useful for relatively big software.

Question: 5

What do you mean by inheritance?


Inheritance is the process of creating new classes, called derived classes, from existing classes or
base classes.

The derived class inherits all the capabilities of the base class, but can add embellishments and
refinements of its own.

Question: 6

What is namespace?
Namespace allows us to group a set of global classes, objects and/or functions under a name.

To say it somehow, they serve to split the global scope in sub scopes known as namespace.

Question: 7

What is an object?
Object is a software bundle of variables and related methods. Objects have state and behavior.

Question: 8

What is polymorphism?
Poly means many and morph means form. Polymorphism is the ability of an object (or
reference) to assume (be replaced by) or become many different forms of object.

Question: 9
What is scope resolution operator?
A scope resolution operator (::), can be used to define the member functions of a class outside
the class.

Question: 10

What are virtual functions?


Virtual functions are used with inheritance, they are called according to the type of object
pointed or referred, not according to the type of pointer or reference. In other words, virtual
functions are resolved late, at runtime. Virtual keyword is used to make a function virtual.

C++ program with runtime polymorphism (use of virtual functions)

A base class and a derived class.

A function with same name in base class and derived class.

A pointer or reference of base class type pointing or referring to an object of derived class.

You might also like