Chapter 4 Review
The ______ provides a convenient way to merge the source code from one file with the source code in another file, without having to retype the code.
#include directive
The symbol for the modulus operator in C++ is ______.
%
A source file has an extension of ______.
.cpp
The insert a comment into a C++ program you begin the line with _______.
//
The symbol for the insertion operator in C++ is _________.
<<
The _______ symbol in an assignment statement is called the assignment operator.
=
The symbol for the extraction operator in C++ is _______.
>>
A streamed is defined in C++ as a sequence of words ( T or F )
False
The C++ instructions entered in a program are called source code and are saved in a source file, which has an extension of .c ( T or F )
False
The cin object typically is used with the insertion operator (<<) ( T or F )
False
The remainder operator is used to divide two integers and results in the remainder of the division ( T or F )
False
When you break one of the programming language rules it is a logic error ( T or F )
False
Dividing one integer by another integer in C++ may not give you the result you are expecting. Explain including examples, what occurs in C++ when one integer is divided by another integer.
Sometimes, dividing an integer by an integer gives you a double, so you would have to change one of the integers in a double ( 7 / 2 = 3.5 )
Which are easier to locate, syntax or logic errors? Why?
Syntax because logic errors do not trigger an error message
What type of comments should be at the top of every program written?
The comments should include information like instructions, description of the program, and the creator of the program
Why is it important that each cin statement should be preceded by an accompanying cout statement?
This is important because the cout statement displays the information to the user on the computer screen.
A program should display ( on the computer screen ) a separate and meaningful prompt for each item of data the user should enter ( T or F )
True
C++ provides the static_cast operator for explicitly converting data from one data from one data type to another ( T or F )
True
Machine code is usually called object code ( T or F )
True
Many C++ development tools contain both the editor and compiler in one integrated environment, referred to as the IDE (Integrated Development Environment) ( T or F )
True
Syntax errors are much easier to locate than logic errors ( T or F )
True
The cin object tells the computer to pause program execution while the user enters one or more characters at the keyboard ( T or F )
True
The execution of a C++ program begins with the main function ( T or F )
True
The following statements adds a value of 1 to the sum variable: sum += 1; ( T or F )
True
The processing of locating and correcting the errors in a program is called debugging ( T or F )
True
When used with the cout object, the endl stream manipulator advances the cursor to the next line on the computer screen ( T or F )
True
The using directive ends with a ______. a) ; c) , b) : d) none of the above
a
The function ________ is the code contained between a function's opening and closing braces.
body
The ____ object tells the computer to pause execution while the user enters one or more characters at the keyboard.
cin
The #include directive ends with a _______. a) ; c) , b) : d) none of the above
d
An IDE ( Integrated Development Environment ) contains both the _______ and ________ in one integrated environment.
editor, compiler
The _______ stream manipulator advances the cursor to the next line on the computer screen.
endl
The file containing all of the machine code necessary to run your C++ program as many times as desired without the need for translating the program again is called the _______.
executable file
The _______ step in the problem_solving process is to desk-check the program.
fifth
The ______ step in the problem-solving process is to code the algorithm into a program.
fourth
The first line in a function is called the function _______.
header
Write the C++ statements to declare a variable called age, and prompt the user their age.
int age = 0; cout << "Enter the age: "; cin >> age;
The ______ file must be included in any program that uses the cin or cout objects.
iostream
The ______ combines the object file with other machine code necessary for your C++ program to run correctly.
linker
A _________ error is often difficult to find, and can occur for many reasons, such as entering instructions in the incorrect order.
logic
The operator with the highest precedence number in C++ is ______.
parentheses
The _______ step in the problem-solving process is to evaluate and modify the program.
sixth
The original program instructions entered into an editor is called the _______.
source code
Explicit type conversion is accomplished in C++ with the ________ operator
static_cast
A(n) _________ is defined in C++ as a sequence of characters.
stream
The objects used in C++ to handle standard input and output operations are called ______ objects.
stream
Which C++ program instruction will subtract a value of 1 from the sum variable?
sum += 1;
Write the equivalent C++ statement of the following statement using a single arithmetic assignment operator. [ sum = sum + 47; ]
sum += 47;
A _______ error occurs when you break one of the programming language's rules.
syntax
The ______ tells the compiler where it can find the definitions of keywords and classes.
using directive
The extraction operator stops removing characters from the cin object when it encounters a _______.
white-space character