Comp 121
Chapters 1 – 2 Study Guide
Chapter 1
Is C++ a low-level, middle-level, or high-level programming language? What does this mean?
What is an object-oriented language?
What is an algorithm and what is it used for?
What is the difference between a class and an object? What is the relationship between them?
What is the use of a source-program? Is a C++ program a source-program, an object-program, or an executable program?
What is the benefit to modular programs? Name some modules and how they are used.
What is the difference between a class and a function?
What are identifiers? What are acceptable identifiers and what are unacceptable identifiers? (Be sure you can identify valid identifiers versus invalid identifiers)
What is the main function used for? Is it necessary to have in a C++ program? How many main functions can a program have? What is the structure of the main function?
How do you define the type of value a function will return when it has completed operating? What does the keyword void designate?
What task is cout used for in a program and how do you use it?
What is a preprocessor command? Which preprocessor command must be included in a program that uses cout?
How do you define a string? What will the /n do when used in a string?
What is whitespace? What effect will it have on your program?
What are comments used for in a program? How do you create comments?
What are some common programming errors?
Chapter 2
Identify the following as integer, floating point, or character:
1000
-6.67
‘n’
0.3
‘%’
-10
+2.
What has more storage space in a computer, doubles or floats? How do you indicate a double versus a float?
Express .0342 in exponential notation. Express 6.231e3 in decimal notation.
What is ASCII used for?
What symbol is used to indicate an escape sequence? What is the escape sequence for a new line? What is the escape sequence for a double quote?
What is the form of a simple arithmetic expression? In a simple arithmetic expression, if both operands are integers, what data type is the result?
In integer division what will be the result of 17 / 5? What is the result of 17 % 5?
Are the following expressions valid or invalid, if they are invalid, why?
5 * % 6
(6 + 4) / (2 + 3)
5 (4 + 3)
(6 – 2) * (4 + 2)
What does the precedence of an operator establish? When operators have the same precedence how are they evaluated?
How do you use cout to display the result of (5 + 20)? How do you use cout to display the string "My result is " and the result of (4 + 3 * 2)?
What is the manipulator setw(n) used for?
What is the general form of a declaration statement? For the following lines:
float firstnum;
char ch, key, letter;
what are the data types and what are the variable names? How do you declare a variable used to hold an integer value?
What is a reference variable and how do you declare one? What is an anonymous variable?
What is the difference between the integer qualifiers long, short and unsigned? Are unsigned integers generally used for positive or negative integers?
List some Integer Types and some Floating Point Types.
What is a bit? How many bits are in a byte? Bytes can be grouped into larger units called what?