Filters
Question type

Study Flashcards

____ is the ability to use the same expression to denote different operations.


A) Inheritance
B) Encapsulation
C) Polymorphism
D) Composition

E) None of the above
F) C) and D)

Correct Answer

verifed

verified

C++ provides ____________________ functions as a means to implement polymorphism in an inheritance hierarchy.

Correct Answer

verifed

verified

____ is a "has-a" relationship.


A) Inheritance
B) Encapsulation
C) Composition
D) Polymorphism

E) A) and D)
F) None of the above

Correct Answer

verifed

verified

In object-oriented design,we debug ____________________; in structured programming,we debug functions.

Correct Answer

verifed

verified

Which of the following statements about inheritance is true if memberAccessSpecifier is protected?


A) The private members of the base class become protected members of the derived class.
B) The derived class can directly access any member of the base class.
C) The public members of the base class become protected members of the derived class.
D) The protected members of the base class become private members of the derived class.

E) None of the above
F) All of the above

Correct Answer

verifed

verified

Consider the following class definitions: class bClass { Public: Void setX(int a) ; //Postcondition: x = a; Void print() const; Private: Int x; }; Class dClass: public bClass { Public: Void setXY(int a,int b) ; //Postcondition: x = a; y = b; Void print() const; Private: Int y; }; Which of the following correctly sets the values of x and y?


A) void dClass::setXY(int a, int b)
{
BClass::setX(a) ;
Y = b;
}
B) void dClass::setXY(int a, int b)
{
X = a;
Y = b;
}
C) void dClass::setXY(int a, int b)
{
X = bClass::setX(a) ;
Y = bClass::setY(b) ;
}
D) void dClass::setXY(int a, int b)
{
X = bClass.setX(a) ;
B = y;
}

E) None of the above
F) A) and D)

Correct Answer

verifed

verified

Classes can create new classes from existing classes.This important feature ____.


A) encourages code reuse
B) aids the separation of data and operations
C) provides public access to the internal state of an object
D) results in more software complexity

E) A) and D)
F) None of the above

Correct Answer

verifed

verified

The new classes that we create from existing classes are called ____ classes.


A) sibling
B) base
C) derived
D) parent

E) A) and B)
F) None of the above

Correct Answer

verifed

verified

In the case of composition,the ____________________ name is used to invoke the constructor.

Correct Answer

verifed

verified

Which of the following is true about inheritance?


A) All public member functions of the base class become the public member functions of the derived class.
B) All public member variables of the base class become the public member variables of the derived class.
C) All public members of the base class become the public members of the derived class.
D) The public member variables of the base class become the public or private member variables of the derived class.

E) A) and C)
F) A) and B)

Correct Answer

verifed

verified

In multiple inheritance,the derived class has more than one base class.

A) True
B) False

Correct Answer

verifed

verified

The term ____________________ is used to describe the ability to create new objects from existing objects.

Correct Answer

verifed

verified

A derived class cannot directly access public members of a base class.

A) True
B) False

Correct Answer

verifed

verified

A derived class can directly access the protected members of the base class.

A) True
B) False

Correct Answer

verifed

verified

In ____________________ (aggregation),one or more members of a class are objects of another class type.

Correct Answer

verifed

verified

OOP implements ____.


A) UML
B) IPE
C) EIP
D) OOD

E) A) and B)
F) None of the above

Correct Answer

verifed

verified

Which of the following class definitions makes the public members of the class aClass become the public members of the class bClass?


A) class aClass: public bClass
{
//) ..
};
B) class bClass: public aClass
{
//) ..
};
C) class bClass: aClass
{
//) ..
};
D) class aClass: bClass
{
//) ..
};

E) A) and D)
F) B) and C)

Correct Answer

verifed

verified

If inheritance is private,all members of the base class,including private members,become private members of the derived class.

A) True
B) False

Correct Answer

verifed

verified

Suppose that bClass is a class.Which of the following statements correctly derives the class dClass from bClass?


A) class dClass:: public bClass
{
//classMembersList
};
B) class dClass: private bClass
{
//classMembersList
};
C) class dClass:: protected bClass
{
//classMembersList
};
D) class bClass: public dClass
{
//classMembersList
};

E) B) and D)
F) A) and B)

Correct Answer

verifed

verified

Inheritance is an example of a(n) ____ relationship.


A) is-a
B) has-a
C) handshaking
D) had-a

E) A) and D)
F) C) and D)

Correct Answer

verifed

verified

Showing 21 - 40 of 50

Related Exams

Show Answer