Skip to main content

Object Oriented Programming Guess Paper

FINALTERM EXAMINATION
Object Oriented Programming
Please join us on facebook.com/vubest
Time: 120 min
Total Question 52



1.    Which of the following causes run time binding?
?  Declaring object of abstract class
?  Declaring pointer of abstract class
?  None of the given
Answer: Declaring overridden methods as non-virtual


2.    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 (Page 256)
? Overloading
? Data hiding
? Encapsulation
Answer: Templates


3.    A copy constructor is invoked when
?  a function do not returns by value.
?  a function returns by reference.
?  an argument is passed by reference.
Answer: an argument is passed by value.


4.    Like template functions, a class template may not handle all the types successfully.
?  True (Page 258)
?  False
Answer: True

5.    A class template may inherit from another class template.
?  True (Page 288)
?  False
Answer: True
6.    By default the vector data items are initialized to ____
?  0.0
?  1
?  null
Answer: 0
7.    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)
?  abstraction
?  composition
Answer: inheritance
8.    A template argument is preceded by the keyword ________.
       ?    vector
       ?   class
       ?   template
       ?   type*
Answer: Vector

9.    Which of the following causes run time binding?
       ?   Declaring object of abstract class
       ?   Declaring pointer of abstract class
       ?   Declaring overridden methods as non-virtual
Answer: None of the given

10. A function template can not be overloaded by another function template.
         ?   True
         ?   False
Answer: False

11. 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
Answer: Overloading

12. Non Template Friend functions of a class are friends of ________instance/s of that class.
?  One specific
?  All instances of one date type
?  None of the given options
Answer: All


13. Identify the correct way of declaring an object of user defined template class A for char type members?
       ?
       ?
        ?    A obj;
       ?   Obj A;
Answer: A Obj; 
14. Which one of the following terms must relate to polymorphism?
?  Static allocation
?  Static typing
?  Dynamic binding (Page 239)
?  Dynamic allocation
Answer: Dynamic binding


15. The user must define the operation of the copy constructor.
       ?    True
       ?   False
Answer: True


16. Template functions use _________ than ordinary functions.
       ?   Greater Memory
       ?    Lesser Memory
       ?   Equal Memory
       ?   None of the given options
Answer: Less Memory           


17. The find() algorithm
       ?   finds matching sequences of elements in two containers.
       ?   finds a container that matches a specified container.
       ?   takes container elements as its first two arguments.

Answer: takes iterators as its first two arguments.

18. Compiler performs ________ type checking to diagnose type errors,
       ?   Static
       ?   Dynamic
       ?   Bound
       ?   Unbound
Answer: Static

19. Which of the following is/are advantage[s] of generic programming?
       ?   Reusability
       ?   Writability
       ?   Maintainability
       ?   All of given
Answer: All of the Given

20. Vectors contain contiguous elements stored as a[an] ___.
       ?   variable
       ?   array
       ?   function
       ?   datatype
Answer: Array

21. Suppose you create an uninitialized vector as follows:
vector 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.

Answer:
The following statement will add an element to the end (the back) of evec and initialize it with the value 21.



22. In a de-queue, (chose the best option) 
       ?   data can be quickly inserted or deleted at any arbitrary location.
       ?   data can be inserted or deleted at any arbitrary location, but the process is relatively slow.
       ?   data can not be quickly inserted or deleted at either end.
Answer:  data can be inserted or deleted at either end, but the process is relatively slow.

 
23. Algorithms can only be implemented using STL containers.
       ?   True
       ?   False
Answer: False

24. What is a class?
       ?   A class is a section of computer memory containing objects.
       ?   A class is a section of the hard disk reserved for object oriented programs
       ?   A class is a description of a kind of object.

Answer:  A class is the part of an object that contains the variables.


25. Inheritance is a way to

       ?   organize data.
       ?   pass arguments to objects of classes.
       ?   improve data-hiding and encapsulation.
Answer: add features to existing classes without rewriting them.


26. We can use "this" pointer in the constructor in the body and even in the initialization list of any class if we are careful,
         ?   True
       ?   False
Answer: True


27. ________ and ______ methods may not be declared abstract. 
      ?   private,static
       ?   static,public
       ?   none of given
Answer: private,public

28. Default constructor is such constructor which either has no ---------or if it has some parameters these have -------- values
       ?   Parameter, temporary
       ?   Null, Parameter
       ?   non of the given
Answer: Parameter, default


29. Public methods of base class can --------- be accessed in its derived class
       ?   directly
       ?   indirectly
       ?   simultaneously
       ?   non of the given
Answer: Directly

30. In order to define a class template, the first line of definition must be:
?  typename <template T>
?  Template Class <ClassName>
?  Class <Template T>
Answer: template <typename T>


31. The type that is used to declare a reference or pointer is called its ---------
       ?   default type
       ?   static type
       ?   abstract type
       ?   reference type
Answer: Reference type

32. _______ members are somewhere between public and private members. They are used in inheritance
       ?   protected
       ?   public
       ?   private
       ?   global
Answer: Protected

33. 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. (Object-Oriented Programming in C++)
?  protected members of Derv.
?  private members of Derv.
?  protected members of Base.
Answer: public members of Derv.


34. Which of these are examples of error handling techniques ?
       ?   Abnormal Termination
       ?   Graceful Termination
       ?   Return the illegal
       ?   all of the given
Answer: All of the given

35. _________follow try block to catch the object thrown
       ?   catch block
       ?   throw block
       ?   main block
       ?   non of the given
Answer: catch block

36. Graphical representation of the classes and objects is called object model it shows -------
       ?   Class Name only
       ?   Class Name and attributes
       ?   Relationships of the objects and classes
       ?   all of the given
Answer: All of the given

37. Destructor can be overloaded
       ?  True
        ?  False
Answer: False

38. A copy constructor is invoked when
?  a function do not returns by value.
?  a function returns by reference.
?  an argument is passed by reference.
Answer: an argument is passed by value


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


40. Question No: 20 ( Marks: 1 ) - Please choose one Two important STL associative containers are _______ and _______.
?  set, map (Object-Oriented Programming in C++)
?  sequence, mapping
?  setmet, multipule
?  sit, mat
Answer: set, map


41. 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. (Object-Oriented Programming in C++)
?  You want to defer the declaration of the class.
Answer: We do not want to instantiate its object.


Template templatename
Class calssname
{
Friend void friend templatename (classname astric const prt classname);
}
Facebook.com/vubest
43 .  Consider the code below, Facebook.com/vubest

template
class T1 {
    public:
    T i;
    protected:
    T j;
    private:
    T k;
    friend void Test();
    };
   
Answer:-
Facebook.com/vubest

public:
    T i;
    protected:
    T j;




Download This Paper






--------------------------------------------------------------------------------------------------
Join Our Groups
http://groups.google.com/group/vubest
http://facebook.com/groups/vubest

Show your LOVE Please Like us on facebook
Click Thumbs Up

Download This Paper

Comments

Popular posts from this blog

Drupal Answers Weekly Newsletter - Wednesday, December 31, 2014

Top new questions this week: Can I delete old hook_update_N functions? Suppose you have a custom module, and you have hook_update_N() implementations in your .install file. If you have old update functions, and all updates have run in all sites that the module is ... node-update hook-update-n   asked by AyeshK ...

[New post] 8th Class Result 2014 PEC Hafizabad Board

Muhammad Waqas posted: "PEC Hafizabad Board 8th Class Result 2014 expected date is 28th March, 2014 by PEC. Punjab Examination Commission (PEC) will announce 8th class result for Hafizabad Board soon and all the students of Hafizabad Board who are extremely waiting for the resul" New post on Jobs in Pakistan 8th Class Result 2014 PEC Hafizabad Board by Muhammad Waqas ...

[New post] 1st Year (11th Class) Result 2014 BISE Rawalpindi Board

Xaib Aslam posted: "BISERWP board Inter part 1 result expected on 10th October 2014 according our source. students of Rawalpindi board desperately waiting for 11th class result. 1st they upload the 12th class result and after some time they ready for showing the 1st year fin" New post on Jobs in Pakistan 1st Year (11th Class) Result 2014 BISE Rawalpindi Board by Xaib Aslam ...