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

C++ Interview Questions and Answers: Define Structured Programming

Structured programming uses functions to organize code into smaller, isolated pieces to provide cleaner and easier to maintain code. Object oriented programming isolates data within objects that contain both data fields and methods. The key elements of object oriented languages are classes, inheritance, encapsulation, and polymorphism. Classes define templates for objects, inheritance allows classes to inherit properties from base classes, encapsulation wraps data and methods into objects, and polymorphism enables common interfaces for different implementations.

Uploaded by

KaleemUddin
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
98 views

C++ Interview Questions and Answers: Define Structured Programming

Structured programming uses functions to organize code into smaller, isolated pieces to provide cleaner and easier to maintain code. Object oriented programming isolates data within objects that contain both data fields and methods. The key elements of object oriented languages are classes, inheritance, encapsulation, and polymorphism. Classes define templates for objects, inheritance allows classes to inherit properties from base classes, encapsulation wraps data and methods into objects, and polymorphism enables common interfaces for different implementations.

Uploaded by

KaleemUddin
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

C++ Interview questions and answers

c++.pdf (Size: 148.96 KB / Downloads: 85)


Define structured programming.
Structured programming techniques use functions or subroutines to organize the
programming code.
The programming purpose is broken into smaller pieces and organized together
using function. This technique provides cleaner code and simplifies maintaining the
program. Each function has its own identity and isolated from other, thus change in
one function does not affect other.
Explain Object oriented programming.
Object oriented programming uses objects to design applications. This technique is
designed to isolate data. The data and the functions that operate on the data are
combined into single unit.
This unit is called an object. Each object can have properties and member functions.
You can call member function to access data of an object. It is based on several
techniques like encapsulation, modularity, polymorphism, and inheritance.
List down elements of an object oriented language.
Class
A class is a user defined data type. It serves as a template of the objects. You can
define structure and behaviour of an object using class. It includes data and the
member functions that operate on data.
Inheritance
Inheritance enables a new class to reuse the state and behaviour of old class. The
new class
inherits properties and methods from the old class and is called as derived class and
the old class
is called as base class. The methods thus inherited can be extended using overriding
facility of
C++.
Encapsulation
The wrapping up of data and member function into an object is called encapsulation.
The data is
not accessible to the outside world and only those functions which are wrapped into
the object
can access it. An encapsulated objects act as a "black box" for other parts of the
program which
interact with it. They provide a service, but the calling objects do not need to know
the details how
the service is accomplished.
Polymorphism
Polymorphism enables one common interface for many implementations that allows
objects to act
differently under different circumstances. You can also achieve polymorphism in C+
+ by function

overloading, operator overloading and implementation inheritance.


What is function prototype in C++?
A function prototype is a declaration of a function that omits the function body. It
specifies the
functions name, argument types and return type. E.g. int add(int,int)
Reference: http://seminarprojects.com/Thread-c-interview-questions-and-answerspdf#ixzz3jX9KIlMd

You might also like