CS150 Module 1-3 Review
Before a variable in C++ is used, it must be ---------
defined
What is the data type of variable x in the following C++11 code? int y= 2; double z = 3.5; auto x = z * y;
double
There may be more than one correct answer. You must give all correct answers for full credit. Pick the C++ reserved words out of the following list.
double while if
A program should have a comment on every line.
false
What is the value assigned to the variable in each of these cases? Explain curious results. Be careful! int x, y; x = 1/2; y = 3.0/2.0;
x=0 and y=1
What is the value assigned to the variable in each of these cases? Explain curious results. Be careful! double z, w, t; z = 1/2; w = 3/2; t = 3.0/2.0;
z=0.0, w=1.0, and t=1.5
To use cin and cout, the program must include the header file iostream and either include the statement using namespace std; or refer to these identifiers as std::cin and std::cout.
true
The program that loads first when you turn on your computer is called the operating system.
true
The value of the expression 20.0 * (9/5) + 32.0 is ----------
52.0
The value of the expression 20.0 * (9.0/5) + 32.0 is -----------
68.0
Given the C++ output statements. What is the output of these lines of code? cout << "If you have "; cout << "a number of pods "; cout << "you can quit.";
Given the C++ output statements. What is the output of these lines of code? cout << "If you have "; cout << "a number of pods "; cout << "you can quit.";
In C++ the compiler will infer the type intended for a variable from the context in which the variable occurs.
false
In C++ the variables Alpha, ALPHA and AlphA are the same identifier.
false
The number system used by a computer is base 10.
false
There may be more than one correct answer. You must give all correct answers for full credit. In C++, a legal identifiers may contain these kinds of characters _______________, ______________, ______________
letters digits underscore
Which of the following types are not built into the C++ language?
real
There may be more than one correct answer. You must give all correct answers for full credit. Which of the following names might give the human reader some hint about the data that is stored in them?
speed, distance, time voltage, current, resistance
During program execution, the contents of a named constant cannot be changed.
true
In C++ you can assign an expression of type int to a variable of type double with no problem.
true
OOP is an acronym that means Object Oriented Programming.
true