Search Papers On This Blog. Just Write The Name Of The Course

Saturday 4 December 2010

MIDTERM EXAMINATION Solved Paper Of CS304- Object Oriented Programming

Question No: 1    ( Marks: 1 )    - Please choose one
No instances can be created from an abstract class.
       ► True       ► False
   
Question No: 2    ( Marks: 1 )    - Please choose one
Aggregation is implemented using pointer.
       ► True       ► False
   
Question No: 3    ( Marks: 1 )    - Please choose one
Your chief Software designer has shown you a sketch of the new Computer parts system she is about to create. At the top of the hierarchy is a Class called Computer and under this are two child classes. One is called LinuxPC and one is called WindowsPC. The main difference between the two is that one runs the Linux operating System and the other runs the Windows System (of course another difference is that one needs constant re-booting and the other runs reliably). Under the WindowsPC are two Sub classes one called Server and one Called Workstation. How might you appraise your designers work?
       ► Give the goahead for further design using the current scheme
       ► Ask for a re-design of the hierarchy with changing the Operating System to a field rather than Class type
       ► Ask for the option of WindowsPC to be removed as it will soon be obsolete
       ► Change the hierarchy to remove the need for the superfluous Computer Class.
   
Question No: 4    ( Marks: 1 )    - Please choose one
The ______ keyword tells the compiler to substitute the code within the function definition for every instance of a function call.
       virtual       ► inline       instance       None of given.
   
Question No: 5    ( Marks: 1 )    - Please choose one
   Which construct is the source for the creation of an object?
       ► Destructor of the class       ► New operator       ► Delete operator       ► Constructor of the class
   
Question No: 6    ( Marks: 1 )    - Please choose one
Which will be the good example of a method that is shared by all instances of a class?
       ► Constructor       ► Attribute       ► Constructor and Attribute       ► None of given options
   
Question No: 7    ( Marks: 1 )    - Please choose one
__________ provide the facility to access the data member.
       ► accesser function        ► private function       ► inline function        ► None of the given
Question No: 8    ( Marks: 1 )    - Please choose one
A static member function cannot be declared.
       ► Static       ► Implicit       ► Explicit       ► Virtual
   
Question No: 9    ( Marks: 1 )    - Please choose one
A non-static member function can be called only after _______ the class as an object.
       Instantiating       Declaring       Defining       Opening
   
Question No: 10    ( Marks: 1 )    - Please choose one
Static variable is created even when there is no object of a class is created.
       ► True       ► False
   
Question No: 11    ( Marks: 1 )    - Please choose one
In _______________ a pointer or reference to an object is created inside a class.
       ► Aggregation        ► Composition       ► Separation       ► None of the given
   
Question No: 12    ( Marks: 1 )    - Please choose one
Friend class and friend function can be used as an alternate to each other
       ► True       ► False
   
Question No: 13    ( Marks: 1 )    - Please choose one
Constructor/s with a different signature than default constructor is/are called?
       ► Overloaded Constructor/s         ► Default Constructor/s
       ► Simple Constructor/s                            ► Multiple Constructor/s
Question No: 14    ( Marks: 1 )    - Please choose one
Operator overloading is
       ► making C++ operators work with objects.        ► giving C++ operators more than they can handle.
       ► giving new meanings to existing Class members.        ► making new C++ operators.
   
Question No: 15    ( 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: 16    ( Marks: 1 )    - Please choose one
Which operator can not be overloaded?
       ► The relation operator ( >= )                   ► Assignment operator ( = )
       ► Script operator ( [] )                              ► Conditional operator (? : )
Question No: 17    ( Marks: 1 )
Give two examples of binary operators.

Question No: 18    ( Marks: 1 )
Give one line definition of "Model".

A model is an abstraction of something real or conceptual.

Question No: 19    ( Marks: 2 )
Write a statement that a member function can use to return the entire object of which it is a member, without creating any temporary objects.

Following staement can return the entire object of which it is a member.Member function is a function which is declared in the public part of class.

Question No: 20    ( Marks: 3 )
Give example c++ code to overload unary ‘ ++ ‘ operator for complex numbers class.

Code:


Question No: 21    ( Marks: 5 )
 Describe base and derived class’s relationship with at least two examples.
Any parent class is called the base class. And the class that is derived from it is its child class and called as Derived class. Examples are given:



No comments:

Post a Comment