OOPs Using C++ Question Bank

Topics: Object-oriented programming, C++, Java Pages: 5 (778 words) Published: April 22, 2014
Chinmay D.Bhamare



Its my first Object Oriented Programming (OOP)
language Question Bank. In this notes all types of
question are available related to c++. Most of the
questions are related to BCA syllabus.
So enjoy this notes and make your study easy
- chinmay D. Bhamare
(Smt.S.M.Agrrawal Inst.Of Mgt.,Chalisgaon)

Write Ans. Of Following Question .
What is class?
The class is one of the defining ideas of object-oriented programming. Among the important ideas about classes are:

A class can have subclasses that can inherit all or some of the characteristics of the class. In relation to each subclass, the class becomes the superclass. Subclasses can also define their own methods and variables that are not part of their superclass.

The structure of a class and its subclasses is called the class hierarchy.

Data Types ?
Boolean –bool
Character -char
Integer -int
Floating point- float
Double floating point- double
Valueless- void
Wide Character –wchar_t

What is Object ?
A class provides the blueprints for objects, so basically an object is created from a class. We declare objects of a class with exactly the same sort of declaration that we declare variables of basic types. Following statements declare two objects of class Box: Box Box1;

Box Box2;

// Declare Box1 of type Box
// Declare Box2 of type Box

Use of Delete operator ?

Using the delete operator on an object deallocates its memory. A program that dereferences a pointer after the object is deleted can have unpredictable results or crash. When delete is used to deallocate memory for a C++ class object, the object's destructor is called before the object's memory is deallocated (if the object has a destructor). If the operand to the delete operator is a modifiable l-value, its value is undefined after the object is deleted.

int* set = new int[100];
//use set[]
delete [] set;

what is mean by function?
Functions allow to structure programs in segments of code to perform individual tasks.
In C++, a function is a group of statements that is given a name, and which can be called from some point of the program. The most common syntax to define a function is:
type name ( parameter1, parameter2, ...) { statements }

What is mean by inline function?
C++ inline function is powerful concept that is commonly used with classes. If a function is inline, the compiler places a copy of the code of that function at each point where the function is called at compile time.

To inline a function, place the keyword inline before the function name and define the function before any calls are made to the function. The compiler can ignore the inline qualifier in case defined function is more than a line. A function definition in a class definition is an inline function definition, even without the use of the inlinespecifier.

Types of Inheritance ?
Inheritance those are provided by C++ are as followings:

Single Inheritance


Multilevel Inheritance


Multiple Inheritance


Hierarchical Inheritance


Hybrid Inheritance

Use of structure in C++ ?

As we have seen, a structure is a good way of storing related data together. It is also a good way of representing certain types of information. Complex numbers in mathematics inhabit a two dimensional plane (stretching in real and imaginary directions). These could easily be represented here by

typedef struct {
double real;
double imag;
} complex;
doubles have been used for each field because their range is greater than floats and because the majority of mathematical library functions deal with doubles by default. In a similar way, structures could be used to hold the locations of points in multi-dimensional space. Mathematicians and engineers might see a storage efficient implementation for sparse arrays here.

Apart from holding data, structures...
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • Data Structure Using C++ Essay
  • Question Bank Essay
  • Interview Question on C Language Essay
  • question bank Essay
  • Essay about C Language Interviw Questions
  • Economics Question Bank Essay

Become a StudyMode Member

Sign Up - It's Free