Académique Documents
Professionnel Documents
Culture Documents
DEPARTMENT OF E AND C
C++ QUESTION BANK
UNIT 1
ii)member functions
iii)class constructors
iv)class destructors
22)what are the differences among the definitions in a and between the assignment
in b which if any are illegal
a)int ival = 0;
b)pi = &ival;
ri = &ival;
pi = &rval;
24)copare and contrast the object oriented programming with procedure oriented
programming
25)with c++ pgm segments explain the insertion and extraction operator along with
cascading.
unit 2
1)explain the behavior of continue statement when used in for and while loop
2)describe
iii)size of operator
4)state the syntax and various program control loops available in c++
10)write a c++ program that asks the user for a number between 0 and 100 if the
number is between 1 and 9 write out the words ONE DIGIT BIG! If it is between 10
and 99 write out the words TWO DIGIT BIG! Your program should state if the user
number is outside the range if it is write the phrase OUT OF RANGE
4321
432
43
13)each of the following exhibits a common programming error in the use of switch
statement identify and correct each error
a)switch (ival){
case’e’ : ecn++;
b)switch (ival){
case 1:
int ix = get_value();
ivee[ix] = ival;
c)switch(ival){
case 1,3,5,7,9:
odd cn++;
break;
case 2,4,6,8,10:
NITTE MEENAKSHI INSTITUTE OF TECHNOLOGY
DEPARTMENT OF E AND C
C++ QUESTION BANK
even cn++;
break;
int bufsize;
switch(swt){
case ival:
break;
case jval:
case kval:
break;
14)write a program that accepts a string of alphaneumeric characters and prints the
total number of digits in the string also their sum
15)write a program to accept your name and print it desired number of times
16)write a program that prints the sum of all odd intergers between 1 and 50
18)list out the different decsicion option available in c++ with the help of a
program show how ‘switch and ‘if else’ statements produce output comparatively
19)mention the syntax for all the three c++ loop constructs separately. Write down
a typical program which illustrates all the three loops and show the corresponding
output.mention the circumstances ubder which different loops can be used.
Uint 3
3)what is recursive function ? what are the difficulties with such a function.
a)set(int *,int);
b)void func();
c)stringf error(int );
d)arr[10]sum(int * , int);
a)by value
b)by reference
a)an array
9)what are the two forms of return statement explain when you would use each of
them
a)stack unwinding
b)rethrow
c)try block
NITTE MEENAKSHI INSTITUTE OF TECHNOLOGY
DEPARTMENT OF E AND C
C++ QUESTION BANK
d)the catch all handler
16)writ a program that accepats one dimensional array of integers and sorts them
in ascending order(use function)
17)writ a pbm that accepts a sring and computes its length and prints it in reverse
order
Unit 4
1)what are friend functions ?develop a c++ pgm to illustrate the bridging between
two classes using friend function.
a)this pointer
4)what is the use of constructors what are the different types of constructors
explain.
a)clases
b)object
c)data encapsulation
d)polymorphism
10)using the concept of array and class ,how initializing for array and class objects
allotted on heap
11)define the terms state identity behavior with reference to the object in c++
12)describe a class called daytime with three data members for hour,minute,and
second and 2 member
Functions for readind and writing the members of the object initialize the time to
10hours 30minutes and 3 seconds for an object created
13)explain hoe an array of object can be created and member of the object are
accessed
14)differenciate thefollowing
15)what is the importance of class destructor function write the prototype of the
same
a)member functions
b)constructors
17)with a simple c++ pgm using a class explain the terms class,
object,private,public datamembers and member functions
19)create class called distance that models distances measured in inches and feet
note that inches can be any real value in the range 0-11.9,and feet is an integer for
eg the length of a room is 18’-19’’ a constructor should iitialise there values to
zeroes another constructor should initialize them to a fixed value a member
function called adddistance() should add 2 distances properly.finally another
member function called display dist() shopulad display the 2 values of a distance in
format 18’-9.5’’.
Unit 5
NITTE MEENAKSHI INSTITUTE OF TECHNOLOGY
DEPARTMENT OF E AND C
C++ QUESTION BANK
1)why are operators overloaded?which are the operators that cannot be overloaded
and why?
6)discuss different types of inheritance in oops supply a pgm which illustrates any
one type of inheritance
7)what do you mean by operator overloading illustrate this in the case of any
operator and generate the output.
9 create a base class building that stores the number of floors a building has the
number of rooms and it total ffotage create a derived class called house that
inherits building and also stores the following no of bedroom,number of
bathrooms. Also create a derived class called office that inherits building and also
stores the number of fire extinguishers and telephone.