Question Completion Status:
Question 1
1. Suppose that printHeadingis a function without any parameters. Which of the following is a valid
function heading?
2. 3. 4. void printHeading();
5. 6. 7. void printHeading()
8. 9. 10. void printHeading(noParameters);
11. 12.13. void printHeading(void)
3 points
Question 2
1. Which of the following is a legal C++ function definition?
2. 3. 4. void funcTest(int& u, double& v){ cout << u << " " << v << endl;}
5. 6. 7. void funcTest(int& u, double& v);{ cout << u << " " << v <<
endl;}
8. 9. 10. void funcTest(int& u, double& v)( cout << u << " " << v << endl)
11. 12.13. void funcTest(int& u, double& v)[ cout << u << " " << v << endl;]
3 points
Question 3
1. There are two types of ____ parameters: value parameters and reference parameters.
2. 3. 4. actual
5. 6. 7. formal
8. 9. 10. active
11. 12.13. passive
3 points
Question 4
1. If an & is attached after the data type of a formal parameter, then the formal parameter is a ____.
2. 3. 4. value parameter
5. 6. 7. reference parameter
8. 9. 10. global variable
11. 12.13. default variable
3 points
Question 5
1. A void function accomplish has three parameters: a parameter u of type int, a parameter v of
type double, and a parameter letter of type char. The parameters uand letter need to pass
their values out of the function and the parameter v is to only receive the value from the calling
environment. Which of the following is a correct function heading?
2. 3. 4. void accomplish(int& u, double v, char& letter)
5. 6. 7. void accomplish(int u, double& v, char letter)
8. 9. 10. void accomplish(int& u, double v, char& letter);
11. 12.13. void accomplish(int u, double& v, char letter);
3 points
Question 6
1. Consider the following definition.void funBbeta(int& one, double two){ ...}Based on this
function definition, which of the following statements is valid?
2. 3. 4. one is a value parameter and two is a reference parameter.
5. 6. 7. one is a reference parameter and two is a value parameter.
8. 9. 10. one and two are reference parameters.
11. 12.13. one and two are value parameters.
3 points
Question 7
1. Which of the following is a legal C++ function definition?
2. 3. 4. void funcAlpha(int u, double v &){ cout << u << " " << v <<
endl;}
5. 6. 7. void funcAlpha(int #, double #){ cout << u << " " << v << endl;}
8. 9. 10. void funcAlpha(int &, double &){ cout << u << " " << v << endl;}
11. 12.13. void funcAlpha(int u, double& v){ cout <3 points
Question 8
1. During program execution, a(n) ____ parameter manipulates the data stored in its own memory
space.
2. 3. 4. formal value
5. 6. 7. actual
8. 9. 10. active
11. 12.13. passive
3 points
Question 9
1. When a function is called, the value of the ____ parameter is copied into the corresponding formal
parameter.
2. 3. 4. reference
5. 6. 7. default
8. 9. 10. actual
11. 12.13. static
3 points
Question 10
1. If a formal parameter is a nonconstant
reference parameter, its corresponding actual parameter
during a function call must be a(n) ____.
2. 3. 4. default value
5. 6. 7. value
8. 9. 10. expression
11. 12.13. variable
3 points
Question 11
1. You can declare a(n) ____ parameter as a constant by using the keyword const.
2. 3. 4. absolute
5. 6. 7. relative
8. 9. 10. reference
11. 12.13. actual
3 points
Question 12
1. Suppose that you have the following function.
2. void mystery(int& one, int two){ int temp temp = one; one =
two; two = temp;}
3. What are the values of x and y after the following statements? (Assume that variables are
properly declared.)
4. x = 10;y = 15;mystery(x, y);
5. 6. 7. x = 10; y = 10
8. 9. 10. x = 10; y = 15
11. 12.13. x = 15; y = 10
14. 15.16. x = 15; y = 15
3 points
Question 13
1. Consider the following function definition.
2. void strange(int& u, char& ch){ int a; a = u++; u = 2 * u; a =
static_cast(ch); a++; ch = static_cast(a);
3. }What are the values of one and letter after the following statements execute?int one
=5;char letter = 'A';strange(one, letter);
4. 5. 6. one = 5; letter = 'A'
7. 8. 9. one = 10; letter = 'A'
10. 11.12. one = 10; letter = 'B'
13. 14.15. one = 12; letter = 'B'
3 points
Question 14
1. ____ identifiers are not accessible outside of the function (block).
2. 3. 4. Local
5. 6. 7. Global
8. 9. 10. Internal
11. 12.13. External
3 points
Question 15
1. In C++, the scope resolution operator is ____.
2. 3. 4. |
5. 6. 7. .
8. 9. 10. :
11. 12.13. ::
3 points
Question 16
1. To declare w as an external variable of type int inside the function, the function must contain
which statement?
2. 3. 4. external w
5. 6. 7. external int w;
8. 9. 10. extern w
11. 12.13. extern int w;
3 points
Question 17
1. A variable for which memory is allocated at block entry and deallocated at block exit is called a(n)
____ variable.
2. 3. 4. side effect
5. 6. 7. static
8. 9. 10. automatic
11. 12.13. global
3 points
Question 18
1. Suppose that you have the following declaration. enum cars {FORD, GM, TOYOTA,
HONDA};cars domesticCars = FORD;The statement domesticCars =
static_cast(domesticCars + 1); sets the value of domesticCars to ____.
2. 3. 4. FORD
5. 6. 7. GM
8. 9. 10. TOYOTA
11. 12.13. HONDA
3 points
Question 19
1. What is the output of the following code?enum courses {ALGEBRA, BASIC, PASCAL,
PHILOSOPHY, ANALYSIS};courses registered;registered = ALGEBRA;cout <<
registered << endl;
2. 3. 4. ALGEBRA
5. 6. 7. 0
8. 9. 10. 1
11. 12.13. "ALGEBRA"
3 points
Question 20
1. Which of the following statements creates an anonymous type?
2. 3. 4. enum grades {A, B, C, D, F};
5. 6. 7. enum grades {};
8. 9. 10. enum {};
11. 12.13. enum {A, B, C, D, F} grades;
3 points
Question 21
1. In C++, ____ is a reserved word.
2. 3. 4. deftype
5. 6. 7. typedef
8. 9. 10. typecc
11. 12.13. alias
3 points
Question 22
1. In July ____, the ANSI/ISO Standard C++ was officially approved.
2. 3. 4. 1996
5. 6. 7. 1998
8. 9. 10. 1999
11. 12.13. 2000
3 points
Question 23
1. In C++, ____ is called the scope resolution operator.
2. 3. 4. .
5. 6. 7. ?
8. 9. 10. :
11. 12.13. ::
3 points
Question 24
1. The scope of a namespace member is local to the ____.
2. 3. 4. function
5. 6. 7. block
8. 9. 10. file
11. 12.13. namespace
3 points
Question 25
1. Which of the following statements is used to simplify the accessing of all globalType namespace
members?
2. 3. 4. using globalType;
5. 6. 7. using namespace globalType:all;
8. 9. 10. using namespace globalType::all;
11. 12.13. using namespace globalType;
3 points
Question 26
1. Before using the data type string, the program must include the header file ____.
2. 3. 4. enum
5. 6. 7. iostream
8. 9. 10. string
11. 12.13. std
3 points
Question 27
1. Suppose that str1, str2, and str3 are string variables. After the following statements execute,
the value of str3 is "____".
2. str1 = "abc";str2 = "xyz";
3. str3 = str1 + ''
+ str2;
4. 5. 6. abc
7. 8. 9. xyz
10. 11.12. abcxyz
13. 14.15. xyzabc
3 points
Question 28
1. Suppose str = "xyzw";. After the statement str[2] = 'Y'; The value of str is "____".
2. 3. 4. xyzw
5. 6. 7. xYzw
8. 9. 10. xyYw
11. 12.13. xzYw
3 points
Question 29
1. Suppose str = "ABCDEFGHI". The output of the statement cout << str.length() << endl;
is ____.
2. 3. 4. 7
5. 6. 7. 8
8. 9. 10. 9
11. 12.13. 10
3 points
Question 30
1. The length of the string "Hello There. " is ____.
2. 3. 4. 11
5. 6. 7. 12
8. 9. 10. 13
11. 12.13. 14
3 points
Question 31
1. Consider the following statements. string str = "ABCDEFD";string::size_type
position;After the statement position = str.find('D'); executes, the value of position is
____.
2. 3. 4.
5. 6. 7.
8. 9. 10.
11. 12.13.
3 points
Question 32
1. Consider the following statements.
2. string str1 = "ABCDEFGHIJKLM";string str2;
3. After the statement str2 = str1.substr(1,4); executes, the value of str2 is "____".
4. 5. 6. ABCD
7. 8. 9. BCDE
10. 11.12. BCD
13. 14.15. CDE
3 points
Question 33
1. Consider the following statements.
2. string str1 = "Gone with the wind";
3. string str2;After the statement str2 = str1.substr(5,4); executes, the value of str2 is
"____".
4. 5. 6. Gone
7. 8. 9. with
10. 11.12. the
13. 14.15. wind
3 points
Question 34
1. The ____ function is used to interchange the contents of two string variables.
2. 3. 4. iterator
5. 6. 7. traverse
8. 9. 10. swap
11. 12.13. change
3 points
Question 35
1. Which of the following statements declares alpha to be an array of 25 components of the type
int?
2. 3. 4. int alpha[25];
5. 6. 7. int array alpha[25];
8. 9. 10. int alpha[2][5];
11. 12.13. int array alpha[25][25];
3 points
Question 36
1. Assume you have the following declaration int beta[50];. Which of the following is a valid
element of beta?
2. 3. 4. beta['2']
5. 6. 7. beta['3']
8. 9. 10. beta[0]
11. 12.13. beta[50]
3 points
Question 37
1. Suppose that list is an array of 10 components of type int. Which of the following codes
correctly outputs all the elements of list?
2. 3. 4. for (int j = 1; j < 10; j++) cout << list[j] << " ";cout << endl;
5. 6. 7. for (int j = 0; j <= 9; j++) cout << list[j] << " ";cout << endl;
8. 9. 10. for (int j = 1; j < 11; j++) cout << list[j] << " ";cout << endl;
11. 12.13. for (int j = 1; j <= 10; j++) cout << list[j] << " ";cout << endl;
3 points
Question 38
1. What is the output of the following C++ code?
2. int list[5] = {0, 5, 10, 15, 20};int j;for (j = 0; j < 5; j++) cout <<
list[j] << " ";cout << endl;
3. 4. 5. 0 1 2 3 4
6. 7. 8. 0 5 10 15
9. 10.11. 0 5 10 15 20
12. 13.14. 5 10 15 20
3 points
Question 39
1. What is the value of alpha[2] after the following code executes?
2. int alpha[5];int j;for (j = 0; j < 5; j++)
3. alpha[j] = 2 * j + 1;
4. 5. 6.
7. 8. 9.
10. 11.12.
13. 14.15.
3 points
Question 40
1. What is the output of the following C++ code?int alpha[5] = {2, 4, 6, 8, 10};int j;for
(j = 4; j >= 0; j)
cout << alpha[j] << " ";
2. cout << endl;
3. 4. 5. 2 4 6 8 10
6. 7. 8. 4 3 2 1 0
9. 10.11. 8 6 4 2 0
12. 13.14. 10 8 6 4 2
3 points
Question 41
1. What is the output of the following C++ code?
2. int list[5] = {0, 5, 10, 15, 20};int j;for (j = 1; j <= 5; j++) cout <<
list[j] << " ";cout << endl;
3. 4. 5. 0 5 10 15 20
6. 7. 8. 5 10 15 20 0
9. 10.11. 5 10 15 20 20
12. 13.14. Code contains index outofbounds
3 points
Question 42
1. Suppose that gamma is an array of 50 components of type int and j is an int variable. Which of
the following for loops sets the index of gamma out of bounds?
2. 3. 4. for (j = 0; j <= 49; j++) cout << gamma[j] << " ";
5. 6. 7. for (j = 1; j < 50; j++) cout << gamma[j] << " ";
8. 9. 10. for (j = 0; j <= 50; j++) cout << gamma[j] << " ";
11. 12.13. for (j = 0; j <= 48; j++) cout << gamma[j] << " ";
3 points
Question 43
1. Consider the following declaration int alpha[5] = {3, 5, 7, 9, 11};. Which of the following
is equivalent to this statement?
2. 3. 4. int alpha[] = {3, 5, 7, 9, 11};
5. 6. 7. int alpha[] = {3 5 7 9 11};
8. 9. 10. int alpha[5] = [3, 5, 7, 9, 11];
11. 12.13. int alpha[] = (3, 5, 7, 9, 11);
3 points
Question 44
1. Consider the following declaration int alpha[3];. Which of the following input statements
correctly inputs values into alpha?
2. 3. 4. cin >> alpha >> alpha >> alpha;
5. 6. 7. cin >> alpha[0]>> alpha[1] >> alpha[2];
8. 9. 10. cin >> alpha[1]>> alpha[2] >> alpha[3];
11. 12.13. cin >> alpha
3 points
Question 45
1. In C++, the null character is represented as ____.
2. 3. 4. '\0'
5. 6. 7. "\0"
8. 9. 10. '0'
11. 12.13. "0"
3 points
Question 46
1. Consider the following declaration char str[15];. Which of the following statements stores
"Blue Sky" into str?
2. 3. 4. str = "Blue Sky";
5. 6. 7. str[15] = "Blue Sky";
8. 9. 10. strcpy(str, "Blue Sky");
11. 12.13. strcpy("Blue Sky");
3 points
Question 47
1. Consider the following declaration.char charArray[51];char discard;Assume that the input
is:Hello There!How are you?
2. What is the value of discard after the following statements execute? cin.get(charArray,
51);cin.get(discard);
3. 4. 5. discard = ' ' (Space)
6. 7. 8. discard = '!'
9. 10.11. discard = '\n'
12. 13.14. discard = '\0'
3 points
Question 48
1. Consider the statement int list[10][8];. Which of the following about list is true?
2. 3. 4. list has 10 rows and 8 columns.
5. 6. 7. list has 8 rows and 10 columns.
8. 9. 10. list has a total of 18 components.
11. 12.13. list has a total of 108 components.
3 points
Question 49
1. Which of the following correctly declares and initializes alpha to be an array of four rows and
three columns and the component type is int?
2. 3. 4. int alpha[4][3] = {{0,1,2} {1,2,3} {2,3,4} {3,4,5}};
5. 6. 7. int alpha[4][3] = {0,1,2; 1,2,3; 2,3,4; 3,4,5};
8. 9. 10. int alpha[4][3] = {0,1,2: 1,2,3: 2,3,4: 3,4,5};
11. 12.13. int alpha[4][3] = {{0,1,2}, {1,2,3}, {2,3,4}, {3,4,5}};
3 points
Question 50
1. Given the following declaration,
2. int j;int sum; double sale[10][7];
3. which of the following correctly finds the sum of the elements of the fifth row of sale?
4. 5. 6. sum = 0;for(j = 0; j < 7; j++) sum = sum + sale[5][j];
7. 8. 9. sum = 0;for(j = 0; j < 7; j++) sum = sum + sale[4][j];
10. 11.12. sum = 0;for(j = 0; j < 10; j++) sum = sum + sale[5][j];
13. 14.15. sum = 0;for(j = 0; j < 10; j++) sum = sum + sale[4][j];
3 points
Question 51
1. In row order form, the ____.
2. 3. 4. first row is stored first
5. 6. 7. first row is stored last
8. 9. 10. first column is stored first
11. 12.13. first column is stored last
3 points
Question 52
1. A struct is a ____ data structure.
2. 3. 4. simple
5. 6. 7. dynamic
8. 9. 10. heterogeneous
11. 12.13. linked
3 points
Question 53
1. The components of a struct are called the ____ of the struct.
2. 3. 4. variables
5. 6. 7. identifiers
8. 9. 10. elements
11. 12.13. members
3 points
Question 54
1. Which of the following struct definitions is correct in C++?
2. 3. 4. struct studentType{ int ID;};
5. 6. 7. struct studentType{ string name; int ID; double
gpa;}
8. 9. 10. int struct studentType{ ID;}
11. 12.13. struct studentType{ int ID = 1;};
3 points
Question 55
1. Consider the following struct definition
2. struct rectangleData{ double length; double width; double area;
double perimeter;
3. };Which of the following variable declarations is correct?
4. 5. 6. rectangle rectangleData;
7. 8. 9. struct rectangleData();
10. 11.12. rectangleData myRectangle;
13. 14.15. rectangleData rectangle = new rectangleData();
3 points
Question 56
1. An array name and index are separated using ____.
2. 3. 4. curly brackets
5. 6. 7. square brackets
8. 9. 10. a dot
11. 12.13. a comma
3 points
Question 57
1. Consider the following statements.
2. struct rectangleData{ double length; double width; double area;
double perimeter;};rectangleData bigRect;
3. Which of the following statements correctly initializes the component length of bigRect?
4. 5. 6. bigRect = {10};
7. 8. 9. bigRect.length = 10;
10. 11.12. length[0]= 10;
13. 14.15. bigRect[0]= 10
3 points
Question 58
1. In C++, the ____ symbol is an operator, called the member access operator.
2. 3. 4. :(colon)
5. 6. 7. .(dot)
8. 9. 10. ,(comma)
11. 12.13. $ (dollar sign)
3 points
Question 59
1. Consider the following statements.
2. struct rectangleData{ double length; double width; double area;
double perimeter;};
3. rectangleData bigRect;Which of the following statements is valid in C++?
4. 5. 6. cin >> bigRect.length >> width;
7. 8. 9. cout << bigRect.length;
10. 11.12. cout << bigRect;
13. 14.15. cout << length;
3 points
Question 60
1. Consider the following statements.struct circleData{ double radius; double area;
double circumference;};
2. circleData circle;Which of the following statements is valid in C++?
3. 4. 5. cin >> circle.radius;circle.area = 3.14 * radius * radius;
6. 7. 8. cin >> circle.radius;circle.area = 3.14 * circle.radius * radius;
9. 10.11. cin >> circle;
12. 13.14. cin >> circle.radius;
3 points
Question 61
1. Consider the following statements.struct personalInfo{ string name; int age;
double height; double weight;};struct commonInfo{ string name; int
age;};
2. personalInfo person1, person2;commonInfo person3, person4;Which of the following
statements is valid in C++?
3. 4. 5. person1 = person3;
6. 7. 8. person2 = person1;
9. 10.11. person2 = person3;
12. 13.14. person2 = person4;
3 points
Question 62
1. Consider the following statements.struct studentType1
2. { string name; int ID; double gpa;
3. };studentType1 student1, student2;struct studentType2
4. { string name; int ID; double gpa;
5. };studentType2 student3, student4;Which of the following statements is valid in C++?
6. 7. 8. student2 = student3;
9. 10.11. student1 = student4;
12. 13.14. student2.ID = ID;
15. 16.17. student1.ID = student3.ID;
3 points
Question 63
1. You can assign the value of one struct variable to another struct variable of ____ type(s).
2. 3. 4. any
5. 6. 7. the same
8. 9. 10. a different
11. 12.13. a heterogeneous
3 points
Question 64
1. Consider the following statements.
2. struct rectangleData{ double length; double width; double area;
double perimeter;};
3. rectangleData bigRect;rectangleData smallRect;Which of the following statements is
legal in C++?
4. 5. 6. if (bigRect == smallRect)
7. 8. 9. if (bigRect != smallRect)
10. 11.12. if (bigRect.length == width)
13. 14.15. if (bigRect.length == smallRect.width)
3 points
Question 65
1. Which of the following aggregate operations can be executed on array variables?
2. 3. 4. Arithmetic
5. 6. 7. Assignment
8. 9. 10. Comparison
11. 12.13. Parameter passing
3 points
Question 66
1. A list has two items associated with it: ____.
2. 3. 4. the length and the references
5. 6. 7. the values and the references
8. 9. 10. the indexes and the length
11. 12.13. the values and the length
3 points
Question 67
1. Consider the following statements.
2. struct supplierType
3. { string name; int supplierID;
4. };struct applianceType
5. { supplierType supplier; string modelNo; double cost;
6. };
7. applianceType applianceList[25];Which of the following best describes applianceList?
8. 9. 10. It is an array.
11. 12.13. It is a struct.
14. 15.16. It is an array of structs.
17. 18.19. It is a struct of arrays.
3 points
Question 68
1. Consider the following statements.struct supplierType
2. { string name; int supplierID;
3. };struct paintType
4. { supplierType supplier; string color; string paintID;
5. };
6. paintType paint;What is the data type of paint.supplier?
7. 8. 9. string
10. 11.12. paintType
13. 14.15. supplierType
16. 17.18. struct
3 points
Question 69
1. The components of a class are called the ____ of the class.
2. 3. 4. elements
5. 6. 7. members
8. 9. 10. objects
11. 12.13. properties
3 points
Question 70
1. If a member of a class is ____, you cannot access it outside the class.
2. 3. 4. public
5. 6. 7. automatic
8. 9. 10. private
11. 12.13. static
3 points
Question 71
1. clockType
2. hr:
intmin:
intsec:
int
3. +setTime(int, int, int): void+getTime(int&, int&, int&) const:
void+printTime() const: void+incrementSeconds(): int+incrementMinutes():
int+incrementHours(): int+equalTime(const clockType&) const: bool
4.
5. The word ____ at the end of the member functions in the class clockType specifies that these
functions cannot modify the member variables of a clockType object.
6. 7. 8. static
9. 10.11. const
12. 13.14. automatic
15. 16.17. private
3 points
Question 72
1. A ____ sign in front of a member name on the UML diagram indicates that this member is a
private member.
2. 3. 4.
5. 6. 7.
8. 9. 10.
11. 12.13.
3 points
Question 73
1. class rectangleType{public: void setLengthWidth(double x, double y);
//Postcondition: length = x; width = y; void print() const; //Output length
and width; double area(); //Calculate and return the area of the
rectangle; double perimeter(); //Calculate and return the parameter;
rectangleType(); //Postcondition: length = 0; width = 0;
rectangleType(double x, double y); //Postcondition: length = x; width =
y;private: double length; double width;}; Consider the accompanying class
definition. Which of the following class variable declarations is correct?
2. 3. 4. rectangle rectangleType;
5. 6. 7. class rectangleType rectangle;
8. 9. 10. rectangleType rectangle;
11. 12.13. rectangle rectangleType.area;
3 points
Question 74
1. Consider the accompanying class definition, and the declaration:rectangleType bigRect;
2. Which of the following statements is correct?
3. 4. 5. rectangleType.print();
6. 7. 8. rectangleType::print();
9. 10.11. bigRect.print();
12. 13.14. bigRect::print();
3 points
Question 75
1. In C++, the ____ is an operator called the member access operator.
2. 3. 4. .
5. 6. 7. ,
8. 9. 10. ::
11. 12.13. #
3 points
Question 76
1. A class object can be ____. That is, it can be created once, when the control reaches its
declaration, and destroyed when the program terminates.
2. 3. 4. static
5. 6. 7. automatic
8. 9. 10. local
11. 12.13. public
3 points
Question 77
1. In C++, the scope resolution operator is ____.
2. 3. 4. :
5. 6. 7. ::
8. 9. 10. $
11. 12.13. .
3 points
Question 78
1. To guarantee that the member variables of a class are initialized, you use ____.
2. 3. 4. accessors
5. 6. 7. mutators
8. 9. 10. constructors
11. 12.13. destructor
3 points
Question 79
1. class secretType{public: static int count; static int z; secretType();
secretType(int a); void print(); static void incrementY();private:
int x; static int y;};secretType::secretType(){ x =
1;}secretType::secretType(int a){ x = a;}void secretType::print(){ cout <<
"x = " << x << ", y = " << y << "z = " << z << ", count = " <<
count << endl;}static void secretType::incrementY(){ y++;}
2. Consider the accompanying class and member functions definitions. How many constructors are
present in the class definition above?
3. 4. 5.
6. 7. 8.
9. 10.11.
12. 13.14.
3 points
Question 80
1. class secretType{public: static int count; static int z; secretType();
secretType(int a); void print(); static void incrementY();private:
int x; static int y;};secretType::secretType(){ x =
1;}secretType::secretType(int a){ x = a;}void secretType::print(){ cout <<
"x = " << x << ", y = " << y << "z = " << z << ", count = " <<
count << endl;}static void secretType::incrementY(){ y++;} Consider the
accompanying class and member functions definitions. Which of the following statements
correctly creates the object mySecret of type secretType and sets the value of the member
variable x to 9?
2. 3. 4. secretType mySecret(9);
5. 6. 7. mySecret = secretType(9);
8. 9. 10. secretType = mySecret(9);
11. 12.13. secretType(9).mySecret;
3 points
Question 81
1. How many destructors can a class have?
2. 3. 4. 0
5. 6. 7. 1
8. 9. 10. 2
11. 12.13. Any number
3 points
Question 82
1. What does ADT stand for?
2. 3. 4. abstract definition type
5. 6. 7. asynchronous data transfer
8. 9. 10. abstract data type
11. 12.13. alternative definition type
3 points
Question 83
1. A C++ implementation file has the extension ____.
2. 3. 4. .imp
5. 6. 7. .h
8. 9. 10. .exe
11. 12.13. .cpp
3 points
Question 84
1. If a function of a class is static, it is declared in the class definition using the keyword static in
its ____.
2. 3. 4. return type
5. 6. 7. parameters
8. 9. 10. heading
11. 12.13. main function
3 points
Question 85
1. ____ is an “isa”
relationship.
2. 3. 4. Inheritance
5. 6. 7. Encapsulation
8. 9. 10. Composition
11. 12.13. Polymorphism
3 points
Question 86
1. The new classes that we create from existing classes are called ____ classes.
2. 3. 4. sibling
5. 6. 7. base
8. 9. 10. derived
11. 12.13. parent
3 points
Question 87
1. Suppose that bClass is a class. Which of the following statements correctly derives the class
dClass from bClass?
2. 3. 4. class dClass:: public bClass{ //classMembersList};
5. 6. 7. class dClass: private bClass{ //classMembersList};
8. 9. 10. class dClass:: protected bClass{ //classMembersList};
11. 12.13. class bClass: public dClass{ //classMembersList};
3 points
Question 88
1. Consider the following class definition. class dClass: bClass{ //class members
list};The class dClass is derived from the class bClass using the ____ type of inheritance.
2. 3. 4. public
5. 6. 7. private
8. 9. 10. protected
11. 12.13. static
3 points
Question 89
1. Which of the following is a valid definition of the derived class bClass?
2. 3. 4. class aClass: public bClass{ //...};
5. 6. 7. class bClass: public aClass{ //...};
8. 9. 10. class aClass::bClass{ //...};
11. 12.13. class bClass::aClass{ //...}
3 points
Question 90
1. Which of the following is true about inheritance?
2. 3. 4. All public member functions of the base class become the public member functions of the
derived class.
5. 6. 7. All public member variables of the base class become the public member variables of the
derived class.
8. 9. 10. All public members of the base class become the public members of the derived class.
11. 12.13. The public member variables of the base class become the public or private member
variables of the derived class.
3 points
Question 91
1. Which of the following class definitions makes the public members of the class aClass become
the public members of the class bClass?
2. 3. 4. class aClass: public bClass{ //...};
5. 6. 7. class bClass: public aClass{ //...};
8. 9. 10. class bClass: aClass{ //...};
11. 12.13. class aClass: bClass{ //...};
3 points
Question 92
1. Which of the following is true about a derived class?
2. 3. 4. A derived class can directly access any member variable of the base class.
5. 6. 7. A derived class can redefine any public member function of the base class.
8. 9. 10. A derived class can have at most one base class.
11. 12.13. A derived class can redefine any member function of the base class.
3 points
Question 93
1. To ____ a public member function of a base class in the derived class, the corresponding
function in the derived class must have the same name, number, and types of parameters.
2. 3. 4. redefine
5. 6. 7. overload
8. 9. 10. rename
11. 12.13. reuse
3 points
Question 94
1. If the corresponding functions in the base class and the derived class have the same name but
different sets of parameters, then this function is ____ in the derived class.
2. 3. 4. reused
5. 6. 7. redefined
8. 9. 10. overloaded
11. 12.13. overridden
3 points
Question 95
1. Consider the following class definitions. class bClass{public: void setX(int);
void print() const;private: int x;};class dClass: public bClass{public:
void setXY(int, int); void print() const;private: int y;};Which of the following
statements correctly redefines the member function print of bClass?
2. 3. 4. void dClass::print() const { dClass:print(); cout << " " <<
y << endl; }
5. 6. 7. void dClass::print() const { cout << x << " " << y << endl;
}
8. 9. 10. void bClass::print() const { cout << x << " " << y << endl;
}
11. 12.13. void dClass::print() const { bClass::print(); cout <<
"y = " << y << endl; }
3 points
Question 96
1. If the derived class classD overrides a public member function functionName of the base class
classB, then to specify a call to that public member function of the base class you use the ____
statement.
2. 3. 4. classD::functionName();
5. 6. 7. classB::functionName();
8. 9. 10. classD.functionName();
11. 12.13. classB.functionName();
3 points
Question 97
1. What is the output of the following program?
2. #include 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;}
3. 4. 5. 2 32 3
6. 7. 8. 2 33 5 8
9. 10.11. 3 5 83 5 8
12. 13.14. 5 83 5 8
3 points
Question 98
1. ____ is the ability to combine data, and operations on that data, in a single unit.
2. 3. 4. Inheritance
5. 6. 7. Encapsulation
8. 9. 10. Polymorphism
11. 12.13. Composition
3 points
Question 99
1. OOP implements ____.
2. 3. 4. UML
5. 6. 7. IPE
8. 9. 10. EIP
11. 12.13. OOD
3 points
Question 100
1. The ____ members of an object form its internal state.
2. 3. 4. private
5. 6. 7. protected
8. 9. 10. public
11. 12.13. static