Terms
Arrays
Ch 1-3
Loops
Miscellaneous
100
What kind of operators are <=, >=, !=?
What is relational
100
Declare an array named scores of twenty-five elements of type int.
int scores[25];
100
Is the variable HeY the same as hEy?
What is no
100
Given an integer variable strawsOnCamel , write a statement that uses the auto-increment operator to increase the value of that variable by 1.
strawsOnCamel++;
100
Given the variables numberOfMen and numberOfWomen , write an expression that evaluates to true if the number of men is greater than or equal to the number of women.
What is numberOfMen>=numberOfWomen
200
True or False: You must initialize const variables at the time of declaration.
What is True
200
Given an array a , declared to contain 34 elements , write an expression that refers to the last element of the array .
a[33]
200
Is this a legal C++ statement? cin >> a, b, c;
What is no
200
Given an int variable n that has already been declared, write some code that repeatedly reads a value into n until at last a number between 1 and 10 (inclusive) has been entered
n=0; while ((n<1) || (n>10)) { cin >> n; }
200
Write an if/else statement that assigns true to the variable fever if the variable temperature is greater than 98.6 ; otherwise it assigns false to fever .
if (temperature>98.6) fever=true; else fever=false;
300
Which of the following is NOT a C++ keyword? using int main namespace return
What is main
300
Given that an array of int named a has been declared with 12 elements and that the integer variable k holds a value between 2 and 8. Assign 22 to the element just before a[k].
a[k-1] = 12;
300
What is the object used to output information to the user?
What is cout
300
Given an int variable k that has already been declared , use a do...while loop to print a single line consisting of 97 asterisks. Use no variables other than k .
k=1; do { cout << "*"; k++; } while (k<=97);
300
Given two integer variables distance and speed , write an expression that divides distance by speed using floating point arithmetic, i.e. a fractional result should be produced.
static_cast(distance/speed)
400
Which of the following will not be recognized if iostream is not included in the program? main std namespace return cout
What is cout
400
Given a two-dimensional array x of doubles , write an expression whose value is twice the value of the element in the 3rd row and the 2nd column.
2 * x[2][1]
400
The language close to the level of the computer.
What is low-level
400
Given an int variable i that has already been declared , write a for loop that prints the integers 0 through 39, separated by spaces. Use no variables other than i .
for (i=0; i<=39; i++) cout << i << " ";
400
Write a statement using a compound assignment operator to multiply num_rabbits by 4, changing the value of num_rabbits (num_rabbits has already been declared and initialized ).
What is num_rabbits*=4;
500
True or False: += will assign the same value as =+
What is False
500
An array of 1000 integers is declared. What is the largest integer that can be used as an index to the array? 1001 1000 999
What is 999
500
What function must every program contain?
What is main
500
Write a loop that displays all possible combinations of two letters where the letters are 'a', or 'b', or 'c', or 'd', or 'e'. The combinations should be displayed in ascending alphabetical order
for (char outerChar='a'; outerChar<='e'; outerChar++) for (char innerChar='a'; innerChar<='e'; innerChar++) cout << outerChar << innerChar << "\n";
500
Write the include directive that allows using files for data storage
What is #include