0% found this document useful (0 votes)
54 views58 pages

Oop QB

The document contains a question bank with multiple choice and short answer questions related to object oriented programming. It includes questions about OOP concepts like classes, objects, inheritance, polymorphism etc. It also includes questions about C++ programming concepts like functions, operators, data types etc. The questions are categorized by module and question type with varying marks for each type.

Uploaded by

yetchanger
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views58 pages

Oop QB

The document contains a question bank with multiple choice and short answer questions related to object oriented programming. It includes questions about OOP concepts like classes, objects, inheritance, polymorphism etc. It also includes questions about C++ programming concepts like functions, operators, data types etc. The questions are categorized by module and question type with varying marks for each type.

Uploaded by

yetchanger
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 58

Table:Question Types

Code Question Type Marks Amount


1 Very Short Theory 1 5
2 Short Theory 2 10
3 Short Essay 4 20
4 Long Essay 15 30

Question Bank

Que
Mod
stion Question
ule
Type
1.1 1 Write an example for object oriented programming language?

1.1 1 Write an example for procedure oriented programming language?

1.1 1 What is a procedure oriented programming?

1.1 1 What is top down approach in program design?

1.1 1 What is bottom up approach in program design?

1.1 1 Which programming language follows top down approach?

1.1 1 Which programming language follows bottom up approach?

1.1 1 List any two concepts of Object oriented programming?

1.2 1 Write any two applications of OOP?

1.1 1 Which is the property of OOP that means the wrapping up of data and functions into a single unit ?

1.1 1 Which concept of OOP provides the idea of reusability?

1.1 1 Define an object?

1.1 1 Define a class in OOP?

1.5 1 What is the alternative name given to the output operator in C++?
1.5 1 What is the alternative name given to the input operator in C++?

1.5 1 What is the use of manipulators in C++ ?

1.5 1 What are the manipulators used in C++?


Que
Mod
stion Question
ule
Type
1.5 1 Which symbol is used as Insertion or put to operator?

1.5 1 Which symbol is used as Extraction or get from operator

1.5 1 What is the keyword wchar_t in C++?

1.4 1 What is an enumerated datatype?

1.4 1 List the two ways of creating symbolic constants in C++?

1.4 1 C++ permits initialization of the variables at run time. What is this type of initializations called?

1.8 1 How a reference variable is created?

1.5 1 What is the purpose of delete operator in C++?

1.5 1 What is the purpose of endl operator in C++?

1.5 1 What is the purpose of new operator in C++?

1.5 1 What is the purpose of setw operator in C++?

1.5 1 What is the use of ‘::’ operator in C++?

1.9 1 What is the use of an inline function?

1.9 1 What is the use of default arguments?

1.9 1 Is this a valid declaration? Why?

int mul(int i=5, int j);

1.10 1 What is the concept behind function overloading ?


Que
Mod
stion Question
ule
Type
1.10 1 What is the concept behind operator overloading?

1.10 1 A function can behave differently in the same program. What is this called?

1.10 1 When do we use the concept of function overloading?

1.9 1 When will you make a function inline?

1.9 1 How will you define an inline function?

1.1 2 Define procedure oriented programming? Write down any two of its characteristics?

1.1 2 List the different concepts of OOPS?

1.1 2 What is polymorphism in OOPS? Give an example?

1.1 2 Define an object in c++?

1.1 2 Define data abstraction and encapsulation in OOPS?

1.1 2 Define inheritance in OOPS? Give an example ?

1.1 2 What is meant by dynamic binding?

1.4 2 What are the rules for naming identifiers?

1.4 2 Explain any two user defined datatype in c++?

1.4 2 Define datatype modifiers in c++? List them?

1.8 2 What is a reference variable?write its syntax?

1.4 2 What is meant by dynamic initialization of variables? Give an example?

1.5 2 What are the memory management operators used in c++?


Que
Mod
stion Question
ule
Type
1.5 2 What are manipulators in c++?Explain the most commonly used manipulators?

1.5 2 What is the purpose of a type cast operator? Give an example?

1.6 2 Write down the syntax of while and do while?

1.6 2 Write down the synatax of if else statement and nested if?

1.6 2 Write down the syntax of switch statement and nested switch?

1.6 2 Draw the flow chart of if else?write an example?

1.6 2 Draw the flow chart of nested if? Write an example?

1.6 2 Contrast the difference between while and do while?

1.10 2 What is function prototyping? Write a prototype for a function ‘sum’ with three arguments one of
integer and other two float with a return type integer?

1.9 2 What is an inline function?how can we define it?

1.7 2 Analyse the code and predict the output?why?


#include<iostream>
using namespace std;
int x = 10;
void fun()
{
int x = 2;
{
int x = 1;
cout << ::x << endl;
}
}

int main()
{
Que
Mod
stion Question
ule
Type
fun();
return
0;
}
1.9 2 Identify the legal function declaration(s) with default arguments?explain?

(a) int mul(int i,int j=5,int k=10);


(b) int mul(int i=5,int j);
(c) int mul(int i=0, int j, int k=10);
(d) int mul(int i=2,int j=5,int k=10);

1.9 2 Consider an overloaded function add(). Identify the proper declaration for the function call add(0.75,
5)? Explain why?

(a) int add(char a, int b);


(b) int add(int a);
(c) int add(float a);
(d) double add(double a, int b);

1.9 2 Consider an overloaded function mul(). Identify the proper declaration for the function call mul(6,
5)? Explain why?

(a) int mul(char a, int b);


(b) int mul(int a);
(c) int mul(float a);
(d) double mul(int a, int b);

1.9 2 Consider an overloaded function sub(). Identify the proper declaration for the function call sub(3.25,
5.5)? Explain why?
Que
Mod
stion Question
ule
Type
(a) int sub(char a, int b);
(b) int sub(float a);
(c) double sub(double a, double b);
(d) double sub(int a,int b);

1.9 2 Analyse the code and predict the output?why?

#include <iostream>
using namespace
std;
int fun(int a, int b = 1, int c =2)
{
return (a + b + c);
}
int main()
{
cout << fun(12,2);
return 0;
}
1.5 2 Analyse the code and predict the
output?why? #include <iostream>
#include <string.h>
using namespace std;

int main()
{
cout << sizeof("Examination") << endl;
cout << strlen( "Examination");
return 0;
}
1.3 2 Analyse the code and predict the
output?why? #include<iostream>
using namespace std;
int main()
Que
Mod
stion Question
ule
Type
{
int x = 1 , y = 1;
cout << ( ++x || ++y ) << endl;
cout << “x=”<<x << endl<< “y=”<<y;
return 0;
}
1.3 2 Analyse the code and predict the
output?why? #include<iostream>
using namespace std;
int main()
{
int x = 1 , y = 1;
cout << ( ++x && ++y ) << endl; cout
<< “x=”<<x << endl<< “y=”<<y;
return 0;
}
1.3 2 Analyse the code and predict the
output?why? #include<iostream>
using namespace std;
int main()
{
int x = 1 , y = 1, z = 1;
cout << ( ++x || ++y && ++z ) << endl;
cout << “x=”<<x << "y= " << y << " z=" << z ; return 0;
}
1.5 2 Analyse the code and predict the
output?why? #include<iostream>
using namespace std;
int x=6;

int main()
{
Que
Mod
stion Question
ule
Type
int x = 10;
cout << "x=" << ::x << endl;
cout << "x=" << x;
return 0;
}
1.3 2 Analyse the code and predict the
output?why? #include <iostream>
using namespace std;

int main()
{
int a = b = c = 0;
cout << a << "*" << b << "*" << c;
return 0;
}
1.3 2 Analyse the code and predict the
output?why? #include <iostream>
using namespace std;

int main()
{
for ( ; ; ) cout << "blank";
return 0;
}
1.6 2 Analyse the code and predict the
output?why? #include <iostream>
using namespace std;

int main()
{
int i;
for (i=0; i<3; i++);

cout << "hello!" <<i;


Que
Mod
stion Question
ule
Type
return 0;

}
1.5 2 Determine the output of the code?explain why?
#include <iostream>
using namespace std;

int main()
{
int i;
i = 1 + (1,4,5,6,3);
cout << i;
return 0;
}
1.5 2 Determine the output of the code?explain
why? #include <iostream>
using namespace std;

int main()
{
int a = 0, b;
b = (a = 50) + 10;
cout << a << "$" << b;
return 0;
}
1.5 2 Determine the output of the code?explain
why? #include<iostream>
using namespace std;

int main()
{
char a = 30, b = 40, c = 10;
char d = (a*b)/c;
cout << int(d);
Que
Mod
stion Question
ule
Type
return 0;
}
1.6 2 Determine the output of the code?explain why?
#include<iostream>
using namespace std;

int main()
{
static int i = 5;

if (--i)
{
cout <<
i; main();
}
return 0;
}
1.6 2 Determine the output of the code?explain
why? #include<iostream>
using namespace std;

int main()
{
int i = 5;

if (--i)
{
cout <<
i; main();
}
return 0;
}
1.6 2 Determine the output of the code?explain
why? #include <iostream>
using namespace std;
Que
Mod
stion Question
ule
Type

int main()
{
int n = 10;
for (int i = 0; i < n; i++ )
{
n++;
continue;
cout<<
n;
}

return 0;
}
1.6 2 Determine the output of the code?explain
why? #include <iostream>
using namespace std;

int main()
{
int n = 10, i;

for (i=0; i<n; i++)


{
n++;
cout<< n << endl;
goto x;
}

x:
do
{
cout << "label x"<<
endl; break;
}
while( 0 ) ;
Que
Mod
stion Question
ule
Type
return 1;
}
1.6 2 Determine the output of the code?explain why?

#include <iostream>
using namespace
std;

int main()
{
int choice = 1 ;

switch(choice)
{
cout << "\nFirst
Statement"; case 1 :
cout << "\nInside Switch case 1";
case 2 :
cout << "\nInside Switch case 2";
break;
case 3 :
cout << "\nInside Switch case 3";
break;
default:
cout << "bye bye";
}
return(0);
}
1.5 2 Determine the output of the code?explain why?

#include <iostream>
using namespace
std; int main()
{
Que
Mod
stion Question
ule
Type
cout << sizeof('x')<<endl;
cout << sizeof(char)<<endl;
return 0;
}
1.6 2 Determine the output of the code?explain
why? #include <iostream>
using namespace std;
int main()
{
char m;
switch (m) {
case 'c':
cout << "Computer
Science"; case 'a':
cout <<
"Accoutant"; break;
default:
cout << "wrong choice";
}
return 0;
}
1.5 2 Determine the output of the code?explain why?

#include <iostream>
using namespace
std; int main()
{
int i = 0;
cout << (i = 0 ? 1 : 2 ? 3 : 4);
return 0;
}
1.3 2 Determine the output of the code?explain why?
Que
Mod
stion Question
ule
Type
#include <iostream>
int main()
{
if (0)
std::cout << "hello";
else
std::cout << "world";
return 0;
}
1.3 2 Determine the output of the code?explain why?

#include <iostream>
int main()
{
if (2)
std::cout << "hello";
else
std::cout << "world";
return 0;
}
1.6 3 List the basic control structures in c++?Draw the flowcharts of each?

1.4 3 Explain any four tokens in C++?

1.5 3 What are the advantages of using new operator over function malloc()?

1.10 3 What are the steps of function selection by the compiler in function overloading?

1.10 3 What do you meant by overloading of a function?what are its advantages?

1.5 3 What is the application of scope resolution operator in c++?Write an example?

1.4 3 Describe with examples the use of enumerated datatype?

1.2 3 Explain the benefits and applications of OOP?


Que
Mod
stion Question
ule
Type
1.5 3 What are operators in c++? Explain?

1.6 3 Explain selection control structure with an example?

1.6 3 List different loop statements used in C?Write down the syntax of each?

1.5 3 Explain arithmetic and logical operators in c++?

1.5 3 Explain bitwise OR operator with the help of examples?

1.5 3 Explain bitwise AND operator with the help of examples?

1.5 3 Explain operator precedence with examples?

1.10 3 Write a c++ program with a function display() which is overloaded such that it can be used to display
integer, character and floating point values?

1.6 3 Write a c++ program to find largest of three numbers using nested if statement?

1.3 3 Write a c++ program to swap two numbers using temporary variables?

1.3 3 Write a c++ program to swap two numbers without using temporary variables?

1.6 3 Write a c++ program to display amstrong numbers between the specified intervals?

1.6 3 Analyse the pattern given below and write a program to display this pattern?

1.5 3 Print the value of y for given x=2 & z=4 and analyze the output.
Que
Mod
stion Question
ule
Type
a. y = x++ + ++x;

b. y= ++x + ++x;

c. y= ++x + ++x + ++x;

d. y = x>z;

e. y= x>z? x:z;

f. y = x&z;

g. y= z>>2 + x<<1;

1.6 3 Analyse the following inputs and corresponding outputs and write a program to display the same
form given any positive integer as input?

Input Output

123 321

432 234

143 341

112 211
1.6 3 Analyse the following inputs and corresponding outputs and write a program to display the same
form given any two positive integers (n1,n2) as input?
Que
Mod
stion Question
ule
Type
Inputs Output

4,3 3

3,2 2

9,3 3

5,4 4
1.6 3 Analyse the following inputs and corresponding outputs and write a program to display the same
form given any positive integer as input?

Input Output

123 6

432 9

111 3

112 4
1.6 3 Analyse the inputs and corresponding outputs of each inputs given and write a program for the same
without using library functions?

Input

Output A a

B b

.
Que
Mod
stion Question
ule
Type
.

Z z

a A

b B

z Z
1.6 3 Write a C++ program to find the element occurring odd number of times in an array?

1.6 3 Write a c++ program to implement Simple Calculator using switch statement?

1.6 3 Write a c++ program to display prime numbers between two intervals?

1.6 3 Write a c++ program to display amstrong numbers between a specified interval?

1.6 3 Write a c++ program to find roots of quadratic equations?

1.4 4 Explain about tokens in C++?

1.5 4 Explain different operators in c++ with examples?

1.4 4 What are the datatypes in c++? Explain?

1.6 4 Explain briefly about control structures in c++ with example?

1.1 4 Explain about Object Oriented Programming (OOP) ?


Que
Mod
stion Question
ule
Type
1.7 4 Explain about user defined functions in c++?

1.6 4 Explain different decision statements used in C++ with examples?

1.6 4 Explain different loop statements used in C++ with examples?

1.10 4 Explain function overloading in c++ with an example?

1.9 4 Explain default argument with the help of examples?

1.10 4 Write a c++ program to find area of square, circle , triangle, rectangle using the concept of
polymorphism?explain?

1.4 4 Write a program to swap the values of a pair of integers by using reference variables as
arguments?explain?
2.1 1 List the two parts of class specification?

2.1 1 List any two keywords which can be used as visibility labels?

2.1 1 What are data members?

2.1 1 What are member functions?

2.1 1 Define the term encapsulation?

2.1 1 Write down the general form of a class declaration?

2.2 1 Write down the format for calling a member function with an example?

2.1 1 Write an example of class declaration?

2.2 1 What are the methods of defining the member functions?

2.1 1 What is the difference between a member function and a normal function?
Que
Mod
stion Question
ule
Type
2.4 1 The space for member variables is allocated separately for each object why?

2.5 1 What is the purpose of static variables?

2.2 1 Write an example for private member function?

2.8 1 Write an example for friend function declaration?

2.2 1 How to define a function outside class inline?

2.7 1 How can we create an object?create an object mango of class fruit ?

2.3 1 Write a class definition with arrays within a class?

2.4 1 Illustrate how the space for member functions and data members are allocated in the memory?

2.1 2 Define a class?Write down the syntax for class declaration?

2.2 2 What is meant by nesting of member functions?write a simple example?


Que
Mod
stion Question
ule
Type
2.1 2 How data hiding in class is made possible?

2.1 2 How can we define a member function outside the class? Write an example?

2.1 2 How can we define a member function inside the class? Write an example?

2.1 2 What are the characteristics of a member function?

2.8 2 What are the characteristics of a friend function?

2.6 2 What is meant by arrays of objects?Write an example?

2.6 2 Define an object?write an example of object declaration?

2.1 2 How can we access class members? Write an example?

2.1 2 Write a class declaration with 2 data members a and b as private and two member functions get()
and put() as public?

2.1 2 Write a class declaration with 3 data members a,b and c as private and a member functions sum()
and a friend function display() as public?

2.1 2 Write a class declaration with 3 data members a,b as private, data member c and two member
functions get() and put() as public?

2.1 2 Write a class declaration with a public member function void getdata(int a,float b) and define it
outside the class as inline?

2.1 2 Write a class declaration with a public member function void getdata(int a,float b) and define it
outside the class?

2.1 2 Write a class declaration with a public member function void getdata(int a,float b) and define it inside
the class?
Que
Mod
stion Question
ule
Type
2.8 2 Write a class declaration with 1 data members a as private and a friend function display() as public
create an object o. Also call the function display in the main function?

2.2 2 Write a class declaration with a public member function void getdata(int a,float b) , define it inside
the class, create an object o. Also call the function getdata in the main function?

2.6 2 Write a class declaration with 3 data members a,b as private, data member c and two member
functions get() and put() as public. Also create 5 objects using the concept of array of objects ?

2.2 2 Write a class declaration with 3 data members a,b as private, data member c and two member
functions get() and put() as public. Also create an object ‘o’ of that class?

2.2 2 Analyse the code and predict the output and explain why?
#include<iostream>
using namespace std;
class ABC
{
int a;
float b;
public:
void getdata(int c,float d)
{
a=c;
b=d;
}
};
int main()
{
ABC o;
o.getdata(3,2.3);
cout<<”value:”<<o.a;
}
2.2 2 Analyse the code and predict the output and explain why?
#include<iostream>
Que
Mod
stion Question
ule
Type
using namespace std;
class ABC
{
int a;
float b;
Public:
int a;
void getdata(int c,float d)
{
a=c;
b=d;
}
};
int main()
{
ABC o;
o.getdata(3,2.3);
cout<<”value:”<<o.a;
}
2.2 2 Analyse the code and predict the output and explain why?
#include<iostream>
using namespace std;
class ABC
{
int a;
Public
:
void getdata(int a) ;
}o;
void getdata(int c)
{a=c;
cout<<a;
}
int main()
{ o. getdata(5);}
Que
Mod
stion Question
ule
Type
2.1 2 Analyse the code and predict the output and explain why?
#include<iostream>
using namespace std;
class Test {
int x;
};
int main()
{
Test t;
cout <<
t.x; return
0;
}
2.1 3 Explain two parts of class specification?

2.1 3 How to define a member function of a class?

2.1 3 What is a member function?how is it different from normal function in C++?

2.1 3 Write a class declaration two member functions get() and put() as public with get() defined ouside
the class and put() defined inside the class?

2.8 3 How a friend function is declared? What are the characteristics of friend function?

2.8 3 Write a program to find largest among 2 numbers, the numbers are private members of the class, use
friend function?

2.8 3 Write a program to find sum of 2 numbers, the numbers are private members of the class, use friend
function?

2.8 3 Write a program to find product of 2 numbers, the numbers are private members of the class, use
friend function?

2.8 3 Write a program to find difference of 2 numbers, the numbers are private members of the class, use
friend function?
Que
Mod
stion Question
ule
Type
2.8 3 Write a program to perform division of 2 numbers, the numbers are private members of the class ,use
friend function?

2.8 3 Write a program to swap 2 numbers, use friend function?

2.8 3 Write a program to perform division of 2 numbers, one number is a private member of class A,
another number is a private member of another class B?

2.8 3 Write a program to perform addition of 2 numbers, one number is a private member of class A,
another number is a private member of another class B?

2.8 3 Write a program to perform subtraction of 2 numbers, one number is a private member of class A,
another number is a private member of another class B?

2.8 3 Write a program to perform multiplication of 2 numbers, one number is a private member of class A,
another number is a private member of another class B?

2.8 3 Write a program to swap 2 numbers, one number is a private member of class A, another number is a
private member of another class B?

2.8 3 Write a program to find largest of 2 numbers, one number is a private member of class A, another
number is a private member of another class B?

2.8 3 Write a program to find mean value of 2 numbers, one number is a private member of class A,
another number is a private member of another class B?

2.8 3 Write a program to find mean value of 2 numbers, the numbers are private members of the class ,use
friend function?

2.8 3 Write a program to find area of a rectangle, the length and breadth are private members of the class
,use friend function?

2.8 3 Write a program to find area of a square, the side is a private member of the class ,use friend
function?
Que
Mod
stion Question
ule
Type
2.8 3 Write a program to find area of a right angled triangle, the sides are private members of the class ,use
friend function?

2.1 4 Explain about classes and objects in C++ with an example?

2.7 4 Explain about member functions and friend functions in c++?

2.8 4 Write a program to swap two numbers using the concept of reference variables and friend function?

2.2 4 Write a program to find largest of 2 numbers. Use the concept of nesting of member functions?

2.6 4 Write a program to read and display details of 10 cars using the concept of classes and arrays of
objects?

2.6 4 Write a program to read and display details of 10 employees using the concept of classes and arrays
of objects?

2.6 4 Write a program to read and display details of 10 students using the concept of classes and arrays of
objects?

2.3 4 Write a program for processing shopping list using class concept in c++?(The required unctions are:
add an item, display total value, delete an item, display all items)

3.1 1 Define a constructor?

3.4 1 Define destructor?

3.2 1 Define parameterised constructor?

3.2 1 Define default constructor?

3.2 1 Define copy constructor?

3.1 1 What are the methods to pass initial values as arguments to the constructor function?
Que
Mod
stion Question
ule
Type
3.3 1 Define dynamic constructors?

3.5 1 What is meant by operator overloading?

3.5 1 What is the OOPs concept behind operator overloading?

3.5 1 Write any 2 operators that cannot be overloaded?

3.5 1 What is the purpose of an operator function?

3.5 1 Write the general form of operator function?

3.5 1 Write an example for passing initial values as arguments to the constructor function explicitly?

3.1 1 Write an example for passing initial values as arguments to the constructor function implicitly?

3.3 1 Define constructor overloading?

3.1 2 Define constructor and write down its syntax?

3.4 2 Define destructor and write down its syntax?

3.2 2 Define a copy constructor and write an example?

3.3 2 Define a default constructor?write down its syntax?

3.2 2 Define a parameterised constructor and write down its syntax?

3.3 2 Can we have more than one constructors in a class?if yes, what is that mechanism called?

3.1 2 How do we invoke a constructor function?


Write an example?
3.1 2 What do you mean by dynamic initialisation of objects?how it is achieved?

3.3 2 What are the operators used by dynamic constructors?write its syntax?
Que
Mod
stion Question
ule
Type
3.1 2 Write any 2 features of constructor?

3.1 2 Distinguish between the following two

statements: time T2(T1);

time T2 = T1;

T1 and T2 are objects of time class.

3.4 2 Describe the importance of destructors write its syntax

3.1 2 Predict the output and explain why?

#include <iostream>
using namespace
std;

class construct
{
int a, b;
public:
construct()
{
a = 0;
b = 0;
}
};

int main()
{
construct c;
cout<< "a: "<< c.a << endl << "b: "<< c.b;
Que
Mod
stion Question
ule
Type
return 1;
}
3.1 2 Predict the output and explain why?

#include <iostream>
using namespace
std;

class construct
{

public:
int a, b;
construct()
{
a = 5;
b = 6;
}
};

int main()
{
construct c;
cout<< "a: "<< c.a << endl << "b: "<< c.b;
return 1;
}
3.2 2 Predict the output and explain why?
#include <iostream>
using namespace std;
class construct
{
public:
float
area;
Que
Mod
stion Question
ule
Type
construct()
{
area = 0;
}
construct(int a, int b)
{
area = a * b;
}
void disp()
{
cout<< area<< endl;
}
};

int main()
{
construct o;
construct o2( 10,
20); o.disp();
o2.disp();
return 1;
}
3.2 2 Predict the output and explain why?
#include<iostream.h>
class constructor
{
int x;
public:
constructor(short ss)
{
cout<< "Short" << endl;
}
constructor(int xx)
{
cout<< "Int" << endl;
}
Que
Mod
stion Question
ule
Type
constructor(float ff)
{
cout<< "Float" << endl;
}
};
int main()
{
constructor c('B');
return 0;
}
3.1 2 Predict the output and explain why?
#include <iostream>
using namespace std;

class constructor
{
int a;
public:
constructor(int x)
{
a = x;
}

void display()
{
cout<< "a: "<<a << endl;
}
};
int main()
{
constructor c1(10);
constructor c2 = c1;
c1.display();
c2.display();
return 1;
}
Que
Mod
stion Question
ule
Type
3.2 2 Predict the output and explain why?
#include<iostream.h>
class constructor
{
int x;
public:
constructor(short ss)
{
cout<< "Short" << endl;
}
constructor(int xx)
{
cout<< "Int" << endl;
}
constructor(float ff)
{
cout<< "Float" << endl;
}
};
int main()
{
constructor c(2.4);
return 0;
}
3.2 3 What is a parameterised constructor? Explain with an example?

3.3 3 What is a default constructor? Explain with an example?

3.2 3 What is a copy constructor? Explain with an example?

3.3 3 What are constructors with default arguments? Explain with an example program?

3.3 3 What are overloaded constructors?Explain with an example?

3.1 3 Write a program to add 2 numbers using constructors in c++?


Que
Mod
stion Question
ule
Type

3.1 3 Write a program to multiply 2 numbers using constructors in c++?

3.1 3 Write a program to perform division 2 numbers using constructors in c++?

3.1 3 Write a program to find mean of 2 numbers using constructors in c++?

3.5 3 Write a program to overload ++ operator?

3.5 3 Write a program to overload + operator?

3.5 3 Write a program to overload -- operator?

3.5 3 Write a program to overload - operator?

3.5 3 Write a program to overload * operator?

3.3 3 Write a program to find area of a right angled triangle,rectangle,circle using concept of constructor
overloading?

3.2 4 Explain different types of constructors in c++ with examples?

3.3 4 Explain about operator overloading in C++ with examples?

3.5 4 Write a program to overload unary operator using friend function explain?

3.5 4 Write a program to overload binary operator using friend function explain?

3.5 4 Write a program to overload ++ and --operator for prefix and postfix use?
Que
Mod
stion Question
ule
Type
3.5 4 Write a program to overload binary – operator using member function and contrast the difference
when overloading the same using friend function?

3.5 4 Write a program to overload binary + operator using member function and contrast the difference
when overloading the same using friend function?

3.5 4 Write a program to overload binary * operator using member function and contrast the difference
when overloading the same using friend function?

3.5 4 Write a program to pass reference of an object to operator function?

3.5 4 Write a program to perform multiplication using an integer and object. Use friend function?

3.5 4 Write a program to perform addition using an integer and object. Use friend function?

4.1 1 Define the concept inheritance in c++?

4.3 1 What is meant by single inheritance in c++?

4.3 1 What is meant by multiple inheritance in c++?

4.3 1 What is meant by multilevel inheritance in c++?

4.3 1 What is meant by hierarchical inheritance in c++?

4.3 1 What is meant by hybrid inheritance in c++?

4.2 1 Write the syntax for defining derived class?

4.2 1 What are the different visibility modes?


4.3 1 Represent single inheritance in a diagram?

4.3 1 Represent multiple inheritance in a diagram?

4.3 1 Represent multilevel inheritance in a diagram?


Que
Mod
stion Question
ule
Type
4.3 1 Represent hierarchical inheritance in a diagram?

4.3 1 Represent hybrid inheritance in a diagram?

4.2 1 Define a class ABC that is derived publicly from class XYZ?

4.2 1 Define a class ABC that is derived privately from class XYZ?

4.2 1 Define a class ABC that is derived publicly from class XYZ and GHI?

4.3 2 What is single inheritance? Write its syntax?

4.3 2 What is multiple inheritance? Write its syntax?

4.4 2 What are virtual base classes?how to make a base class virtual?

4.4 2 What is an abstract class?What is the purpose of abstract class?

4.6 2 What is nesting of classes?give an example?

4.2 2 What is public visibility mode?write an example of defining a class that is inherited from another
class publicly?

4.2 2 What is private visibility mode?write an example of defining a class that is inherited from another
class privately?

4.2 2 What happens when a class is derived from another class publicly?

4.2 2 What happens when a class is derived from another class privately?

4.3 2 Draw the diagram of multi level and multiple inheritance?

4.2 2 Examine the code and predict the output?Explain?

#include<iostream>
using namespace
std;
Que
Mod
stion Question
ule
Type
class P {
public:
void print() { cout <<" Inside P"; }
};

class Q : public P {
public:
void print() { cout <<" Inside Q"; }
};
class R: public Q { };
int main(void)
{
R r;
r.print();
return
0;
}
4.2 2 Examine the code and predict the output?Explain?

#include<iostream>
using namespace
std;

class Base
{
public:
int fun() { cout << "Base::fun() called"; }
int fun(int i) { cout << "Base::fun(int i) called"; }
};

class Derived: public Base


{
public:
int fun() { cout << "Derived::fun() called"; }
};
Que
Mod
stion Question
ule
Type
int main()
{
Derived d;
d.fun(5);
return 0;
}
4.2 2 Examine the code and predict the output?Explain?

#include<iostream>
using namespace
std;

class Base
{
protected:
int a;
public:
Base() {a = 0;}
};

class Derived1: public Base


{
public:
int c;
};

class Derived2: public Base


{
public:
int c;
};

class DerivedDerived: public Derived1, public Derived2


{
public:
Que
Mod
stion Question
ule
Type
void show() { cout << a; }
};

int main(void)
{
DerivedDerived d;
d.show();
return 0;
}
4.2 2 Examine the code and predict the output?Explain?

#include<iostream>
using namespace
std;

class Base
{
public:
int fun() { cout << "Base::fun() called"; }
int fun(int i) { cout << "Base::fun(int i) called"; }
};

class Derived: public Base


{
public:
int fun() { cout << "Derived::fun() called"; }
};

int main()
{
Derived d;
d.fun();
return 0;
}
4.2 2 Examine the code and predict the output?Explain?

#include<iostream>
Que
Mod
stion Question
ule
Type
using namespace std;

class Base
{
public:
int fun() { cout << "Base::fun() called"; }
int fun(int i) { cout << "Base::fun(int i) called"; }
};

class Derived: public Base


{
public:
int fun(int i) { cout << “Derived”<<i;}
};

int main()
{
Derived d;
d.fun(7);
return 0;
}
4.2 2 Examine the code and predict the output?Explain?

#include<iostream>
using namespace
std;

class base {
int arr[10];
};

class b1: public base { };

class b2: public base { };

class derived: public b1, public b2 {};


Que
Mod
stion Question
ule
Type

int main(void)
{
cout << sizeof(derived);
return 0;
}
4.2 3 Explain public inheritance with an example?

4.2 3 Explain private inheritance with an example?

4.4 3 Explain about abstract class with an example?

4.4 3 Explain about virtual base classes with an example?

4.3 3 Write a program to demonstrate single inheritance?

4.3 3 Write a program to demonstrate multiple inheritance?

4.3 3 Write a program to demonstrate multilevel inheritance?

4.3 4 Write a C++ program to read and print students information using two classes and simple inheritance

4.3 4 Write a C++ program to read and print employee information using multiple inheritance?

4.3 3 Write a C++ program to add two numbers using single inheritance. Accept these two numbers from
the user in base class and display the sum of these two numbers in derived class.

4.3 3 Write a C++ program to subtract two numbers using single inheritance. Accept these two numbers
from the user in base class and display the difference of these two numbers in derived class.

4.3 3 Write a C++ program to multiply two numbers using single inheritance. Accept these two numbers
from the user in base class and display the product of these two numbers in derived class.

4.2 3 Explain the terms base class and derived class with example?
Que
Mod
stion Question
ule
Type
4.2 3 Explain about accebility in public inheritance with a simple example?

4.2 3 Explain about accebility in private inheritance?

4.2 3 Write a C++ program to divide two numbers using single inheritance. Accept these two numbers
from the user in base class and display the quotient upon dividing these two numbers in derived class.

4.1 4 Explain about inheritance in OOPS?

4.2 4 Explain about visibility modes in c++?

4.3 4 Write a C++ program to find mean of two numbers using single inheritance. Accept these two
numbers from the user in base class and display the mean of these two numbers in derived class.

4.3 4 Write a C++ program to find average of three numbers using single inheritance. Accept these three
numbers from the user in base class and display the average of these three numbers in derived class.

51 1 Define runtime polymorphism?

5.1 1 How to achieve runtime polymorphism?

5.1 1 What is a this pointer?

5.4 1 What is meant by virtual functions?

5.4 1 What are pure virtual functions?

5.5 1 Which are the file stream classes?

5.6 1 What is a file mode?

5.5 1 What are input streams?

5.5 1 What are output stream?


Que
Mod
stion Question
ule
Type
5.5 1 What is a put() function?

5.5 1 What is a get() function?

5.5 1 What is a read() function?

5.5 1 What is a write() function?

5.2 1 What are file pointers?

5.6 1 What is the use of seekg()function?

5.6 1 What is the use of seekp()function?

5.6 1 What is the use of tellg()function?

5.6 1 What is the use of tellp()function?

5.6 1 What is eof()?

5.6 1 What is open() function?

5.7 2 What role does iomanip file play?

5.5 2 What is a stream?

5.5 2 What is istream and ostream?

5.5 2 What is iostream?

5.6 2 What is the use of getline() function?

5.5 2 What is an input stream and output stream?

5.5 2 What is the purpose of fstream?


Que
Mod
stion Question
ule
Type
5.6 2 What are the methods to open a file?

5.6 2 What are the steps of opening a file using constructor?

5.6 2 How can we open a file using open() function?

5.6 2 List any 4 file mode parameters?

5.1 2 What is a get and put pointer?

5.6 2 What happens if the following code is executed?

#include<iostream>
#include<fstream>
using namespace
std;

int main()
{
ofstream ofile;
ofile.open ("text.txt");
ofile << "haaai" << endl;
ofile.close();
return 0;
}
5.6 2 What happens if the following code is executed?

#include<iostream>
#include<fstream>
using namespace
std;

int main()
{
char data[100];
ifstream ifile;
ifile.open
("text.txt");
while ( !ifile.eof() )
Que
Mod
stion Question
ule
Type
{
ifile.getline (data,
100); cout << data <<
endl;
}
ifile.close()
; return 0;
}
5.6 3 What are write () and read () functions?

5.4 3 Write down the rules for virtual functions?

5.8 3 Explain about sequential input and output operations?

5.6 3 Explain any 4 file mode parameters?

5.4 3 What are pure virtual functions ? how to define them?

5.6 4 Explain about opening and closing a file and file opening modes?

You might also like