Wednesday, 8 February 2012

CS304 Final Term Past Solved Paper (4)


FINAL TERM EXAMINATION
Spring 2010
CS304- Object Oriented Programming (Session - 4)

Question No: 1    ( Marks: 1 )    - Please choose one
Classes like TwoDimensionalShape and ThreeDimensionalShape would normally be concrete, while
classes like Sphere and Cube would normally be abstract. 
       ► True         Click here for detail      rep
       ► False
Question No: 2    ( Marks: 1 )    - Please choose one
Virtual functions allow you to 
       ► create an array of type pointer-to-base class that can hold pointers to derived classes. 
       ► create functions that can never be accessed. 
       ► group objects of different classes so they can all be accessed by the same function code. 
       ► use the same function call to execute member functions of objects from different
classes (Object-Oriented Programming in C++)    
Question No: 3    ( Marks: 1 )    - Please choose one  
       ► True      Click here for detail     rep
       ► False
Question No: 4    ( Marks: 1 )    - Please choose one
A copy constructor is invoked when
       ► a function do not returns by value. 
       ► an argument is passed by value.      (Page 78)  rep
       ► a function returns by reference. 
       ► an argument is passed by reference. 
    
Question No: 5    ( Marks: 1 )    - Please choose one
Each try block can have ______ no. of catch blocks.
       ► 1
       ► 2
       ► 3
       ► As many as necessary.     Click here for detail       rep
Question No: 6    ( Marks: 1 )    - Please choose one
Non Template Friend functions of a class are friends of ________instance/s of 
       ► All       Click here for detail     rep
       ► One specific
       ► All instances of one date type
       ► None of the given options
 Question No: 7    ( Marks: 1 )    - Please choose one
Template functions use _________ than ordinary functions.
       ► Greater Memory
       ► Lesser Memory
       ► Equal Memory
       ► None of the given options
  
    
Question No: 8    ( Marks: 1 )    - Please choose one
The find() algorithm 

       ► finds matching sequences of elements in two containers. 
       ► finds a container that matches a specified container. 
       ► takes iterators as its first two arguments.      (Object-Oriented Programming in C++)
       ► takes container elements as its first two arguments. 
Question No: 9    ( Marks: 1 )    - Please choose one
The copy() algorithm returns an iterator to 
       ► the last element copied from. 
       ► the last element copied to. 
       ► the element one past the last element copied from. 
       ► the element one past the last element copied to.      (Object-Oriented Programming in
C++)
    
Question No: 10    ( Marks: 1 )    - Please choose one
If you define a vector v with the default constructor, and define another vector w with a one-argument
constructor to a size of 11, and insert 3 elements into each of these vectors with push_back(), then
the size() member function will return ______ for v and _____ for w. 

       ►  11 for v and 3 for w. 
       ► 0 for v and 0 for w. 
       ► 0 for v and 3 for w. 
       ►  3 for v and 11 for w. (Object-Oriented Programming in C++)
Question No: 11    ( Marks: 1 )    - Please choose one
Which is not the Advantage of inheritance?
       ► providing class growth through natural selection.     (Object-Oriented Programming in C++)
       ► facilitating class libraries. 
       ► avoiding the rewriting of code. 
       ► providing a useful conceptual framework. 

    
Question No: 12    ( Marks: 1 )    - Please choose one
class DocElement
{
public:
      virtual void Print() { cout << "Generic element"; }
};
class Heading : public DocElement
{
public:
      void Print() { cout << "Heading element"; }
};
class Paragraph : public DocElement
{
public:
      void Print() { cout << "Paragraph element"; }
};
void main()
{
      DocElement * p = new Paragraph();
      p->Print();
}
When you run this program, it will print out a single line to the console output.
What will be in that line? 
Select one correct answer from the following list:
       ► Generic element 
       ► Heading element 
       ► Paragraph element 
       ► Nothing will be printed.
 Question No: 13    ( Marks: 1 )    - Please choose one
Which type of inheritance is being represented by the following statement, 
class X : public A, public B { ... ... };  
       ► Single inheritance
       ► Multiple inheritance       (Page 41)
       ► Double inheritance
       ► None of the given options
Question No: 14    ( Marks: 1 )    - Please choose one
When we write a class template the first line must be:
       ► template < class class_name>
       ► template < class data_type>
       ► template < class T >      (Page 257)
Here T can be replaced with any name but it is preferable.
       ► class class-name()
class template<class_name>
    
Question No: 15    ( Marks: 1 )    - Please choose one
Function templates should be used where code and behavior must be identical.
       ► True   (Page 262)
       ► False 
Question No: 16    ( Marks: 1 )    - Please choose one
Which of the following is/are advantage[s] of generic programming?
       ► Reusability
       ► Writability
       ► Maintainability
       ► All of given       (Page 256)  rep
Question No: 17    ( Marks: 1 )    - Please choose one
The specialization pattern <T*> after the name says that this specialization is to be used for every, 
       ► data type
       ► meta type
       ► virtual type
       ► pointer type     (Page 286)
Question No: 18    ( Marks: 1 )    - Please choose one
A range is often supplied to an algorithm by two _______ values. 
       ► italic
       ► iteration     (Object-Oriented Programming in C++)
       ► iterator
       ► None of given 
Question No: 19    ( Marks: 1 )    - Please choose one
Which of the following is an integral part of an object?
       ► State
       ► Behavior
       ► Unique identity
       ► All of the given     (Page 12)
Question No: 20    ( Marks: 1 )    - Please choose one
Consider the following statement
Cupboard has books
What is the relationship between Cupboard and books?
       ► Composition
       ► Aggregation
       ► Inheritance
       ► None of the given options
Question No: 21    ( Marks: 1 )    - Please choose one
Which sentence clearly defines an object?
       ► one instance of a class.      (Page 23)
       ► another word for a class.
       ► a class with static methods.
       ► a method that accesses class attributes.
Question No: 22    ( 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       Click here for detail
       ► Friendship is two way only
       ► NO Friendship between classes
       ► Any kind of friendship
Question No: 23    ( Marks: 1 )    - Please choose one
The statement objA=objB; will cause a compiler error if the objects are of different classes. 
       ► True
       ► False    (Object-Oriented Programming in C++)
Question No: 24    ( Marks: 1 )    - Please choose one
Consider the call given below of an overloaded operator "+",
Rational_number_1 + Rational_number_2
Where Rational_number_1 and Rational_number_2 are the two objects of Rational_number class (a
user defined class). Identify which of the above two objects will be passed as an argument to the
overloaded operator function?
       ► Rational_number_1
       ► Rational_number_2
       ► Both Rational_number_1 & Rational_number_2
       ► any of the two objects, randomly
Question No: 25    ( Marks: 1 )    - Please choose one
If a class D has been derived using protected inheritance from class B (If B is a protected base and D is derived class) then public and protected members of B -------- accessed by member functions and friends of class D and classes derived from D
       ► can be        Click here for detail
       ► cannot be
       ► does restirct to be
       ► not given
Question No: 26    ( Marks: 1 )    - Please choose one
In Private --------------  only member functions and friend classes or functions of a derived class can convert pointer or reference of derived object to that of parent object
       ► specialization
       ► inheritance       (Page 216) rep
       ► abstraction
       ► composition 

No comments:

Post a Comment