+ All Categories
Home > Documents > CS304 Object Oriented Programming Fall -2012 · CS304 Object Oriented Programming Final Term Fall...

CS304 Object Oriented Programming Fall -2012 · CS304 Object Oriented Programming Final Term Fall...

Date post: 22-May-2018
Category:
Upload: lamtu
View: 336 times
Download: 32 times
Share this document with a friend
23
CS304 Object Oriented Programming Final Term Fall-2012 1 1) Consider the following statements: int iArray[5]; int *pArr = iArray; Error in first statement Error in second statement Error in both statements No error in both statements 2) template<> class Vector<void*>{ void** p; //.... void*& operator[] ((int i); }; This specialization can be used as the common implementation for all Vectors of pointers. This specialization can then be used as the implementation for all types of classes. This specialization can then be used for double type pointers. This specialization should be used for Vectors of int types. 3) Which of the following is NOT an advantage of generic programming? Reusability Writability Maintainability Efficient memory usage 4) Which one of the following is example of complete specialization, template <typename T> class Vector { }; template <typename T> class Vector<T*> { }; template<> class Vector <char*> { }; template <class T> class Vector< T *> { }; 5) In abnormal termination our program is terminated _________. Manually Normally Abnormally Routinely
Transcript

CS304 Object Oriented Programming

Final Term

Fall-2012

1

1) Consider the following statements: int iArray[5];

int *pArr = iArray;

Error in first statement

Error in second statement Error in both statements

No error in both statements

2) template<> class Vector<void*>{

void** p;

//....

void*& operator[] ((int i);

}; This specialization can be used as the common implementation for all Vectors of pointers.

This specialization can then be used as the implementation for all types of classes.

This specialization can then be used for double type pointers. This specialization should be used for Vectors of int types.

3) Which of the following is NOT an advantage of generic

programming? Reusability

Writability

Maintainability

Efficient memory usage

4) Which one of the following is example of complete specialization, template <typename T> class Vector { };

template <typename T> class Vector<T*> { };

template<> class Vector <char*> { }; template <class T> class Vector< T *> { };

5) In abnormal termination our program is terminated _________. Manually

Normally

Abnormally Routinely

CS304 Object Oriented Programming

Final Term

Fall-2012

2

6) Which one of the following is not a major element of an Object

Model? Abstraction

Encapsulation

Persistence Hierarchy

7) If Rollno is a const data member of a class student then which

definition is correct for the member function show () int show() const { return Rollno; } void show() const { return Rollno; }

int show() const { return Rollno + 50; }

int show(num) const { Rollno = num; }

8) A private member or variable is not accessible to: Base class

Derived class Abstract class

virtual class

9) Classes like Two Dimensional Shape and Three Dimensional

Shape would normally be _________, while classes like Sphere and

Cube would normally be ________. Concrete, abstract

Concrete, static

Abstract, base

Abstract, concrete

10) We cannot declare ____________ to abstract base classes, because we

cannot instantiate objects of abstract base classes Pointers

Pointers and variables

Pointers and references

Variable

11) Which is true about sub-typing in case of inheritance? In sub-typing derived class shows some extended behavior of its parent. In sub-typing derived class shows some restricted behavior of its parent class.

In sub-typing derived class should be abstract.

Sub-typing has no relation with inheritance

12) The ______ keyword tells the compiler to substitute the code within

the function definition for every instance of a function call. Virtual

Inline Instance

Static

13) Which of the following causes a compile time error? Declaring object of a concrete class in the definition of main function

Writing output statement in constructor’s definition

Declaring object of a class having atleast one pure virtual function

CS304 Object Oriented Programming

Final Term

Fall-2012

3

Declaring object of a class having all virtual functions

14) Consider the following statements: int iArray[5];

int *pArr = iArray;

Error in first statement

Error in second statement Error in both statements

template<> class Vector<void*>{

void** p;

//....

void*& operator[] ((int i);

};

This specialization can be used as the common implementation for all Vectors of pointers.

This specialization can then be used as the implimentation for all types of classes.

This specialization can then be used for double type pointers. This specialization should be used for Vectors of int types.

15) Which one of the following is example of complete specialization, template <typename T> class Vector { };

template <typename T> class Vector<T*> { };

template<> class Vector <char*> { }; template <class T> class Vector< T *> { };

16) A vector is an appropriate container if you want to insert lots of new elements at arbitrary locations in the vector.

want to insert new elements, but always at the front of the container.

are given an index number in order to quickly access the corresponding

element. are given an element key value in order to quickly access the corresponding element.

17) The pointer and the memory it points to will be copied in

…………..copy. Deep copy

Shallow copy Bitwise copy

Byte wise copy

18) Constant member functions are just …….. and …… change object

state. Read only, can

Read only, can not Write only, can

Write only, can not

19) A class that declares or inherits a virtual function is called a

________ class. Inherited Protected

Polymorphic

CS304 Object Oriented Programming

Final Term

Fall-2012

4

Friend

20) ________ ensure that the correct function is called for an object,

regardless of the expression used to make the function call. Static functions

Virtual functions Friend functions

Inline functions

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();

}

21) When you run this program, it will print out a single line to the

console output.

What will be in that line?

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

22) 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.

23) Considering the resolution order in which compiler search for

functions in a program; the first priority is given to, general template

CS304 Object Oriented Programming

Final Term

Fall-2012

5

partial specialization

complete specialization

ordinary function 287

24) A private member or variable is not accessible to: Base class

Derived class Abstract class

virtual class

25) 7.A non virtual member function ding() in base and derived class,

and pointer p to base class object contains the address of derived

class object, then the statement p->ding() will execute ding()

member function in ________class. Base

Derived

Abstract virtual

26) When a class is derived from a class with a pure virtual function

and no definition is supplied for that pure virtual function in the

derived class, that derived class is also_________. An abstract class

A static class

A concrete class A Base class

27) Which of the following ensures that data and behaviour are

tightly coupled within an object? Inheritance

Abstraction

Polymorphism

Encapsulation 16

28) In inheritance base class usually represents -------------. Generalization Specialization

Assocation

Aggregation

29) Which members are lies somewhere between public and private

members? Protected members Global members

Static members

Friends members

30) 12. A base class member or method that is alternatively defined

in derived class is known as ______. Overwriting

Overriding Overloaded

Copy riding

CS304 Object Oriented Programming

Final Term

Fall-2012

6

31) 13. 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

32) 14. Which of the following causes run time binding? Declaring object of abstract class

Declaring pointer of abstract class

Declaring overridden methods as non-virtual Declaring object of derived class

33) 15. Consider the following statements: int iArray[5];

int *pArr = iArray;

Error in first statement

Error in second statement Error in both statements

No error in both statements

34) 16. Consider the following definition

template < class T > class Xyz { … };

it defines a class template for integers only

it defines a class template for any data type class templates are not defined in this way

it defines template functions

35) 17.Which of the following is NOT an advantage of generic

programming? Reusability

Writability

Maintainability

Efficient memory usage

36) 18. Which one of the following is example of complete

specialization, template <typename T> class Vector { };

template <typename T> class Vector<T*> { };

template<> class Vector <char*> { }; template <class T> class Vector< T *> { };

37) 19. Non Template Friend functions of a class are friends of

________instance/s of that class. One

Two

All instances of one date type

All

38) 20. Vectors contain contiguous elements stored as a[an] _____. variable

CS304 Object Oriented Programming

Final Term

Fall-2012

7

array function

datatype

39) 21. An STL algorithm is A standalone function that operates on containers. A link between member functions and containers.

A friend function of appropriate container classes.

A member function of appropriate container classes.

40) 22. A vector is an appropriate container if you want to insert lots of new elements at arbitrary locations in the vector.

want to insert new elements, but always at the front of the container.

are given an index number in order to quickly access the corresponding

element. are given an element key value in order to quickly access the corresponding element.

41) 23. The find() algorithm Finds matching sequences of elements in two containers.

Finds a container that matches a specified container.

Takes iterators as its first two arguments. Takes container elements as its first two arguments.

42) The copy() algorithm returns an iterator to the last element copied from.

the last element copied to.

the element one past the last element copied from.

the element one past the last element copied to.

43) 25. Using catch blocks in incorrect order is _________ error. Syntax

Logical Grammatical

Runtime

44) Which of the following is Not an example of error handling

techniques? Abnormal Termination

Graceful Termination

Return the illegal value

Returning a value

45) 27. Which of the following is not the main purpose of abstraction? Only shows the concerned details of the object

Show all the details of the object

Increases the complexity Removing unwanted details in some particular context

46) 28. _______ remain in memory even when all objects of a class have

been destroyed. Static variables 111 Instance variable

Primitive variables

Dynamic Variables

CS304 Object Oriented Programming

Final Term

Fall-2012

8

47) 29. Suppose there is an object of type Person, which of the

following can be considered as one of its attributes. Name

Age

Work()

Both Name and Age

48) 30. Which of the following type is an example of intangible object?

Chair

Room

Time table Pen

49) 31. ___________, 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 Friendship is two way only

NO Friendship between classes

Any kind of friendship

50) 32. The life of sub object is dependent on the life of master class

in _____________. Separation

Composition

Aggregation 133 Association

51) 33. Which of the following operator cannot be overloaded? Scope resolution operator ( :: ) 140 Insertion operator ( << )

Extraction operator ( >> )

The relation operator ( > )

52) 34. In the following operators, the _____ operator can be

overloaded. % 140 ##

?

(.)Dot

53) 35. A class that declares or inherits a virtual function is called a

________ class. Inherited

Protected

Polymorphic 229 Friend

54) Template<class T> class vector <T*> {} is an example of: Generalization

Complete Specialization

CS304 Object Oriented Programming

Final Term

Fall-2012

9

Partial Specialization 281 Template class

55) Suppose you create an uninitialized vector as follows: vector<int> evec;

After adding the statment,

evec.push_back(21);

what will happen?

It will add an element to the start of evec and will initialize it with 21.

It will add an element to the center of evec and will reinitialize it with 21.

It will delete an element to the end (the back) of evec and will reinitialize it with 21.

It will add an element to the end (the back) of evec and initialize it with 21.

56) A static function should be called when an object is destroyed. is

closely connected to an individual object of a class. can be called using the class name followed by function name.

is used when a dummy object t must be created.

57) Which is not the Advantage of inheritance? providing class growth through natural selection. facilitating class libraries.

avoiding the rewriting of code.

providing a useful conceptual framework.

58) The specialization pattern <T*> after the name says that this

specialization is to be used for every, data type

meta type

virtual type

pointer type 286

59) A class template ____________ Facilitates reuse of class 269 Does not facilitate reuse of class

Does not support generic methods

Does not support static members

60) Templates automatically create different versions of a function, depending on user input.

At compile time. Depending on static time.

Depending on function arguments.

61) 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

CS304 Object Oriented Programming

Final Term

Fall-2012

10

Operator overloading

62) Which one of the following is not a major element of an Object

Model? Abstraction

Encapsulation

Persistence Hierarchy

63) The operations of the assignment operator and of the copy

constructor are Similar, except that the copy constructor creates a new object.

Similar, except that the assignment operator copies member data. Different, except that they both create a new object.

Different, except that they do not copy member data.

64) Consider the statement “keyboard has keys”

Which of the following type of association exists between keyboard

and keys? Inheritance

Composition Aggregation

No Association

65) The ______ keyword tells the compiler to substitute the code within

the function definition for every instance of a function call.

Virtual 226 Inline

Instance

Static

66) A special function used to set the data members values of a class

during object creation is called ______. Destructor

Constructor 194 Virtual

Inline

67) "This pointer" does not pass implicitly to __________ functions. Static member 199 Non-static member

Instance member

Constant member

68) Identify which of the following overloaded operator function’s

declaration is appropriate for the given call? Rational_number_1 + 2.325 Hint: Where Rational_number_1 is an object of user defined class Rational_number.

Rational_number operator+( Rational_number & obj);

Rational_number operator+(double& obj); 145 Rational_number operator+(Rational_number &obj, double& num);

operator+(double& obj);

CS304 Object Oriented Programming

Final Term

Fall-2012

11

69) Which one is the correct way to initialize static variables. Student int::noOfStudent = 0; Student::noOf Student = 0;

int Student::noOf Students = 0;

int Student::noOfStudent(0)=0

70) The type that is used to declare a reference or pointer is called

its_______ . default type

static type 185 abstract type

reference type

71) Which members are lies somewhere between public and private

members? Protected members 187 Global members

Static members

Friends members

72) If a class D has been derived using protected inheritance from

class B (If B is a protected base and D is derived class) then public

and protected members of B ________ accessed by member

functions and friends of class D and classes derived from D. can be cannot be

does restrict to be

never

73) A function call is resolved at run-time in___________. non-virtual member function

virtual member function 239 Static member function

Friend member function

74) Which one of the following terms must relate to polymorphism?

Static allocation

Static typing

Dynamic binding Dynamic allocation

75) What is true about function templates? The compiler generates only one copy of the function template

The compiler generates a copy of function respective to each type of data The compiler can only generate copy for the int type data

The compiler can only generate copy for the char type data

76) Consider the following statements: int iArray[5]; int *pArr = iArray;

Error in first statement

CS304 Object Oriented Programming

Final Term

Fall-2012

12

Error in second statement Error in both statements

No error in both statements

77) Consider the following definition

template < class T > class Xyz { … };

it defines a class template for integers only

it defines a class template for any data type

78) class templates are not defined in this way it defines template functions

template<> class Vector<void*>{

void** p;

//....

void*& operator[] ((int i);

};

This specialization can be used as the common implementation for all Vectors of pointers.

This specialization can then be used as the implimentation for all types of classes.

This specialization can then be used for double type pointers. This specialization should be used for Vectors of int types.

79) Which one of the following is example of complete specialization, template <typename T> class Vector { };

template <typename T> class Vector<T*> { };

template<> class Vector <char*> { }; 281 template <class T> class Vector< T *> { };

80) Two important STL associative containers are _______ and _______. set,map 315 sequence,mapping

setmet,multipule

sit,mat

81) A vector is an appropriate container if you want to insert lots of new elements at arbitrary locations in the vector.

want to insert new elements, but always at the front of the container.

are given an index number in order to quickly access the corresponding

element. are given an element key value in order to quickly access the corresponding element.

82) Vector V with default constructor is defined, and another vector

W is defined with one argument constructor with size 11, and

insert 3 elements into each of these vectors with push_back(),

then the size() member function will return ___ for V and __ for W.

11 for v and 3 for w.

0 for v and 0 for w.

3 for v and 11 for w.

83) A range is often supplied to an algorithm by two _______ values. italic

iteration iterator

container

CS304 Object Oriented Programming

Final Term

Fall-2012

13

84) Using catch blocks in incorrect order is _________ error. Syntax

Logical Grammatical

Runtime

85) We must release dynamic memory allocated in try block in

_________

In constructor Catch block In main function block

No need to release memory

86) Which of the following is Not an example of error handling

techniques? Abnormal Termination

Graceful Termination

Return the illegal value

Returning a value 329

87) __________ follow try block to catch the thrown object. Catch block Throw block

Main block

Try block

88) If MyClass has a destructor its name will be, MyClass

~MyClass My~Class

MyClass~

89) Consider the code “int Student:: id=0; where Student is class

name” It is the initialization of: Constant data member

Static data member 109 Data member

Member function

90) Consider the following function:

void multiplication (int x, int y);

If we overloaded the above function, then it will require ………. operands.

One

Two Three

Four

91) A virtual function is a function that is expected to redefine in

________ class. Base class

Parent class

CS304 Object Oriented Programming

Final Term

Fall-2012

14

Super class

Derived class

92) A static function should be called when an object is destroyed.

is closely connected to an individual object of a class.

can be called using the class name followed by function name. is used when a dummy object must be created.

93) Which is not the Advantage of inheritance? facilitating class libraries.

avoiding the rewriting of code.

providing a useful conceptual framework.

providing class growth through natural selection. 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?

94) Select one correct answer from the following list:

Generic element

Heading element

Paragraph element Nothing will be printed.

95) The specialization pattern <T*> after the name says that this

specialization is to be used for every, data type

meta type

virtual type

CS304 Object Oriented Programming

Final Term

Fall-2012

15

pointer type 286 CS304 Object Oriented Programming

96) The ability to derive a class from more than one class is called Single inheritance

Encapsulation

Multiple inheritances Polymorphism

97) Which of the following is the best approach to implement generic

algorithms with minimum number of coding lines? Templates

Overloading

Overriding

Friend function/class

98) A pure virtual function is a virtual function that causes its class to be abstract. returns nothing.

is used in a derived class.

takes no arguments

99) Compiler performs ________ type checking to diagnose type errors, Static Dynamic

Bound

Unbound

100) 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

101) Which one of the following features of OOP is used to deal with

only relevant details? Abstraction Information hiding

Object

Inheritance

102) The operations of the assignment operator and of the copy

constructor are Similar, except that the copy constructor creates a new object.

Similar, except that the assignment operator copies member data. Different, except that they both create a new object.

Different, except that they do not copy member data.

103) 9.A private member or variable is not accessible to: Base class

Derived class Abstract class

virtual class

CS304 Object Oriented Programming

Final Term

Fall-2012

16

104) Which of the following ensures that data and behaviour are

tightly coupled within an object? Inheritance

Abstraction

Polymorphism

Encapsulation 16

105) Consider a class having name MyClass, what will be the name of this class constructor?

MyClass Myclass

myClass

myclass

106) A member function having the same name as the class name

preceded by a tilde (~) sign is called _______. Constructor

Getter

Setter

Destructor

107) Unary operators and assignment operator are ___________.

Left associative

Right associative Left and right associative

Non associative

108) Objects communicate each other through ________. Messages 19 Data Members

Member Functions

Pointers

109) Which members are lies somewhere between public and private

members? Protected members 187 Global members

Static members

Friends members

110) The operations of copy constructor must define by: System

User System and User

Administrator

111) 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

CS304 Object Oriented Programming

Final Term

Fall-2012

17

112) Which of the following causes a compile time error?

Declaring object of a concrete class in the definition of main function

Writing output statement in constructor’s definition

Declaring object of a class having atleast one pure virtual function

Declaring object of a class having all virtual functions

113) When we write a class template the first line must be: template < class class_name>

template < class_name data_type>

template < class T > 257 class template<class_name>

114) Consider the following statements: int iArray[5];

int *pArr = iArray;

Error in first statement

Error in second statement Error in both statements

No error in both statements

115) 22. Consider the following definition

template < class T > class Xyz { … };

it defines a class template for integers only

it defines a class template for any data type

class templates are not defined in this way it defines template functions

116) 22. template<> class Vector<void*>{ void** p;

//....

void*& operator[] ((int i);

};

This specialization can be used as the common implementation for all Vectors of pointers.

This specialization can then be used as the implimentation for all types of classes.

This specialization can then be used for double type pointers. This specialization should be used for Vectors of int types.

117) 23. Which of the following is NOT an advantage of generic

programming? Reusability

Writability

Maintainability

Efficient memory usage

118) 24. Template functions use _________ than ordinary functions.

More Memory

CS304 Object Oriented Programming

Final Term

Fall-2012

18

Less Memory Same Memory

Different Memory

119) 25. By default the vector data items are initialized to ______. 0 1

2

4

120) A vector is an appropriate container if you • want to insert lots of new elements at arbitrary locations in the vector.

• want to insert new elements, but always at the front of the container.

are given an index number in order to quickly access the corresponding

element. • are given an element key value in order to quickly access the corresponding element.

121) 27. Vector V with default constructor is defined, and another

vector W is defined with one argument constructor with size 11,

and insert 3 elements into each of these vectors with push_back(), then the size() member function will return ___ for V and __ for W.

11 for v and 3 for w.

0 for v and 0 for w.

0 for v and 3 for w.

3 for v and 11 for w.

122) 28. An STL container can not be used to: Hold objects of class employee.

Store elements in a way that makes them quickly accessible.

Compile c++ programs. Organize the way objects are stored in memory

123) 29. Using catch blocks in incorrect order is _________ error. Syntax

Logical

Grammatical

Runtime

124) 30.__________ follow try block to catch the thrown object. Catch block Throw block

Main block

Try block

125) 31. The property in which existing class is modified to form a new

class is called……….. Polymorphism

Inheritance

Encapsulation

Information hiding

126) 32. If a user does not delete the dynamic allocated memory in

destructor, then …………… Destructor deletes it automatically

CS304 Object Oriented Programming

Final Term

Fall-2012

19

No need of deletion

It remains unoccupied

The memory remains occupied

127) 33. Which of the following type is an example of intangible

object? Chair

Room

Time table

Pen

128) 34. An association in which three or more than three objects are

involved is called: Ternary association Binary association

Unary association

Nary association

129) 35. In a de-queue, (chose the best option) Data can be quickly inserted or deleted at any arbitrary location.

Data can be relatively slowly inserted or deleted at any arbitrary location.

Data can not be quickly inserted or deleted at either end.

Data can be relatively slowly inserted or deleted at either end.

130) 36. Suppose you create an uninitialized vector as follows:

vector<int> evec;

After adding the statment,

evec.push_back(21);

what will happen?

It will add an element to the start of evec and will initialize it with 21.

It will add an element to the center of evec and will reinitialize it with 21.

It will delete an elexment to the end (the back) of evec and will reinitialize it with 21.

It will add an element to the end (the back) of evec and initialize it with 21.

131) 37. Which is not the Advantage of inheritance? facilitating class libraries.

avoiding the rewriting of code. providing a useful conceptual framework.

providing class growth through natural selection.

132) 38. class DocElement {

public:

virtual void Print() { cout << "Generic element"; }

};

class Heading : public DocElement

{

public:

void Print() { cout << "Heading element"; }

};

class Paragraph : public DocElement

{

public:

CS304 Object Oriented Programming

Final Term

Fall-2012

20

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?

133) Select one correct answer from the following list:

Generic element

Heading element

Paragraph element Nothing will be printed.

134) 39. Which one is a logical abstract base class for a class called "footballPlayer"?

Ground

Sport

Athlete

Team.

135) 40.A template provides a convenient way to make a family of: variables and data members functions and classes

classes and exceptions

programs and algori

136) Which of the following is the best approach to implement

generic algorithms with minimum number of coding lines? Templates

Overloading

Overriding

Friend function/class

137) Identify the correct way of declaring an object of user defined

template class A for char type members? A< char > obj;

<char>A obj;

A obj<char>;

Obj <char> A;

138) 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>

CS304 Object Oriented Programming

Final Term

Fall-2012

21

139) 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

140) Which of the following is incorrect line regarding function

template? template<class T>

template <typename U>

Class<template T> template < class T, class U>

141) 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

142) In ________, a base class can be replaced by its derived class, Sub-typing(Pg. 31)

Super-typing

Multiple-typing

Restricted-typing

143) The ability to derive a class from more than one classes is called, Single inheritance

Encapsulation

Multiple inheritance Polymorphism

144) The operations of the assignment operator and of the copy

constructor are Similar, except that the copy constructor creates a new object.

Similar, except that the assignment operator copies member data.

Different, except that they both create a new object.

Different, except that they do not copy member data.

145) Classes like Two Dimensional Shape and Three Dimensional

Shape would normally be _________, while classes like Sphere and

Cube would normally be ________. Concrete, abstract

Concrete, static

Abstract, base

Abstract, concrete

146) An object has _______ interface(s). One only

Two only

One or more than one No

CS304 Object Oriented Programming

Final Term

Fall-2012

22

147) Encapsulation is a feature of Object Oriented Programming

which means, Keep data separated from code

Keep data and code in a single place

Keep data separated from code and also keep data and code in a single place Reusing code by creating new classes from previously created classes

148) Abstract class has _______. Zero Instances

One Instance

Two Instances

Many Instances

149) Which of the following is a weak relationship between two

objects? Inheritance

Composition

Aggregation Association

150) Which of the class’s members are available to every one? Public

Private

Protected

Internal

151) The function that is automatically called when an object of a class

is created is named as _________. Constructor

Destructor

Member Functions

Inline Functions

152) The operations of copy constructor must define by: System

User(Pg. 196) System and User

Administrator

153) All the ____________ members of base class can be accessed from the

derived class. Private

Protected

Non private(Pg. 172) Public

154) The mechanism of selecting function at run time according to the

nature of calling object is called, late binding

static binding

virtual binding

CS304 Object Oriented Programming

Final Term

Fall-2012

23

hybrid binding

155) A non virtual member function in base class is overridden in

derived class; if that non virtual function is called through base

class pointer to derived class object, then the ______________version

is used. Derived class

Abstract class

Base class

Concrete class

156) When we write a class template the first line must be: template < class_name data_type>

template < class T > class template<class_name>

template < class class_name>


Recommended