CS304 Final MCQs PDF
CS304 Final MCQs PDF
FINALTERM EXAMINATION
14 Feb, 2011
CS304- Object Oriented Programming (Session - 3)
1
Question No: 6 ( Marks: 1 ) - Please choose one
A class template may inherit from another class template.
► specialization
► inheritance (Page 216)
► abstraction
► composition
► Greater Memory
► Lesser Memory
► Equal Memory
► None of the given options
► Public
► Private
► Protected
► All of the given Click here for detail
3
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. (Page 78) (rep)
► a function returns by reference.
► an argument is passed by reference.
► Reusability
► Writability
► Maintainability
► All of given (Page 256) rep
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. Click here for detail
► Parameter, temporary
► Null, Parameter
► Parameter, default (Page 75)
► non of the given
5
Question No: 29 ( Marks: 1 )
In order to define a class template, the first line of definition must be:
► specialization
► inheritance (Page 216) rep
► abstraction
► composition
6
FINALTERM EXAMINATION
Spring 2010
CS304- Object Oriented Programming
► vector
► class (Object-Oriented Programming in C++)
► template
► type*
► Greater Memory
► Lesser Memory
► Equal Memory
► None of the given options
► Reusability
► Writability
► Maintainability
► All of given (Page 256) rep
► variable
► array (Page 306)
► function
► datatype
8
Question No: 12 ( 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. Click here for detail
► True
► False (Object-Oriented Programming in C++)
9
Question No: 16 ( Marks: 1 ) - Please choose one
Inheritance is a way to
► organize data.
► pass arguments to objects of classes.
► add features to existing classes without rewriting them. (Page 27)
► improve data-hiding and encapsulation.
► Parameter, temporary
► Null, Parameter
► Parameter, default (Page 75) rep
► non of the given
► default type
► static type (Page 185)
► abstract type
► reference type
10
Question No: 22 ( Marks: 1 ) - Please choose one
------------- members are somewhere between public and private members. They are used in inheritance
► Abnormal Termination
► Graceful Termination
► Return the illegal
► all of the given (Page 329)
► True
► False (Page 92)
FINALTERM EXAMINATION
Spring 2010
CS304- Object Oriented Programming (Session - 3)
11
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
12
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
►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.
13
p->Print();
}
When you run this program, it will print out a single line to the console output.
► Generic element
► Heading element
► Paragraph element
► Nothing will be printed.
► True
► False (Object-Oriented Programming in C++)
(the function invocation is resolved at compile time)
► general template
► partial specialization
► complete specialization
► ordinary function (Page 287)
► variable
► array (Page 306) rep
► function
► datatype
14
Question No: 15 ( Marks: 1 ) - Please choose one
By default the vector data items are initialized to ____
► True
► False (Object-Oriented Programming in C++) rep
► ++ (Page 162)
►-
►+
► All of the given
15
Question No: 21 ( Marks: 1 ) - Please choose one
Which of the following operators can not be overloaded?
► default type
► static type (Page 185) rep
► abstract type
► reference type
► 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++)
►1
►2
►3
► As many as necessary. Click here for detail rep
17
Question No: 6 ( Marks: 1 ) - Please choose one
Non Template Friend functions of a class are friends of ________instance/s of
► Greater Memory
► Lesser Memory
► Equal Memory
► None of the given options
18
Question No: 11 ( Marks: 1 ) - Please choose one
Which is not the Advantage of inheritance?
p->Print();
}
When you run this program, it will print out a single line to the console output.
► Generic element
► Heading element
► Paragraph element
► Nothing will be printed.
19
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
► Reusability
► Writability
► Maintainability
► All of given (Page 256) rep
► State
► Behavior
► Unique identity
► All of the given (Page 12)
► Composition
► Aggregation
► Inheritance
► None of the given options
► True
► False (Object-Oriented Programming in C++)
21
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
► specialization
► inheritance (Page 216) rep
► abstraction
► composition
22
Question No: 2 ( Marks: 1 ) - Please choose one
Each try block can have ______ no. of catch blocks.
►1
►2
►3
► As many as necessary. Click here detail
► True
► False (Object-Oriented Programming in C++) rep
24
Question No: 15 ( 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
25
Question No: 21 ( Marks: 1 ) - Please choose one
When the base class and the derived class have a member function with the same name, you must be
more specific which function you want to call (using ___________).
► scope resolution operator
► dot operator
► null operator
► Operator overloading Click here for detail
FINALTERM EXAMINATION
Fall 2009
CS304- Object Oriented Programming (Session - 4)
► Static allocation
► Static typing
► Dynamic binding (Page 239) rep
► Dynamic allocation
► True
► False
27
Question No: 10 ( Marks: 1 ) - Please choose one
If there is a pointer p to objects of a base class, and it contains the address of an object of a derived
class, and both classes contain a nonvirtual member function, ding(), then the statement p->ding(); will
cause the version of ding() in the _____ class to be executed.
► State
► Behavior
► Protected data members (Page 12)
► All of given
void main()
{
DocElement * p = new Paragraph();
p->Print();
}
When you run this program, it will print out a single line to the console output.
29
What will be in that line?
► Generic element
► Heading element
► Paragraph element
► Nothing will be printed.
► True
► False (Object-Oriented Programming in C++)
(the function invocation is resolved at compile time)
Question No: 19 ( Marks: 1 ) - Please choose one
In case of multiple inheritance a derived class inherits,
► template<class T>
► template <typename U>
► Class<template T> (Page 257)
► template < class T, class U>
30
Question No: 22 ( Marks: 1 ) - Please choose one
An STL container can not be used to,
► True
► False (Object-Oriented Programming in C++) rep
► Separation
► Composition (Page 53)
► Aggregation
► None of the given
► specialization
► inheritance (Page 216) rep
► abstraction
► composition
32
FINALTERM EXAMINATION
Fall 2009
CS304- Object Oriented Programming (Session - 1)
►1
►2
►3
► As many as necessary. Click here for detail rep
34
Question No: 13 ( Marks: 1 ) - Please choose one
The mechanism of selecting function at run time according to the nature of calling object is called,
► late binding
► static binding
► virtual binding
► None of the given options (Page 227)
Dynamic binding means that target function for a call is selected at run time
35
Question No: 19 ( 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. Click here for detail
36
Question No: 24 ( Marks: 1 ) - Please choose one
Consider the code below,
class Fred {
public:
Fred();
...
};
int main()
{
Fred a[10];
Fred* p = new Fred[10];
...
}
Select the best option,
► Fred a[10]; calls the default constructor 09 times
Fred* p = new Fred[10];
► Produce an error
► Fred a[10]; calls the default constructor 11 times
Fred* p = new Fred[10]; calls the default constructor 11 times
► Fred a[10]; calls the default constructor 10 times
Fred* p = new Fred[10]; calls the default constructor 10 times Click here for detail
► True
► False (Page 141)
► glorified.
► encapsulated.
► classified.
► overloaded. (Object-Oriented Programming in C++)
37
Question No: 28 ( Marks: 1 ) - Please choose one
Suppose obj1 and obj2 are two objects of a user defined class A. An + operator is overloaded to add obj1 and
obj2 using the function call obj1+obj2.
Identify the correct function prototype against the given call?
► A operator + ( A &obj);
► int + operator(); (Page 143)
► int operator (plus) ();
► A operator(A &obj3);
38