This preview shows pages 1–3. Sign up to view the full content.
CSE 100 (9:15 am – 10:30 am): Principles of Programming with C++
Department of Computer Science
Arizona State University, Fall 2007
Midterm I  Solutions
100 Points
Your Name: Solutions
Directions:
Total time for the test is
1 hour and 15
minutes. Answer all questions. Show your work
clearly so that you may get partial points even if your final answer is wrong!)
GOOD LUCK!!!
1.)
Indicate whether the statement is true or false. [17 points]
Each question worth 1 points
_ F___
i) An identifier can be any sequence of digits, letters, and the underscore character.
_T__
ii)
In a mixed expression, all integer operands are converted to floatingpoint numbers with zero
decimal part.
_F___
iii)
Every C++ program must include the iostream header file.
_T__
iv)
The pair of characters
//
is used for single line comments.
_T___
v)
You can use the function
getline
to read a string containing blanks (whitespaces).
.
Each question worth 2 points
__F__
vi) The value of the expression
8 * 5 % 2 is 16
.
__T__
vii) In C++, the value of the expression
32/5.0
is
6.4
.
Problem
Page
Possible
Your Score
1
1
17
2
2
10
3
3
12
4
4
6
5
5
11
6
6
14
7
7
15
8
8
15
Total
1
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document__F__
viii)
Suppose
x = 10
. After the execution of the statement
y = x;
y
is
10
and
x
is
8
.
__T__
ix)
Suppose
a = 15
. After the execution of the statement
++a;
the value of
a
is
16
.
__T__
x) The characters
cin.get
function is used to extract characters from a input stream including
whitespaces.
__T__
xi) Suppose that
sum
is an
int
variable. The statement
sum += 7;
is equivalent to the statement
sum = sum + 7;
2.)
Identify the choice that best completes the statement or answers the question. [10 Points]
Each question worth 1 point
i) Main memory is an ordered sequence of items, called ____.
a.
This is the end of the preview. Sign up
to
access the rest of the document.
 Fall '07
 ComputerSystems
 Computer Science

Click to edit the document details