AMIETE – CS/IT (NEW SCHEME)      Code: AC55/AT55

 

Subject: OBJECT ORIENTED PROGRAMMING WITH C++

Flowchart: Alternate Process: DECEMBER 2009
 


Time: 3 Hours                                                                                                     Max. Marks: 100

 

NOTE: There are 9 Questions in all.

·      Question 1 is compulsory and carries 20 marks. Answer to Q. 1 must be written in the space provided for it in the answer book supplied and nowhere else.

·      Out of the remaining EIGHT Questions answer any FIVE Questions. Each question carries 16 marks.

·      Any required data not explicitly given, may be suitably assumed and stated.

 

 

 

Q.1       Choose the correct or the best alternative in the following:                                  (210)

                

             a.  The following C++ codes results in

                  #include "iostream.h"

                  void main(void)

                  {

                  cout<< (int i=5) << (int j= 6);

                                                                                                                                                         }

 

 

                  (A) compilation error                            (B) run time error

                  (C) link time error                                 (D) none of the above

 

             b. C++ was originally developed by   

 

                  (A) Clocksin and Mellish                      (B) Donald E. Knuth

                  (C) Sir Richard Hadlee                         (D) Bjarne Stroustrup

 

             c.  A constructor is called whenever

 

                  (A) an object is declared                       (B) an object is used

                  (C) a class is declared                           (D) a class is used

 

d.    The declaration int x; int &p =x; is same as the declaration int x, *p; p = &x;

                                                                                                                                      This remark is

 

                  (A) true                                                (B) false

                  (C) sometimes true                               (D) none of the above

 

             e.  Which of the following is not a storage class supported by C++  

 

                  (A) register                                           (B) auto

                  (C) mutable                                          (D) dynamic

 

             f.   The compiler identifies a virtual function to be pure  

 

                  (A) by the presence of the keyword pure                                                                          

                  (B) by its location in the program

                  (C) if it is equated to 0                         

                  (D) none of the above

 

             g. The fields in a structure of a C program are by default  

 

                  (A) protected                                       (B) public

                  (C) private                                            (D) none of the above

 

             h.  Overloading is otherwise called as  

 

(A)  virtual polymorphism                       (B) transient polymorphism

                  (C) pseudo polymorphism                     (D) ad-hoc polymorphism

 

             i.   A function abc is defined as

                              void abc(int x=0, int y=0)

{ cout<< x << y ;}

                  which of the following function calls is/are illegal? ( Assume h, g are declared as integers )

 

                  (A) abc();                                             (B) abc(h);

                  (C) abc(h,h);                                        (D) None of the above

 

             j.   For a method to be an interface between the outside world and a class, it has to be declared  

 

                  (A) private                                            (B) protected

                  (C) public                                             (D) external

 

 

 

Answer any FIVE Questions out of EIGHT Questions.

Each question carries 16 marks.

 

 

 

  Q.2     a.   Explain the benefits of object orientation.                                                            (8)

                  

             b.   Explain the following terms:

                   (i)   Encapsulation                                (ii)   Abstraction

                   (iii) Inheritance                                     (iv)  Polymorphism                                  (8)

 

  Q.3     a.   Write a program in C++ which generates the following pattern:

 

                                    5          5          5          5

                                    4          4          4          4

                                    3          3          3

                                    2          2

                                    1                                                                                                       (6)

            

             b.   Differentiate between Array and Structure.                                                         (4)

 

             c.   Write a C++ program to insert an element into an array.                                     (6)

 

  Q.4     a.   What is inline function? Give an example.                                                            (4)

 

             b.   Explain scope resolution operator :: and its application in C++.                            (6)

 

             c.   Define recursion. Write a program which calculates the sum of the series 1+2+3+…..+ n using recursion.                                                               (6)

 

  Q.5     a.   How do we create a constructor with default argument?                                      (6)

                  

             b.   What are the various access levels used in the declaration of classes?                  (6)

 

             c.   Write a program in C++ that defines a class called person with data members name and age.                                                                   (4)

       

  Q.6     a.   Differentiate between member functions and friend functions.                               (4)

 

             b.   List the operators in C++ which cannot be overloaded.                                       (4)

 

             c.   Write a program that has a class called POINT which stores coordinates in     (x, y) form.  Define constructor, destructor and overloaded ‘-’ operator to calculate distance between two points.        (8)  

 

  Q.7     a.   Differentiate between public and private inheritance.                                            (8)

 

             b.   Write a program to find whether three given numbers A,B and C passed through command line arguments form Pythagorean triplets or not.  The program should take command line arguments and through a function call check whether they form Pythagorean triplets or not.                                    (8)

 

  Q.8     a.   Define a template. Can a template function be overloaded? If yes, explain how.                 (7)

             b.   Create generic functions that return the mean, median and mode of an array

                   of values.                                                                                                           (9)

 

  Q.9     a.   Explain the components of STL.                                                                         (8)

       

             b.   What are the different forms of get() functions of istream class?  Illustrate the uses by citing proper examples.                                                                                                                         (8)