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

 

Subject: OBJECT ORIENTED PROGRAMMING WITH C++

Flowchart: Alternate Process: JUNE 2009Time: 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.  In an object-oriented paradigm, objects are grouped into ______.

 

                  (A) object group                                   (B) classes

                  (C) procedures                                     (D) programs

 

             b. In the iostream C++ library, ______ is the standard input stream taking input from the keyboard.  

 

                  (A) cin                                                  (B) scanf

                  (C) cout                                               (D) cerr

 

             c.  The sizeof() operator accepts ______ parameter.

 

                  (A) no                                                  (B) more than one

                  (C) size                                                (D) one

 

             d.  The _______ statement allows selection among multiple sections of code, depending on the value of an expression.

 

                  (A) if                                                    (B) break

                  (C) switch                                            (D) for

 

             e.  The ______ operator gives the address of the operand.  

 

                  (A) ?                                                    (B) &

                  (C) ++                                                 (D) *

 

             f.   C++ supports_________.  

 

                  (A) only call-by-value                          

                  (B) only call-by-reference

                  (C) both call-by-value and call-by-reference                                                                     

                  (D) call-by-function

 

             g. The ______ operator destroys the object created with operator new.

 

                  (A) old                                                 (B) delete

                  (C) destroy                                           (D) erase


 

             h.  Multiple inheritance allows declaring a derived class or subclass that inherits properties from ___________.  

(A)  only one super class                        (B) member function

                  (C) more than one base class                (D) only one base class

 

             i.   An abstract class contains at least one ________.

 

                  (A) abstract function                             (B) function

                  (C) virtual function                                (D) pure virtual function

 

             j.   The typeid operator allows the type of an expression to be determined at _____.  

 

                  (A) run-time                                         (B) compile-time

                  (C) random                                          (D) error-time

 

 

 

Answer any FIVE Questions out of EIGHT Questions.

Each question carries 16 marks.

 

 

 

  Q.2     a.   What is the difference between procedural programming paradigm and OOP paradigm?                (6)

                  

             b.   What do you mean by lvalue?  List atleast five operators of C++ and state whether they can be lvalue or not.                                                                                                                        (10)

 

  Q.3     a.   What are the five methods for repeating an action in a C++ program?  Write a C++ program to find the sum and average of the given numbers using the while loop.                                                       (10)

            

             b.   What are nested structures?  Define a nested structure Person having name, address and dateOfBirth as members.                                            (6)

 

  Q.4     a.   List the main characteristics of the following:

                   (i)  inline functions                                (ii)  main function                                     (8)

          

             b.   Write both iterative version and recursive version of the C++ program to calculate and display Fibonacci numbers up to N.                                 (8)

          

  Q.5     a.   Define a constructor.  Briefly explain the following types of constructors

                   (i)   default constructor

                   (ii)  copy constructor

                   (iii) overloaded constructors                                                                               (8)

 

             b.   What are the advantages of operator new over malloc function?                          (4)

 

             c.   What is the scope of an identifier?   What is the output of the following C++ program segment?                                                                 (4)

        int a = 10;

{

                      int a = 20;

                      cout<<a<<endl;

                      cout<<::a<<endl;

}

                       cout<<a;


 

  Q.6     a.   Write a C++ program that has a class called POINT which stores coordinates in (x, y) form.  Define constructor, destructor and overload ‘-’ operator to calculate distance between two points.            (10)

 

             b.   What is a cast operator?  Is it possible to have multiple cost operators in a class?  Explain with the help of an example.                                              (6)

 

  Q.7     a.   What is inheritance?  What are the benefits of using inheritance?                          (6)

 

             b.   What is a virtual function? How is it different from pure virtual function?               (4)

 

             c.   What is static binding and dynamic binding of functions? How is dynamic binding achieved in C++?                                                                       (6)                                                             

  Q.8     a.   What are templates?  How are they different from macros?  Write a function template to swap two elements passed to it as arguments.                    (10)

 

             b.   What is an exception?  What are the three language constructs that C++ provides to implement exception handling?  Explain.                               (6)

 

  Q.9     a.   What are steams in C++? What are the advantages of C++ I/O stream class library over C standard I/O library?                                                                                                              (6)

 

             b.   What is a standard template library (STL)?  Briefly explain sequence containers and associative containers.                                                           (10)