1
C++ A Beginner’s Guide by Herbert Schildt
Answers to Mastery Checks
Module 1: C++ Fundamentals
1. C++ is at the center of modern programming because it was derived from C and is the parent of Java
and C#. These are the four most important programming languages.
2. True, a C++ compiler produces code that can be directly executed by the computer.
3. Encapsulation, polymorphism, and inheritance are the three guiding principles of OOP.
4. C++ programs begin execution at main( ).
5. A header contains information used by the program.
6. <iostream> is the header the supports I/O. The statement includes the <iostream> header in a
program.
7. A namespace is a declarative region in which various program elements can be placed. Elements
declared in one namespace are separate from elements declared in another.
8. A variable is a named memory location. The contents of a variable can be changed during the
execution of a program.
9. The invalid variables are d and e. Variable names cannot begin with a digit or be the same as a C++
keyword.
10. A single-line comment begins with // and ends at the end of the line. A multiline comment begins
with /* and ends with */.
11. The general form of the if:
if(condition) statement;
The general form of the for:
for(initialization; condition; increment) statement;
12. A block of code is started with a { and ended with a }.
13. // Show a table of Earth to Moon weights.