What is the output of the following loop? count = 5; |
This is an infinite loop. |
____ loops are called post-test loops. |
do…while |
Which of the following loops does not have an entry condition? |
do…while loop |
The ____ statement can be used to eliminate the use of certain bool variables in a loop. |
break |
What executes immediately after a continue statement in a while and do-while loop? |
loop-continue test |
When a continue statement is executed in a ____, the update statement always executes. |
for loop |
d. The output of the statement: cout << tolower(‘$’) << endl; is ____. |
‘$’ |
Assume the following. static_cast<int>(‘a’) = 97 The output of the statement: cout << static_cast<int>(tolower(‘B’)) << endl; is ____. |
98 |
The output of the statement: cout << pow(3.0, 2.0) + 5 << endl; is ____. |
14.0 |
Given the following function prototype: int test(float, char); which of the following statements is valid? |
int u = test(5.0, ‘*’); |
A variable listed in a function call is known as a(n) ____ parameter. A variable list in a header is known as a(n) ____ parameter. |
actual; formal |
Given the following function: int next(int x) what is the output of the following statement? cout << next(next(5)) << endl; |
7 |
Which statement below about prototypes and headers is true? |
Prototypes end with a semicolon, but headers do not. |
Given the function prototype: double testAlpha(int u, char v, double t); which of the following statements is legal? |
cout << testAlpha(5, ‘A’, 2); |
Which of the following function prototypes is valid? |
int funcTest(int, int, float); |
Given the following function: int strange(int x, int y) what is the output of the following statement? cout << strange(4, 5) << endl; |
-1 |
What value is returned by the following return statement? int x = 5; return x + 1; |
6 |
Suppose that printHeading is a function without any parameters. Which of the following is a valid function heading? |
void printHeading() |
8 Which of the following is a legal C++ function definition? |
void funcTest(int& u, double& v) { cout << u << " " << v << endl; } |
8 . There are two types of ____ parameters: value parameters and reference parameters. |
formal |
8 Consider the following definition. void funBbeta(int& one, double two) Based on this function definition, which of the following statements is valid? |
one is a reference parameter and two is a value parameter. |
8 Suppose that you are given the following function definition: void printSomeThing(int x) What is the output of the following statements? printSomeThing(1); |
# # # # # # |
When a function is called, the value of the ____ parameter is copied into the corresponding formal parameter. |
actual |
____ parameters are useful when you want to return more than one value from a function. |
Reference |
You can declare a(n) ____ parameter as a constant by using the keyword const. |
reference |
What is the output of the following program? #include <iostream> void one(int x, int& y); int main() one(u, v); return 0; void one(int x, int& y) a = x; void two(int& s, int t) b = s – t; |
1 1 3 1 |
The ____ of an identifier refers to where in the program an identifier is accessible (visible). |
scope |
____ identifiers are not accessible outside of the function (block). |
Local |
What is the output of the following C++ code?
int alpha = 5; alpha = alpha + 5; { cout << alpha << " " << beta << endl; |
10 15 |
In C++, the scope resolution operator is ____. |
:: |
Memory for ____ variables remains allocated as long as the program executes. |
global |
____ a function refers to the creation of several functions with the same name. |
Overloading |
Suppose that you have the following declaration. enum cars {FORD, GM, TOYOTA, HONDA}; The statement: domesticCars = static_cast<cars>(domesticCars + 1); sets the value of domesticCars to ____. |
GM |
Consider the declaration: enum sports {BASKETBALL, FOOTBALL, HOCKEY, BASEBALL, SOCCER}; which of the following statements is true? |
FOOTBALL <= SOCCER |
What is the output of the following code? enum courses {ALGEBRA, BASIC, PASCAL, PHILOSOPHY, ANALYSIS}; |
0 |
The scope of a namespace member is local to the ____. |
namespace |
Which of the following statements is used to simplify the accessing of all globalType namespace members? |
using namespace globalType; |
The identifiers in the system-provided header files such as iostream, cmath, and iomanip are defined in the namespace ____. |
std |
Before using the data type string, the program must include the header file ____. |
string |
Suppose that str1, str2, and str3 are string variables. After the following statements execute, the value of str3 is "____". str1 = "abc"; |
abc-xyz |
Suppose str = "xyzw";. After the statement str[2] = ‘Y’; The value of str is "____". |
xyYw |
Suppose str = "ABCDEFGHI". The output of the statement cout << str.length() << endl; |
9 |
The length of the string "Hello There. " is ____. |
13 |
11 Consider the following statements. string str = "ABCDEFD"; After the statement position = str.find(‘D’); executes, the value of position is ____. |
3 |
11 Considering the statement string str = "Gone with the wind";, the output of the statement cout << str.find("the") << endl; is ____. |
10 |
11 Consider the following statements. string str1 = "ABCDEFGHIJKLM"; After the statement str2 = str1.substr(1,4); executes, the value of str2 is "____". |
BCDE |
11 Consider the following statements. string str1 = "Gone with the wind"; After the statement str2 = str1.substr(5,4); executes, the value of str2 is "____". |
with |
11 The ____ function is used to interchange the contents of two string variables. |
swap |
11 Which of the following statements declares alpha to be an array of 25 components of the type int? |
int alpha[25]; |
Assume you have the following declaration int beta[50];. Which of the following is a valid element of beta? |
beta[0] |
11 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 |
11 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; |
12 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; |
12 What is the output of the following C++ code? int list[5] = {0, 5, 10, 15, 20}; for (j = 0; j < 5; j++) |
0 5 10 15 20 |
12 What is the value of alpha[2] after the following code executes? int alpha[5]; for (j = 0; j < 5; j++) |
5 |
What is the output of the following C++ code? int alpha[5] = {2, 4, 6, 8, 10}; for (j = 4; j >= 0; j–) |
10 8 6 4 2 |
12 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}; |
12 Consider the following declaration int alpha[3];. Which of the following input statements correctly inputs values into alpha? |
cin >> alpha[0] >> alpha[1] >> alpha[2]; |
12 In C++, the null character is represented as ____. |
‘\0’ |
127. Which of the following correctly declares name to be a character array and stores "William" in it? |
char name[8] = "William"; |
12 Consider the following declaration char str[15];. Which of the following statements stores "Blue Sky" into str? |
strcpy(str, "Blue Sky"); |
12 Consider the following declaration. Assume that the input is: What is the value of discard after the following statements execute? cin.get(charArray, 51); |
discard = ‘\n’ |
Consider the following statement: double alpha[10][5];. The number of components of alpha is ____. |
50 |
Consider the statement int list[10][8];. Which of the following about list is true? |
list has 10 rows and 8 columns. |
13 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? |
int alpha[4][3] = {{0,1,2}, {1,2,3}, {2,3,4}, {3,4,5}}; |
After the following statements execute, what are the contents of matrix? int matrix[3][2]; for (j = 0; j < 3; j++) |
0 1 1 2 2 3 |
Given the following declaration: int j; 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]; |
A collection of a fixed number of elements (called components) arranged in n dimensions (n>=1), called a(n) ____. |
n-dimensional array |
The statement ____ creates the vector object vecList of size size. |
vector<elemType> vecList(size); |
The statement ____ returns the element at the position index in vector vecList. |
vecList[index] |
____ is a valid int value. |
46259 |
Suppose that x is an int variable, ch is a char variable, and the input is: 276. Choose the values after the following statement executes: cin >> ch >> x; |
ch = ‘2’, x = 76 |
Suppose that ch1 and ch2 are char variables and the input is: WXYZ What is the value of ch2 after the following statements execute? cin >> ch1; |
X |
In a ____ control structure, the computer executes particular statements depending on some condition(s). |
selection |
14 The standard header file for the abs(x)function is ____. |
<cmath> |
14 The output of the statement: cout << pow(2.0, pow(3.0, 1.0)) << endl; is ____. |
8.0 |
14 Functions that do not have a return type are called ____ functions. |
void |
14 Which of the following is a legal C++ function definition? |
void funcAlpha(int u, double& v) { cout <<u << " " << v << endl; } |
14 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? |
for (j = 0; j <= 50; j++) cout << gamma[j] << " "; |
A function prototype is ____. |
a declaration, but not a definition |
CSC 101 Final Review
Share This
Unfinished tasks keep piling up?
Let us complete them for you. Quickly and professionally.
Check Price