C++ PROGRAMMING QUESTIONS PAPER


                              C++ PROGRAMMING QUESTIONS PAPER

TIME: 3 HOURS                                                                                               Max. Marks: 100
                                                  Answer all questions                                
                                                           PART-A                                    (10 X 2 = 20 Marks)
1.      Find error if any in the following C++ statement.
i)cout<<”x=”x;  ii)cin>>x;>>y; iii)cout<<\n”Name:”<<name;
2.      What is object oriented programming?
3.      When will you make a function inline? Why?
4.      Can we have more than one constructor in a class? If yes, explain the need for such a situation.
5.      How do the properties of the following two derived class differ?
class CSE:private B{//…….};
class CSE:public B{//…..};
6.      How is polymorphism achieved at i) c66ompile time ii) run time?
7.      What is the basic difference between manipulators and ios member functions in implementation? Give example
8.      How do the following two statements differ in operation?
            cin>>c;
            cin.get(c);
9.      Both ios::ate and ios::app place the file pointer at the end of the file (when it is opened).what then, is the difference between them.
10.  What are the steps involved in using a file in a C++ program?


                                                                    PART-B                                       (5 X 4 = 20 Marks)
11.  a) ) Illustrate how data and functions are organized in object oriented program, with the help of a clear block diagram.
(OR)
11 b) what are the unique advantages of an object oriented programming paradigm.
12. a) write a C++ program with a function using reference variables as arguments to swap the values of a pair of integers.

                                                            (OR)
12.b) . Write a C++ program to show how the unary minus operator is overloaded.                  
13. a) Explain briefly with a suitable C++ program why do we need virtual functions?
.
                                                            (OR)
13b) With a clear diagram briefly explain the concept of virtual base classes.
14a) Write a function template that will swap two values of a given type of data.
                                                            (OR)
14b) Write a suitable C++ program to implement the concept of Class Template
15a) )Write any C++ program with functions and  exception handling mechanism?                                    (OR)
15b) . What is file mode? Describe the various file mode options available.


                                                                   
   PART – C                                 (5 x 12 = 60 marks)
16.a) With a suitable C++ program describe the mechanism of accessing data members and member functions in the following cases:
i) Inside the main program
ii) Inside a member function of the same class.
iii) Inside a member function of another class
                                                             (OR)
16. b) Write a c++ program to implement the concept of function overloading for finding the volume of any four regular polygons.

17 a) Assume that a bank maintains two kinds of accounts for customers, one called as savings account and the other as current account. The savings account provides compound interest and withdraws facilities but no check book facility. The current account provides cheque book facility but no interest. Current account holders should maintain a minimum balance and if the balance falls below this level, a service charge is imposed.
            Create a class account that stores customer name, account number and type of account. From this derive the classes’ cur_acct and sav_acct make them more specific to their requirements. Include necessary member functions in order to achieve the following tasks:
        i.            Accept deposit from a customer and update the balance
      ii.            Display the balance
    iii.            Compute and deposit interest.
    iv.            Permit withdrawal and update the balance
      v.            Check for the minimum balance, impose penalty, if necessary, and update the balance. Do not use any constructors. Use member functions to initialize the class members.
                                                                       
                                                             (OR)                                                               
17b)  Modify the program of Qn 17a) above to include constructors for all the three classes.

18a )with a sample C++ Program show how you can add two complex numbers by overloading a binary operator with and without using a friend function.
                                                            (OR)
18b) Create a base class called Shape. Use this class to store two double type values that could be used to compute the area of figures. Derive two specific classes called triangle and rectangle from the base shape. Add to the base class, a member function get_data() to initialize base class data members and another member function display_area() to compute and display the area of figures. Make display_area() as virtual function and redefine this function in derived classes to suit their requirements.
            Using these classes design a program that will accept dimensions of a triangle or rectangle interactively and display the area. Remember the two values given as input will be treated as length of two sides in the case of rectangle and as base height in the case of triangle and used as follows:      Area of rectangle=x*y                      Area of triangle=1.5*x*y

19.a) Discuss the syntax for creating user-defined manipulators. Design a single manipulator to provide the following output specifications for printing float values:
        i.            10 columns width
      ii.            Right justified
    iii.            Two digits precision\
    iv.            Filling of unused places with * and Trailing zeros shown

                                                           (OR)
19b) Briefly with a sample C++ program explain about the following Stream Class member functions: i) put()     ii) get()     iii) getline()     iv)write()


20a) ) i) Write a c++ program to draw a circle, a line and rectangle using C++ graphics concepts.
                                                                                                                                    (6marks)
        ii)  Explain the following C++ graphics functions: window(), initgraph(),gotoxy().
(6 marks)

                                                            (OR)
20b) A file contains a list of telephone numbers in the following form:
                        John                 23456
                        Ahmed             9876
                        ……..               ……
The names contain only one word and the names and telephone numbers are separated by white spaces. Write a C++ program to read the file and output the list in two columns. The names should be left-justified and the numbers right-justified. 

      

0 Comment "C++ PROGRAMMING QUESTIONS PAPER"

Post a Comment