Name_______________________
Login___________________SID________
CS 010: Introduction to
Computer Science I
Quiz 2: 10 minutes
- Excessive
comments add time to the execution of your program.
- TRUE
- FALSE
- Which
of the following is NOT a valid identifier (i.e. CANNOT be
used as a name for a variable).
- phone_number
- EXTRACREDIT
- DOUBLE
- my course
- All
are invalid
- The
following is an example of what type of error?
int num1;
int num2;
cout
<< “Enter two numbers: “;
cin >> num1
>> num1;
- syntax
error
- semantic
error
- logic error
- compile-time
error
- no
errors
- Which
statement has a syntax error?
- double
a = 3.5 + 4;
- cout
<< b + c;
- x + y = total;
- double
Main;
- All
of the above.
- What
is the output of the following statement?
int num = 26;
cout << “Here it is.”
<< num << “\nThere it is.”;
- Here
it is.There it is.
- Here
it is.26nThere it is.
- Here it is.26
There it is.
- Here
it is.
26
There it is.
- Here
it is.26\nThere it is.
- Assuming
that the user types 14.92 followed by a return, what is the output of the
following code:
int num;
cout << “Enter a
number: “;
cin >> num;
cout << num;
- 0
- 14
- 14.92
- 15
- None
of the above
- What
is the result of the following code:
int a = 53;
int b = 6;
cout
<< a / b;
- 8.833
- 9
- 8
- 5
- None
of the above
- We
want to translate the following algebraic expression into a C++ arithmetic
expression. Which of the following
is the correct form?

a. 1
/ c + 1 - a / 1 + b
b. 1
/ c + (1 - a / 1 + b)
c. (1
/ c) + (1 - a / 1 + b)
d.
1 / c + (1 - a) / (1 + b)
e. None
of the above
- What
is the result of the following arithmetic expression? 7.0 * 3 % 2
- 7.0
- 0
- 1.0
- 10.5
- invalid expression
- All
three statements below have the same effects.
a = a + 1;
a = (a+1);
a = 1 + a;
- TRUE
- FALSE