PROMOTE MY BLOG: JUST CLICK BELOW BUTTON

Search Any Paper On This Blog

Saturday, July 23, 2011

CS304 Solved FinalTerm Paper 2


FINALTERM  EXAMINATION
CS304- Object Oriented Programming (Session - 3)
Time: 120 min
    
Question No: 1    ( Marks: 1 )    - Please choose one
 Which of the following causes run time binding?

       ► Declaring object of abstract class
       ► Declaring pointer of abstract class
       ► Declaring overridden methods as non-virtual
       ► None of the given
   
Question No: 2    ( Marks: 1 )    - Please choose one
Which of the following is the best approach if it is required to have more than one functions having exactly same functionality and implemented on different data types?

       ► Templates
       ► Overloading
       ► Data hiding
       ► Encapsulation
   
Question No: 3    ( Marks: 1 )    - Please choose one
A copy constructor is invoked when






       a function do not returns by value.
       an argument is passed by value.
       a function returns by reference.
       an argument is passed by reference.
   
Question No: 4    ( Marks: 1 )    - Please choose one
 Like template functions, a class template may not handle all the types successfully.

       ► True
       ► False

   
Question No: 5    ( Marks: 1 )    - Please choose one
   
Question No: 6    ( Marks: 1 )    - Please choose one
 A class template may inherit from another class template.




       ► True
       ► False
   
Question No: 7    ( Marks: 1 )    - Please choose one
By default the vector data items are initialized to ____
       ► 0
       ► 0.0
       ► 1
       ► null

   
Question No: 8    ( 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
       ► abstraction
       ► composition

 
Question No: 9    ( Marks: 1 )    - Please choose one
Which of the following is/are advantage[s] of generic programming?
       ► Reusability
       ► Writability
       ► Maintainability
       ► All of given
   
Question No: 10    ( Marks: 1 )    - Please choose one
Template functions use _________ than ordinary functions.

       ► Greater Memory
       ► Lesser Memory
       ► Equal Memory
       ► None of the given options

Question No: 11    ( Marks: 1 )    - Please choose one
Non Template Friend functions of a class are friends of ________instance/s of that class.

       ► All
       ► One specific
       ► All instances of one date type
       ► None of the given options
 
Question No: 12    ( Marks: 1 )    - Please choose one
A copy constructor is invoked when
       ► a function do not returns by value.
       ► an argument is passed by value.
       ► a function returns by reference.
       ► an argument is passed by reference.
   
Question No: 13    ( Marks: 1 )    - Please choose one
A pointer to a base class can point to objects of a derived class.

       ► True
       ► False

Question No: 14    ( Marks: 1 )    - Please choose one
A template argument is preceded by the keyword ________.
       vector
       class
       template
       type*
Question No: 15    ( Marks: 1 )    - Please choose one
Which one of the following terms must relate to polymorphism?
       Static allocation

       Static typing
       ► Dynamic binding
       Dynamic allocation
    
Question No: 16    ( Marks: 1 )    - Please choose one
Multiple inheritance can be of type

       ► Public
       ► Private
       ► Protected
       ► All of the given

Question No: 17    ( Marks: 1 )    - Please choose one
Assume a class Derv that is privately derived from class Base. An object of class Derv located in main() can access
       ► public members of Derv.
       ► protected members of Derv.
       ► private members of Derv.
       ► protected members of Base.

Question No: 18    ( Marks: 1 )    - Please choose one
A copy constructor is invoked when
       ► a function do not returns by value.
       ► an argument is passed by value.
       ► a function returns by reference.
       ► an argument is passed by reference.

Question No: 19    ( Marks: 1 )    - Please choose one
A function call is resolved at run-time in___________
       non-virtual member function.
       virtual member function.
       Both non-virtual member and virtual member function.
       None of given

Question No: 20    ( Marks: 1 )    - Please choose one
Two important STL associative containers are _______ and _______.

       ► set,map
       ► sequence,mapping
       ► setmet,multipule
       ► sit,mat

Question No: 21    ( Marks: 1 )    - Please choose one
An abstract class is useful when,

       ► We do not derive any class from it.
       ► There are multiple paths from one derived class to another.
       ► We do not want to instantiate its object.
       ► You want to defer the declaration of the class.

Question No: 22    ( Marks: 1 )    - Please choose one
Which of the following is/are advantage[s] of generic programming?

       ► Reusability
       ► Writability
       ► Maintainability
       ► All of given
   
Question No: 23    ( Marks: 1 )    - Please choose one
By default the vector data items are initialized to ____
       ► 0
       ► 0.0
       ► 1
       ► null

Question No: 24    ( Marks: 1 )    - Please choose one
 Suppose you create an uninitialized vector as follows:

vector<int> evec;
After adding the statment,
evec.push_back(21);
what will happen?
       ► The following statement will add an element to the start (the back) of evec and will initialize it with the value 21.
       ► The following statement will add an element to the center of evec and will reinitialize it with the value 21.
       ► The following statement will delete an element to the end (the back) of evec and will reinitialize it with the value 21.
       ► The following statement will add an element to the end (the back) of evec and initialize it with the value 21.
  
Question No: 25    ( Marks: 1 )    - Please choose one
Default constructor is such constructor which either has no ---------or if it has some parameters these have -------- values
       Parameter, temporary
       ► Null, Parameter
       ► Parameter, default
       ► non of the given
 
Question No: 26    ( Marks: 1 )    - Please choose one
Which of the following is the best approach if it is required to have more than one functions having exactly same functionality and implemented on different data types?
       ► Templates
       ► Overloading
       ► Data hiding
       ► Encapsulation

Question No: 27    ( Marks: 1 )
Describe the way to declare a template class as a friend of any class.

   
Question No: 28    ( Marks: 1 )
Classes like TwoDimensionalShape and ThreeDimensionalShape would normally be concrete, while classes like Sphere and Cube would normally be abstract.
       ► True
       ► False

Question No: 29    ( Marks: 1 )
In order to define a class template, the first line of definition must be:

       ► template <typename T>
       ► typename <template T>
       ► Template Class <ClassName>
       ► Class <Template T>
Question No: 30    ( Marks: 1 )
In case of multiple inheritance a derived class inherits,
Only the public member functions of its base classes
Only the public data members of its base classes
Both public data members and member functions of all its base classes
Data members and member functions of any two base classes
  
Question No: 31    ( Marks: 1 )
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
       ► abstraction
       ► composition

   
Question No: 32    ( Marks: 1 )

Which of the following is the best approach if it is required to have more than one functions having exactly same functionality and implemented on different data types?
       ► Templates

       ► Overloading

       ► Data hiding

       ► Encapsulation

Question No: 33    ( Marks: 1 )
If we declare a function as friend of a template class will it be a friend for a particular data type or for all data types of that class.
Question No: 34    ( Marks: 1 )
Question No: 35    ( Marks: 1 )
Question No: 36    ( Marks: 1 )
Question No: 37    ( Marks: 2 )
Write three important features of virtual functions.
Question No: 38    ( Marks: 5 )
There are some errors in the code given below, you have to Indicate the line no. with error/s
Give the reason for error/s
Correct the error/s.

1.      #include <iostream>   
2.      #include <stdlib.h>

3.      using namespace std;
4.      template <typename T>
5.      class MyClass{
6.      public:
7.      MyClass(){
8.      cout<<"This is class1"<<endl;
9.      }
10. };
11. template <typename T>   
12. class MyClass<int*>{
13. public:
14. MyClass(){
15. cout<<"This is class2"<<endl;
16. }
17. };
18. int main(int argc, char *argv[])
19. {
20. MyClass<int> c1;
21. MyClass<int*> c2;
22. system("PAUSE");   
23. return 0;
24. }
Question No: 39    ( Marks: 5 )
What is random iterator? What is its relation with vectors?



By : ADEEL ABBAS 
www.allvupastpapers.blogspot.com 
AdeelAbbasbk@gmail.com

No comments:

Post a Comment

PLEASE COMMENT ABOUT YOUR VISIT AND MY SITE

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