VUsolutions on Facebook

This website is now MOVED to new domain, i.e. www.VUsolutions.com.


SO, now to onward, for any kind of data & help you may visit www.VUsolutions.com

NOTE: This blog having all past papers from midterm & final term exams, and uploaded on the same day when the papers was held. For SOLVED PAPERS you may visit VUsolutions GURU website. We dedicated VUsolutions GURU website just for past SOLVED papers & SOLVED online quizzes.

VU Past solved papers

Tuesday, August 10, 2010

CS304- Object Oriented Programming (Session - 3)

FINALTERM EXAMINATION

Spring 2010

CS304- Object Oriented Programming (Session - 3)

Time: 90 min

Marks: 58

Question No: 1 ( 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: 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

► 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

► 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

► 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

► False

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

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: 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.

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.

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?http://vusolutions.blogspot.com/

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

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

Question No: 13 ( Marks: 1 ) - Please choose one

Considering the resolution order in which compiler search for functions in a program; the first priority is given to,

general template

partial specialization

complete specialization

ordinary function

Question No: 14 ( Marks: 1 ) - Please choose one

Vectors contain contiguous elements stored as a[an] ___.

► variable

► array

► function

► datatype

Question No: 15 ( Marks: 1 ) - Please choose one

By default the vector data items are initialized to ____

► 0

► 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

► False

Question No: 17 ( Marks: 1 ) - Please choose one

Algorithms can only be implemented using STL containers.

► True

► False

Question No: 18 ( Marks: 1 ) - Please choose one

In ________, a base class can be replaced by its derived class,

Sub-typing

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

Question No: 20 ( Marks: 1 ) - Please choose one

Which of the following operator(s) take(s) one or no argument if overloaded?

► ++

► -

► +

► All of the given

Question No: 21 ( Marks: 1 ) - Please choose one

Which of the following operators can not be overloaded?

Scope resolution operator ( :: )

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

► 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

► public

► private

► global

Question No: 24 ( Marks: 1 ) - Please choose one

Which of these are examples of error handling techniques ?

► Graceful Termination

► Return the illegal

► all of the given

Question No: 25 ( Marks: 1 ) - Please choose one

_______ is a relationship

► Inheritance

► 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

Question No: 27 ( Marks: 2 )

Describe the way to declare a template function as a friend of any class.http://vusolutions.blogspot.com/

Question No: 28 ( Marks: 2 )

Give the names of any two types of template.

Question No: 29 ( Marks: 2 )

Explain the statement below,

vector ivec(4, 3);

Question No: 30 ( Marks: 2 )

Q. Enlist the kinds of association w.r.t Cardinality (3)

Question No: 31 ( Marks: 3 )

Give three advantages that Iterators provide over Cursors.

Question No: 32 ( Marks: 3 )

Give the differences between virtual inheritance and multiple inheritance.

Question No: 33 ( Marks: 3 )

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: 5 )

See the 5 code snippets below and tell whether these are correct or incorrect also justify your answers in the table given at the end.http://vusolutions.blogspot.com/

Snippet No.1

template<>

class A {

} ;

template<>

class B : public A<>

{ … }

Snippet No.2

template< >

class B<> : public A<>

{ … }

Snippet No.3

class B : public A<>

{ … }

Snippet No.4

template< >

class B<> : public A

{ … };

Snippet No.5

template<>

class B : public A<>

{ … }

Table:

Snippet No.

Is it correct or not (Correct/ Incorrect)

Justification of your answer

1

http://vusolutions.blogspot.com/

2

3

4

5

Question No: 35 ( Marks: 5 )

What is the output produced by the following program?

#include

void sample_function(double test) throw (int);

int main()

{

try

{

cout <<”Trying.\n”;

sample_function(98.6);

cout << “Trying after call.\n”;

}

catch(int)

{

cout << “Catching.\n”;

}

cout << “End program.\n”;

return 0;

}

void sample_function(double test) throw (int)

{

cout << “Starting sample_function.\n”;

if(test <>

throw 42;

}

Question No: 36 ( Marks: 5 )

Suppose the base class and the derived class each have a member function with the same signature. When you have a pointer to a base class object and call a function member through the pointer, discuss what determines which function is actually called, the base class member function or the derived-class function.

:::::::::::::::::::::::::::::::::::::::::::::For more posts, click "Older Posts"::::::::::::::::::::::::::::::::::::::::::