You are on page 1of 8

NITTE MEENAKSHI INSTITUTE OF TECHNOLOGY

DEPARTMENT OF E AND C
C++ QUESTION BANK
UNIT 1

1)Nam e any 6 keywords in c++

2)distinguish between ivalue and rvalue with suitable example.

3)Explain with eg enumerated data types in c++.

4)With an eg explain the purpoae of using ‘using namespace std’

5)Explain the following

i)data types in c++

ii)member functions

iii)class constructors

iv)class destructors

6)write a short note on enumerated data types

7)explain the following features of oops

i)classes ii)objects iii)inheritance

8)what is a pointer?what are the advantages of pointers Indicate the difference


between address operator and indirection operator.

9)explain the necessity of object oriented programming

10)define the concept of objects ,classes ,reusability, and polymorphism

11)explain with eg different data types

12)explain the key features of oops

13)explain new and delete

14)explain dynamic memory allocation with eg

15)explain cout and cin with eg

16)explain private ,public and protected with respect to the class

17)explain string data types

18)what is const qualifier explain with eg

19)what is bool data type explain with eg


NITTE MEENAKSHI INSTITUTE OF TECHNOLOGY
DEPARTMENT OF E AND C
C++ QUESTION BANK
20)explain vector container type with eg

21)what is a variable differenciate between variable and literal constant.

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;

const int *pi = 0;

const int &ri = 0;

b)pi = &ival;

ri = &ival;

pi = &rval;

23)what are the main reason for evolution of oops.

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

i)relational , equality and logical operators

ii)Assingnment operator increment and decrement operator

iii)size of operator

3)Describe the following control structures in c++ with eg

i)do while loop ii)if-else &else-if iii)for loop iv)while loop

4)state the syntax and various program control loops available in c++

5)explain all the bitwise operators

6)explain all bitset operators

7)explain switch statement with eg


NITTE MEENAKSHI INSTITUTE OF TECHNOLOGY
DEPARTMENT OF E AND C
C++ QUESTION BANK
8)explain with eg how break statement is used inside a loop

9)explain continue and goto statements

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

11)write a c++ program to display the following

4321

432

43

12)write a c++ program to count number of consonants using switch ststement

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 ‘a’: acn++;

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;

d)int ival = 512,jval 1024,kval= 4096;

int bufsize;

switch(swt){

case ival:

bufsize = ival*size of(int);

break;

case jval:

bufsize = jval *size of(int);

case kval:

bufsize = kval*size of(int);

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

17)write a program that accepts the number and reverses it

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

1)differnciate between function prototype and function definition give there


different eg of function protype.
NITTE MEENAKSHI INSTITUTE OF TECHNOLOGY
DEPARTMENT OF E AND C
C++ QUESTION BANK
2)what are default arguments ?write a function called ‘conv temp’that receives the
temperature in centigrade and returns the tepm in Fahrenheit using therelation
TF=(1.8*tc+32).use a default value of 25c for tc.writ a main ()function that gets the
value of centigrade from the use to the pgm

3)what is recursive function ? what are the difficulties with such a function.

4)what is a ‘strongly typed language ‘what are its advantages

5)whaich of any of the following protypes are invalid

a)set(int *,int);

b)void func();

c)stringf error(int );

d)arr[10]sum(int * , int);

6)explain parameter passinf

a)by value

b)by reference

7)explain parameter passing

a)an array

b)abstract container type

8)what are ellipses explain in detail

9)what are the two forms of return statement explain when you would use each of
them

10)what is recursive function .write a program to compute factorial of a number


using recursive function.

11)what are inline function explain with an eg

12)explain how exceptions are handled in c++

13)explain the following

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

14)write short notes on exception specification and pointer to a function

15)writ a pgm to compute gcd and lcm of 2 integers using functions

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

18)find the nth fibonnii number by recursion

19)write a c++ pgm to swap 2 integers by using call by address.

Unit 4

1)what are friend functions ?develop a c++ pgm to illustrate the bridging between
two classes using friend function.

2)write short notes on

a)this pointer

b)constructor and destructor

3)exlain class constructor and destructor with eg

4)what is the use of constructors what are the different types of constructors
explain.

5)write short notes on

a)clases

b)object

c)data encapsulation

d)polymorphism

6)what do you mean by a class in object oriented programming develop a simple


c++ pgm which implements the concept of a class and generates the output

7)distinguish between a constructor and destructor in oops


NITTE MEENAKSHI INSTITUTE OF TECHNOLOGY
DEPARTMENT OF E AND C
C++ QUESTION BANK
8)using constructor implement a counter pgm which notifies a counter variable that
can be modified only through its member functions and hence explain the
generation of the output

9)explain the use of scope resolution operator with suitable pgm

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

i)initialization and assignment of class objects

ii)constructor and class member function

15)what is the importance of class destructor function write the prototype of the
same

16)explain the following

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

18)explain vector of class objects

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?

Writ an eg program to overload ++ operator

2)what is inheritance ?what are the advantages and disadvantages of inheritance


explain the concept of multiple inheritance and hierarchial inheritance

3)explain the use of overloadind an output operator with an eg pgm

4)what is inheritance explain the advantage of it

5)define operator overloding explain the steps involved in suitable egs

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.

8explain the overloading of I [ ] = ()

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.