Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Tài liệu Answers to Mastery Checks Module 1: C++ Fundamentals ppt
PREMIUM
Số trang
43
Kích thước
1.3 MB
Định dạng
PDF
Lượt xem
1553

Tài liệu Answers to Mastery Checks Module 1: C++ Fundamentals ppt

Nội dung xem thử

Mô tả chi tiết

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.

2

C++ A Beginner’s Guide by Herbert Schildt

14. // Convert Jovian years to Earth years.

15. When a function is called, program control transfers to that function.

16. // Average the absolute values of 5 numbers.

3

C++ A Beginner’s Guide by Herbert Schildt

Module 2: Introducing Data Types and Operators

1. The C++ integer types are

The type char can also be used as an integer type.

2. 12.2 is type double.

3. A bool variable can be either true or false.

4. The long integer type is long int, or just long.

5. The \t sequence represents a tab. The \b rings the bell.

6. True, a string is surrounded by double quotes.

7. The hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.

4

C++ A Beginner’s Guide by Herbert Schildt

8. To initialize a variable, use this general form:

type var = value;

9. The % is the modulus operator. It returns the remainder of an integer division. It cannot be used

on floating-point values.

10. When the increment operator precedes its operand, C++ will perform the corresponding

operation prior to obtaining the operand's value for use by the rest of the expression. If the

operator follows its operand, then C++ will obtain the operand's value before incrementing.

11. A, C, and E

12. x += 12;

13. A cast is an explicit type conversion.

14. Here is one way to find the primes between 1 and 100. There are, of course, other solutions.

Module 3: Program Control Statements

1. // Count periods.

Tải ngay đi em, còn do dự, trời tối mất!