What does unit test typically test?
A function.
What sorting algorithm always compares adjacent (side-by-side) elements, swapping them when they are out of order?
Bubble sort
What function seeds the random number generator?
srand()
What type of value is assigned to each enum value?
How many elements should a vector have to represent a tic-tac-toe board?
9
What is a unique set of input values for a unit test called?
A test vector.
Which sorting algorithm is almost always going to be the slowest?
Selection sort
What is the smallest and largest number assigned to x?
x = rand() % 8;
0 and 7
True or false: A function can have a parameter with an enum type AND return an enum type.
True
What should you have used an enum for in your Math Quiz program?
The difficulty levels
What kind of functions are difficult to unit test?
A function that displays output, receives user input, or generates random numbers.
Which sorting algorithm is fast if the array is already nearly sorted?
Bubble sort
What value should srand() be called with to ensure the program always generates different random numbers?
time(0) or the number of seconds that have elapsed since Jan 1, 1970
Declare an enum called Medals with GOLD, SILVER, and BRONZE.
enum Medals {GOLD, SILVER, BRONZE};
too small, too large, already had an X or O
Write an assert for this function:
int Max(int x, int y) { ... }
assert(Max(1, 2) == 2);
What does a vector with [3 8 1 6 9] contain after swapping once with selection sort?
[1 8 3 6 9]
What statement assigns x with a random number between 1 and 10?
x = rand() % 10 + 1;
Create a variable called myMedal that uses the enum type Medal and is assigned with SILVER.
Medal myMedal = SILVER;
The GetComputerMove() function had a loop to keep choosing random numbers if what happened?
How would a SelectionSort() function be tested with assert()?
What does the vector [ 3 8 9 6 1 ] contain after swapping twice with bubble sort?
[ 3 8 6 1 9 ]
What statement assigns x with a random number between -10 and 10?
x = rand() % 21 - 10;
If an GroceryItem is declared with APPLES, BANANAS, and WATER using the default values, what does outputting userItem display?
GroceryItem userItem = WATER;
2
What phrase does the MCP from the movie Tron always sign off with? In C++, an output statement might use a constant, which is an abbreviation for this phrase.
"End of line"