CPP

Cpp question Bank


Unit 1 :-Introduction to C++
1.List any 4 features of OOP’s
2.Define the following terms Class ,Encapsulation
3.Difference between C and C++
4.Explain the structure of a c++ program with example
5.Define abstraction
6.Difference between POP  and OOP’s
7.What is object with example.
8.Enlist user defined data types in c++
9.Define Dynamic binding ,Message Passing

Unit 2:-Tokens ,Expressions and Control Structures
1.What is Function overloading
2.What is cascading of I/O operator
3.What task is performed by self() and precision()
4.What is the purpose of setw and endl?
5.What is reference variable?
6.Explain memory management operators with example.
7.Write a note on implicit and explicit type conversion.
8.What is Dereferencing operator?
9.Explian the use of new and delete operator with the help of example
10.Diffrence between memory management in c and c++
11.Explain break,continue statements.

Unit 3:-Functions in C++
1.List the ways to define a constant ?
2.Describe various uses of scope resolution operator.
3.When do we need to use Default argument in a function ?Explain with example
4.Define const member function
5.List the situations where inline function doesn’t work
6.What is inline function
7.Explain use of default argument in a function with example
8.What is need of call reference ?  Explain with example
9.What is scope resolution operator? give its syntax and explain any one application of it with example.
10.WAP to calculate square and cube of a integer number by using inline function.
11.WAP to calculate area and circumference of a circle using inline function.
12.WAP to create a class worker with data members as wname,no-of-hours-worked,pay-rate.Write
 .Necessary member functions to calculate and display the salary of worker.(Use  default value for pay-rate)
13.WAP to calculate  area and perimeter of a rectangle (default argument)
14.WAP which consist a function to find out the rate of interest with default arguments.
15.WAP to perform multiplication and division operation on 2 integer numbers by using inline function.
16.What is return by reference?

Unit 4:-Classes and Objects
1.Difference between constructor and destructor
2.What is friend function? Write characteristics of friend function
3.Explain parameterized and Dynamic constructor with suitable example.
4.Is there a need to call a constructor function explicitly? justify
5.Write a note on static data member
6.What is constructor? Explain default constructor and copy constructor
7.Define constructor
8.Explain parameterized constructor with suitable example.
9.Explain the different ways to define member  function of a class with example
10.Write a note on static data members.Explian copy constructors with example
11.Give the general format of class and state the significance of private, public ,protected  access specifiers
12.Justify:”constructors can have different name as the class.”
13.Difference between default and parameterized constructor
14.WAP to create a class product which contains data members as P-Name,P-Price,Quantity .Write a member functions to accept quantity for each product and accordingly generate & display bill.
15.WAP to create a class ‘space’ that contains x,y,z as integer data members. Write necessary definition to use copy constructor to copy one object to another(Use Default and parameterized constructor to initialize the appropriate objects).
16.WAP to a class which contains function display().Write a program to count number of times display() function is called(static data member).
17.Design a class student.Include data members rollno,name,city & age Write member function
1)to accept information of ‘n’ students
2)to display information of ‘n’ students
3)to search details of a student using roll-no(Use array of objects)
18.Create a class student having the following members:-Roll no, Name, Percentage
.Write a necessary member function to accept student details and display details along with class obtained depending on percentage
19.WAP to create a class book(bname,author,price)Write necessary member functions to accept and display details of 3 books.Also display book having maximum price(use array of object)
21.WAP to class Maximum to perform following function as:
1)int max(int,int)
2)int max(int[],int)
22.Explain array of object with diagram.
23.WAP using friend function to calculate sum of digits of a number.

Unit 5:-Inheritance
1.Write the syntax to define a derived class from base class
2.When do we make a class virtual base class? Explain it with suitable example
3.List types of inheritance
4.Define inheritance.Explain the visibility scope of private ,public,protected access specifiers.
5.What is abstract class
6.Explain virtual base class with example.
7.What is inheritance?state its advantages.
8.Design two base classes personnel(Name,Address,Email,Birthdate) and Academic(marks-in-tenth,marks-in-twelth,class-obtained)Derive a class Biodata from these classes WAP to prepare a biodata of a student having personnel and Academic information.
9.Design a base class customer(name,phone-no)Derive a class depositor (accno,bal)from customer.Again derive a class borrower(loanno,aloan-amt) from depositor .Write necessary member fumction to read and display the details of n numbers.
10.Design  a base class person(name,address,phone no).Derive a class employee(eno,ename)from person.Derive a class manager(designation,department,basic salary)from employee.Accept all details of n managers and display manager havig highest salary.
11.Create a base class student(rollno,name)which derives 2 classes test(mark1,mar2),sport(score).class result(total_marks,grade)inherits both test and sport classes.WAP to calculate total_marks,percentage and to display marksheet.   

Unit 6:- Polymorphism
1.Define pure virtual function
2.Define polymorphism ?Explain its types.
3.What is operator overloading? List the operators that cannot be overloaded in c++?Why is it necessary to overload an operator?
4.What is this pointer?
5.What is function overloading ?write the steps to find unique match during compilation
6.What are the rules for defining virtual function
7.Explain rules of operator overloading.
8.What is generic pointer
9.Explain pointer to object with example
10.Explain the functions used for manipulation of file pointers.
11.Explain with suitable example operator overloading for unary operators using friend function.
12.What is function overloading? give example
13.WAP to create class time which contains data members as Hours,minutes,seconds .Using       operator overloading for the following.
1)==to check whether two times same or not
2)>> to accept time
3)<< to display time.
14.WAP to create a base class increment.Write necessary member function to overload the operator unary pre & post increment ‘++’ for an integer number.
15.WAP to calculate area of rectangle and triangle using function overloading.
16.WAP to calculate area of rectangle ,circle and triangle using function overloading.
17.Define class string using operator overload “==” to compare 2 strimgs.
18.  class Matrix
{
Int M[3][3];
public:
}
19.    Write necessary member function to accept and display matrix.Also write member function to overload “*”(M3=M1*M2).
20.What is this pointer?


Unit 7:-Managing console I/O Operations
1.fin.seekg(0,ios::beg);
2.fin.seekg(-m,ios::end);
3.Explain various Stream classes used to perform console input /output operations.
4.What is a stream ?Enlist various stream classes
5.What is free store operator? List free store operators.
6.Explain any 4 unformatted Input/output functions.
7.What is fstream ?
8.Explian use of setfill() and setiosflags()manipulators with the help of suitable example
9.What is the difference between cin & getline()?
10.What is sream concept in c++
11.Write seekg()function to:
1)move get pointer 10 bytes backword from end of file.
2)move get pointer to start of file.
12.What will be the output of the following:-
13.Cout<<setw(10)<<setfill(‘*’)<<12345

Unit 8:- Working with Files
1.Explain various error handling functions used during file operations.
2.Define eof ()
3.Define file Explain different ways to open a file
4.Write two-way for opening a file in c++
5.List various classes available for file operations.
6.Write a C++ program to read the contents of a text file. Count and display number of        characters, words and lines from a file. Find the number of occurrences of a given word  present in  a file.
7.Write a C++ program to read the contents of a “abc.txt” file. Write all even numbers in even.txt and odd numbers in odd.txt .Display contents of both the files.
8.WAP to display the contents of a text file in the reverse order.
9.WAP to display number of vowels present in a given file.
10.WAP to read characters from a file.Create one file to store all uppercase characters and another file to store  all lowercase characters . also display contents of both files.
11.WAP to copy the content of one file to another file.

Unit 9:-Templates
1.What is function template?
2.What is exception ?Explain how exception is handled in c++
3.What is class template
4.Write a note on exception handling
5.Explain in which circumstances catch() statement would be used
6.What do you mean by function template? Write a function template for bubble sort
7.Explain the use of the following with syntax:-try,catch,throw
8.WAP to calculate sum of Integer & Float array elements of size (5)by using function template.
9.WAP to find maximum of 2 integer numbers by using function template.
10.WAP to swap 2 integers using function template