FINAL TERM EXAMINATION
Spring 2010
CS304- Object
Oriented Programming (Session - 3)
Question No: 1 ( Marks: 1 ) - Please choose one
Which
one of the following terms must relate to polymorphism?
► Static allocation
► Static typing
► Dynamic binding (Page
239)
► Dynamic allocation
Question
No: 2 ( 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 (Page 226)
► None of the given
Question No: 3 ( 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 (Page 256) rep
► Overloading
► Data hiding
► Encapsulation
Question No: 4 ( Marks: 1 ) - Please choose one
Which of
the following is the best approach to implement generic algorithms with minimum
number of coding lines?
► Templates (Page 256)
► Overloading
► Overriding
► Friend function/class
Question No: 5 ( Marks: 1 ) - Please choose one
Like
template functions, a class template may not handle all the types successfully.
► True (Page 258) rep
► False
Question No: 6 ( Marks: 1 ) - Please choose one
A class
template may inherit from another class template.
► True (Page 288) rep
► False
Question No: 7 ( 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. (Object-Oriented Programming in C++) rep
► protected members of Derv.
► private members of Derv.
► protected members of Base.
Question No: 8 ( 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: 9 ( 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
A single
try block can have multiple catch blocks but only one finally block.
Question No: 10 ( 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: 11 ( Marks: 1 ) - Please choose one
Suppose
we have two derived classes from a single class, can we write a method with
same name in
both
these derived classes? Choose the best option.
► No
► Only if the two classes have the same name (Page 204)
► Only if the main program does not
declare both kinds
► Yes
Question No: 12 ( Marks: 1 ) - Please choose one
When a
virtual function is called by referencing a specific object by name and using
the dot member selection
operator
(e.g., squareObject.draw()), the reference is resolved at compile time.
► True
► False (Object-Oriented Programming in C++)
(the function invocation is resolved at
compile time)
Question No: 13 ( Marks: 1 ) - Please choose one
Considering
the resolution order in which Considering the resolution order in which
compiler search
for
functions in a program; the first priority is given to; the first priority is
given to,
► general template
► partial specialization
► complete specialization
► ordinary function (Page
287)
Question No: 14 ( Marks: 1 ) - Please choose one
Vectors
contain contiguous elements stored as a[an] ___.
► variable
► array (Page 306) rep
► function
► datatype
Question No: 15 ( Marks: 1 ) - Please choose one
By
default the vector data items are initialized to ____
► 0 Click here for
detail rep
► 0.0
► 1
► null
Question No: 16 ( Marks: 1 ) - Please choose one
One
purpose of an iterator in the STL is to connect algorithms and containers.
► True (Object-Oriented
Programming in C++)
► False
Question No: 17 ( Marks: 1 ) - Please choose one
Algorithms
can only be implemented using STL containers.
► True
► False (Object-Oriented
Programming in C++) rep
Question No: 18 ( Marks: 1 ) - Please choose one
In
________, a base class can be replaced by its derived class,
► Sub-typing (Page 31)
► Super-typing
► Multiple-typing
► Restricted-typing
Question No: 19 ( Marks: 1 ) - Please choose one
this
pointer does not point to current object of any class,
► True
► False Click here for
detail
The this pointer is a hidden pointer inside
every class member function that points to the class object
the
member function is working with.
Question
No: 20 ( Marks: 1 ) - Please choose one
Which of
the following operator(s) take(s) one or no argument if overloaded?
► ++ (Page 162)
► -
► +
► All of the given
Question No: 21 ( Marks: 1 ) - Please choose one
Which of
the following operators can not be overloaded?
► Scope resolution operator ( ::
) (Page 141)
► Insertion operator ( << )
► Extraction operator ( >> )
► The relation operator ( > )
Question
No: 22 ( Marks: 1 ) - Please choose one
The type
that is used to declare a reference or pointer is called its ---------
► default type
► static type (Page 185) rep
► abstract type
► reference type
Question No: 23 ( Marks: 1 ) - Please choose one
-------------
members are somewhere between public and private members. They are used in
inheritance
► protected (Page 187) rep
► public
► private
► global
Question No: 24 ( Marks: 1 ) - Please choose one
Which of
these are examples of error handling techniques ?
► Abnormal Termination
► Graceful Termination
► Return the illegal
► all of the given (Page
329)
Question No: 25 ( Marks: 1 ) - Please choose one
_______
“is a” relationship
► Inheritance (Page 25)
► Polymarphism
►
abstraction
► encapsulation
Question No: 26 ( Marks: 1 ) - Please choose one
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 Click
here for detail rep
No comments:
Post a Comment