2Test CSWhen a continue statement is executed in a ____, the update statement always executes.
The output of the statement: cout << tolower('$') << endl; is ____.
$
The statement: return 2 * 3 + 1, 1 + 5; returns the value ____.
6
Considering the statement string str = "Gone with the wind";, the output of the statement cout << str.find("the") << endl; is ____.
10
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] << " "; cout << endl;
10 8 6 4 2
Consider the following statement: double alpha[10][5];. The number of components of alpha is ____.
50
The output of the statement: cout << pow(2.0, pow(3.0, 1.0)) << endl; is ____.
8.0
Suppose str = "ABCDEFGHI". The output of the statement cout << str.length() << endl; is ____.
9
Consider the following statements: string str1 = "ABCDEFGHIJKLM"; string str2; After the statement str2 = str1.substr(1,4); executes, the value of str2 is "____".
BCDE
Suppose that you have the following declaration. enum cars {FORD, GM, TOYOTA, HONDA}; cars domesticCars = FORD; The statement: domesticCars = static_cast<cars>(domesticCars + 1); sets the value of domesticCars to ____.
GM
Consider the following declaration: char charArray[51]; char discard; Assume that the input is: Hello There! How are you? What is the value of discard after the following statements execute? cin.get(charArray, 51); cin.get(discard);
discard = '\n'
A struct variable can be passed as a parameter ____.
either by value or by reference
Consider the following declaration: int alpha[5] = {3, 5, 7, 9, 11};. Which of the following is equivalent to this statement?
int alpha[] = {3, 5, 7, 9, 11};
Which of the following function prototypes is valid?
int funcExp(int x, float v);
Given the following declaration: int j; int sum; double sale[10][7]; which of the following correctly finds the sum of the elements of the fifth row of sale?
sum = 0; for(j = 0; j < 7; j++) sum = sum + sale[4][j];
The ____ function is used to interchange the contents of two string variables.
swap
You can assign the value of one struct variable to another struct variable of ____ type.
the same
A list has two items associated with it: ____.
the values and the length
In C++, ____ is a reserved word.
typedef
In C++, the null character is represented as ____.
'\0'
Given the following function: int strange(int x, int y) { if (x > y) return x + y; else return x - y; } what is the output of the following statement? cout << strange(4, 5) << endl;
-1
In C++, the ____ symbol is an operator, called the member access operator.
.(dot)
What is the output of the following code? enum courses {ALGEBRA, BASIC, PASCAL, PHILOSOPHY, ANALYSIS}; courses registered; registered = ALGEBRA; cout << registered << endl;
0
Assume you have the following declaration double salesData[1000];. Which of the following ranges is valid for the index of the array salesData?
0 through 999
What is the output of the following C++ code? int list[5] = {0, 5, 10, 15, 20}; int j; for (j = 1; j <= 5; j++) cout << list[j] << " "; cout << endl;
Code results in index out-of-bounds
Which of the following aggregate operations can be executed on array variables?
Parameter passing by reference
Consider the following statement: int alpha[25][10];. Which of the following statements about alpha is true?
Rows of alpha are numbered 0...24 and columns are numbered 0...9.
Suppose that str1, str2, and str3 are string variables. After the following statements execute, the value of str3 is "____". str1 = "abc"; str2 = "xyz"; str3 = str1 + '-' + str2;
abc-xyz
A variable or expression listed in a call to a function is called the ____.
actual parameter
Consider the following statements. struct circleData { double radius; double area; double circumference; }; circleData circle; Which of the following statements is valid in C++?
cin >> circle.radius;
Given the following function prototype: int myFunc(int, int);, which of the following statements is valid? Assume that all variables are properly declared.
cout << myFunc(myFunc(7, 8), 15);
Given the function prototype: float test(int, int, int); which of the following statements is legal?
cout << test(7, 14, 23);
Given the function prototype: double testAlpha(int u, char v, double t); which of the following statements is legal?
cout << testAlpha(5, 'A', 2);
Given the following function prototype: double tryMe(double, double);, which of the following statements is valid? Assume that all variables are properly declared.
cout << tryMe(2.0, 3.0);
Consider the following statements: struct supplierType { string name; int supplierID; }; struct applianceType { supplierType supplier; string modelNo; double cost; }; applianceType applianceList[25]; Which of the following statements correctly initializes the cost of each appliance to 0?
for (int j = 0; j < 25; j++) applianceList.cost[j] = 0;
Suppose that sales is an array of 50 components of type double. Which of the following correctly initializes the array sales?
for (int j = 0; j <= 49; j++) sales[j] = 0.0;
Suppose that list is an array of 10 components of type int. Which of the following codes correctly outputs all the elements of list?
for (int j = 0; j <= 9; j++) cout << list[j] << " "; cout << endl;
When a continue statement is executed in a ____, the update statement always executes.
for loop
The heading of the function is also called the ____.
function header
Given the following code namespace globalType { void printResult(); } which of the following statements is needed to access printResult?
globalType::printResult();
A struct is typically a ____ data structure.
heterogeneous
Given the following function prototype: int test(float, char);, which of the following statements is valid? int u = test(5.0, '*');
int u = test(5.0, '*');
Consider the following function prototype: int seqSearch(const listType& list, int searchItem); The actual parameter cannot be modified by ____.
list
Consider the statement int list[10][8];. Which of the following about list is true?
list has 10 rows and 8 columns.
The components of a struct are called the ____ of the struct.
members
A collection of a fixed number of elements (called components) arranged in n dimensions (n>=1) is called a(n) ____.
n-dimensional array
Consider the following struct definition: struct rectangleData { double length; double width; double area; double perimeter; }; Which of the following variable declarations is correct?
rectangleData myRectangle;
Before using the data type string, the program must include the header file ____.
string
The data type string has a named constant, ____, associated with it.
string::npos
Consider the following statements: struct studentType1 { string name; int ID; double gpa; }; studentType1 student1, student2; struct studentType2 { string name; int ID; double gpa; }; studentType2 student3, student4; Which of the following statements is valid in C++?
student1.ID = student3.ID;
Which of the following statements is used to simplify the accessing of all globalType namespace members?
using namespace globalType;