Exam 11: Inheritance and Composition
Exam 1: An Overview of Computers and Programming Languages50 Questions
Exam 2: Basic Elements of C++50 Questions
Exam 3: Input/Output50 Questions
Exam 4: Control Structures I (Selection)50 Questions
Exam 5: Control Structures II (Repetition)50 Questions
Exam 6: User-Defined Functions50 Questions
Exam 7: User-Defined Simple Data Types, Namespaces, and the string Type50 Questions
Exam 8: Arrays and Strings50 Questions
Exam 9: Records (structs)50 Questions
Exam 10: Classes and Data Abstraction50 Questions
Exam 11: Inheritance and Composition50 Questions
Exam 12: Pointers, Classes, Virtual Functions, Abstract Classes, and Lists50 Questions
Exam 13: Overloading and Templates50 Questions
Exam 14: Exception Handling50 Questions
Exam 15: Recursion50 Questions
Exam 16: Linked Lists50 Questions
Exam 17: Stacks and Queues50 Questions
Exam 18: Searching and Sorting Algorithms50 Questions
Exam 19: Binary Trees50 Questions
Exam 20: Graphs50 Questions
Exam 21: Standard Template Library (STL)50 Questions
Select questions type
The preprocessor directive ____________________ is used to prevent multiple inclusions of a header file in a program.
(Short Answer)
4.9/5
(41)
To define new classes in C++,you create new ____________________ files.
(Short Answer)
4.7/5
(35)
What is the output of the following program? #include <iostream>
Using namespace std;
class bClass
{
public:
void print()const;
bClass(int a = 0,int b = 0);
//Postcondition: x = a; y = b;
private:
int x;
int y;
};
class dClass: public bClass
{
Public:
void print()const;
dClass(int a = 0,int b = 0,int c = 0);
//Postcondition: x = a; y = b; z = c;
private:
int z;
};
Int main()
{
bClass bObject(2,3);
dClass dObject(3,5,8);
bObject.print();
Cout << endl;
dObject.print();
cout << endl;
return 0 ;
}
void bClass::print()const
{
cout << x << " " << y << endl;
}
bClass::bClass(int a,int b)
{
x = a;
y = b;
}
void dClass::print()const
{
bClass:print();
cout << " " << z << endl;
}
dClass::dClass(int a,int b,int c)
: bClass(a,b)
{
Z = c;
}
(Multiple Choice)
4.9/5
(40)
In ____________________ polymorphism,the (data)type is left unspecified and then later instantiated.
(Short Answer)
4.9/5
(39)
Existing classes,from which you create new classes,are called ____ classes.
(Multiple Choice)
4.8/5
(40)
If inheritance is public,all protected members of the base class are ____________________ members of the derived class.
(Short Answer)
4.8/5
(44)
Which of the following is a valid definition of the derived class bClass?
(Multiple Choice)
4.9/5
(41)
C++ provides ____ functions as a means to implement polymorphism in an inheritance hierarchy,which allows the run-time selection of appropriate member functions.
(Multiple Choice)
4.8/5
(40)
In OOD,a program is a collection of interacting ____________________; in structured programming,a program is a collection of interacting functions.
(Short Answer)
4.8/5
(39)
In protected inheritance,public and protected members of the base class become the protected members of the derived class.
(True/False)
4.8/5
(34)
Showing 41 - 50 of 50
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)