COM 1100 Foundations of Computer Science
Preparation Notes for the Midterm Exam -- Thursday, Nov. 2ndFall 2000 -- Professor Futrelle
College of Computer Science, Northeastern U., Boston, MA
Version 2. Posted 10/29/2000.
The Midterm will last the entire class period and based on all the material in the textbook,
Friedman and Koffman, through Section 5.5. The topics assigned up until now in
How Computers Work will also be material you should know.
The midterm will contain a number of questions of varying length and difficulty.
The basic requirement is to know all the material through Sec. 5.5.
(This new section posted Sunday the 29th of October 2000)
The examples below expand a bit on the list of topics I gave you to give you a
better idea of how the questions on the Midterm will be worded.
End of 10/29/00 posted section.
- Given an evaluation tree as in Fig. 2.14, create a correctly written version
of it in standard C++ syntax, including parenthesization as necessary. (This is
the opposite of what you're usually asked.)
- Given an English language description of an if statement, while statement
or for loop, write the correct piece of code corresponding to it. You will not
be asked to write entire programs on the midterm.
- Evaluate a logical expression such as the examples shown in Sec. 4.2, including
'<' and other operators and related tests on characters and strings.
- Write a logical expression that filters certain characters, such as the digits
and '-' sign in a telephone number.
- Write a cout statement that produces an output I will give you, where the
cout arguments will be comprised of strings, variables, and function expressions, e.g.,
"Value is: ", crewTeamMembers, sqrt(area).
- Write a cin statement that will get the values of various types of input. (Remember
that cin of a string only gets the a sequence of characters up to the next blank.)
- Write the prototype, function definition, and a call to (a use of) a simple
function, e.g., one with only one or two statements in its definition.
- Demonstrate your understanding of scope by predicting what a certain
set of identifier declarations, assignments and use lead to in the way of values or
The list below gives some examples of what you should know for some of the more important
topics. WARNING: THE LIST BELOW IS NOT COMPLETE, IT CONTAINS ONLY HIGHLIGHTS -- the book
is the final determiner of what you should know.
You will be asked to write only small amounts of code on the exam.
But in a number of questions you will be given code and asked to explain exactly
what it does. In some cases the code will be wrong and you'll be asked what is wrong with
it and what should be done to fix it.
When studying the book, look at the various summary tables and lists as well as the
sample code and problems at the ends of the chapters.
- You should understand Fig. 1.9 and the text that explains it.
- You should know the basic syntax of a C++ program, ala Quiz #3 and
your lab work -- data declarations, comments, bracketing, etc.
- Know how cout and cin are used, e.g., you never include "endl" in a cin
statement -- that would be asking it to place a value typed in by a user in a
variable called "endl". You couldn't declare such a variable anyway (reserved word).
- Know how to correctly form arithmetic expressions, no '^' and no '÷',
- Be able to do evaluation trees, including type conversion, as shown in
- You will not be tested on the dot notation introduced for classes in
the string examples. Neither will you be asked about the string functions, other
than simple assignment '=' and equality '=='.
- You must understand logical expressions, including all the basic operators
in Table 4.1 as well as "&&", "||", and "!".
- For functions, you will be asked how to write function prototypes and calls
and essential parts of definitions. In addition you may be asked to explain what a
function returns and how the return values are used. Make sure you understand the
fact that formal parameter lists and actual argument lists must correspond ("not" on
page 141). You do not need to memorize
library functions and especially not the precise #includes needed for each.
- Given codes samples, you will be asked what the values of various variables
would be at various points in code execution, e.g., when printed out. These are scope
- Thoroughly understand the "if" control statement, including just how
bracketing and the semicolon are used in such statements.
- And finally, know how the "while" and "for" iteration control constructs
work, including the ability to declare iteration variables inside the for statement.
That should give you something to chew on! But I must say, that looking at the list above,
which I'm sure all of you can master, we've come a long way in just a matter
of weeks. This is a tribute to your energy and hard work.