Programming with C++ Chapter 2 Exam Prep

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

A char literal can be enclosed either in single or double quotes? T/F

False. Only single quotes enclose a char literal. Double quotes around a single character define a string literal.

A reserved word is a named constant that is predefined in C++, True or False?

False. Reserved words are used in many ways in C++.

What danger is associated with the use of the /* and */ firm of comment, and is avoided by the use of the // comment?

If we forget the */ at the end of a comment, then any amount for program code can be inadvertently included in the comment. The // form avoids this by automatically terminating at the end of the line.

What does the #include preprocessor directive do?

It tells the C++ preprocessor to insert the contents of a specified file at that point in the code.

Can we concatenate endl with a string in an expression? Explain

No. The endl identifier is a manipulator, and is not a string value.

What is the name of the << operator, and how might we pronounce it in reading a line of code that contains it?

<< is the stream insertion operator, and is pronounced "put to" or "is sent," as in "cout is sent string4."

Metalanguage

A language that is used to write the rules for another language.

Identifier

A name that is used to refer to a function or data object.

Data type

A specific set of values, along with the operations that can be applied to those values.

Function

A subprogram of C++.

Literal

A value that appears in a program.

Expression

An arrangement of identifiers, literals, and operators that can be evaluated.

Named constant

An identifier referring the a value that cannot be changed.

Variable

An identifier referring to a value that can be changed.

How do we insert a double quote into a string?

By preceding it with a backslash character (\").

How do you write a string that is too long to fit on a single line?

By splitting it into pieces that fit on a line, and joining them together with the concatenation operator.

What are the limitations associated with the // form of comment?

The // form of comment cannot span more than one line. It also cannot be inserted into the middle of a line of code because everything to the right of // becomes a comment.

Syntax

The formal rules governing how valid instructions are written in a programming language.

Semantics

The set of rules that determines the meaning of instructions written in a programming language.

Concatenation works with a char value only when its other operand is a string value. T/F

True

The null string represents a string containing no characters? T/F

True.

What is the name of the C++ construct that begins with { and ends with }

a block


Set pelajaran terkait

Sudden Cardiac Death in Athletes

View Set

5.2-5.5 Notes, 5.6/5.7, 5.9, 5.10, 5.11

View Set

C708 - Principles of Finance - Unit 4 Quiz

View Set

CHFI - Chapter 8 (Investigating Web Attacks)

View Set

Nursing Concepts - Cardiovascular

View Set

Chapter 4: Loops: Participation Activities

View Set