PROMOTE MY BLOG: JUST CLICK BELOW BUTTON

Search Any Paper On This Blog

Saturday, December 4, 2010

CS304- Object Oriented Programming Solved Midterm Paper Spring 2010

MIDTERM  EXAMINATION
Spring 2010
CS304- Object Oriented Programming (Session - 2)    
Question No: 1    ( Marks: 1 )    - Please choose one
Which part of an object exhibits its state?
       ► Data       ► Operations       Any public part       ► Any private part

Question No: 2    ( Marks: 1 )    - Please choose one
Inheritance is a way to
       ► organize data.        pass arguments to objects of classes.
       add features to existing classes without rewriting them.
       improve data-hiding and encapsulation.
   
Question No: 3    ( Marks: 1 )    - Please choose one
Suppose you have been given the following design,

"A person has a name, age, address and sex. You are designing a class to represent a type of person called a patient. This kind of person may be given a diagnosis, have a spouse and may be alive".
Given that the person class has already been created, what of the following would be appropriate to include when you design the patient class?
       ► registration date and diagnosis       ► age and sex
       ► sex and diagnosis       ► diagnosis and age
   
Question No: 4    ( Marks: 1 )    - Please choose one
What problem(s) may occur when we copy objects without using deep copy constructor?
       ► Dangling pointer       ► Memory Leakage       All of the given       ► System crash
   
Question No: 5    ( Marks: 1 )    - Please choose one
this pointers are not accessible for static member functions.
       True       ► False
   
Question No: 6    ( Marks: 1 )    - Please choose one
A static member function cannot be declared.
      ► Static       Implicit       ► Explicit       ► Virtual

Question No: 7    ( Marks: 1 )    - Please choose one
 _______ remain in memory even when all objects of a class have been destroyed.
       ► Static variables       ► Instance variable       ► Primitive variables       ► None of given
   
Question No: 8    ( Marks: 1 )    - Please choose one
Friend functions are _____________ functions of a class.
       ► None of given       ► object member       ► non-member       ► data member
   
Question No: 9    ( Marks: 1 )    - Please choose one
___________, which means if A declares B as its friend it does NOT mean that A can access private data of B. It only means that B can access all data of A.
       Friendship is one way only                           ► Friendship is two way only
       ► NO Friendship between classes                 ► Any kind of friendship

Question No: 10    ( Marks: 1 )    - Please choose one
The statement objA=objB; will cause a compiler error if the objects are of different classes.

       ► True       ► False
   
Question No: 11    ( Marks: 1 )    - Please choose one
Identify which of the following overloaded operator function’s declaration is appropriate for the given call?
Rational_number_1 + 2.325
Where Rational_number_1 is an object of user defined class Rational_number.


       ► Rational_number operator+( Rational_number & obj);
       ► Rational_number operator+(double& obj);
       Rational_number operator+(Rational_number &obj, double& num);
       ► operator+(double& obj);
   
Question No: 12    ( Marks: 1 )    - Please choose one
Which operator can not be overloaded?
       ► The relation operator ( >= )       ► Assignment operator ( = )
       ► Script operator ( [] )                      ► Conditional operator (? : )

Question No: 13    ( Marks: 1 )    - Please choose one
To convert from a user-defined class to a basic type, you would most likely use
       ► a built-in conversion operator.        ► a one-argument constructor.
       ► an overloaded = operator.                 ► a conversion operator that’s a member of the class.
   
Question No: 14    ( Marks: 1 )    - Please choose one
 The technique in which we visualize our programming problems according to real life’s problems is called
----------------
       ► structured programming       ► object oriented Programming   
       ► procedural programming       ► non of the given
   
Question No: 15    ( Marks: 1 )    - Please choose one
In object orientated programming, a class of objects cans _____________ properties from another class of objects

       ► Utilize       ► Borrow       ► Inherit       ► Adopt
   
Question No: 16    ( Marks: 1 )    - Please choose one
A C++ class is similar to --------------------

       ► Structure       ► Header File       ► Library File       ► None of the given
   
Question No: 17    ( Marks: 2 )
Can we create an array of objects for a class having user defined constructor? Justify your answer.

   
Question No: 18    ( Marks: 2 )
 Friend functions increase ‘Programming bugs’. What is your opinion?

   
Question No: 19    ( Marks: 2 )
 Explain two benefits of setter functions.

   
Question No: 20    ( Marks: 3 )
 What are binary operators? Give an example of binary operators overloading using any class.
   
Question No: 21    ( Marks: 3 )
 Give c++ code to overload assignment operator for string class.

No comments:

Post a Comment

PLEASE COMMENT ABOUT YOUR VISIT AND MY SITE

Note: Only a member of this blog may post a comment.