Chapter 2

Ace your homework & exams now with Quizwiz!

True

Escape sequences are always stored internally as a single character

Variable

storage location in memory Has a name and a type of data it can hold Must be defined before it can be used

Scope

the part of the program in which the variable can be accessed A variable cannot be used before it is defined

The cout Object

Displays output on the computer screen You use the stream insertion operator <<

Closing brace

For every opening brace in a C++ program, there must be a:

Null terminator

In memory, C++ automatically places a ___________ at the end of string literals.

False

The C++ language requires that you give variables names that indicate what the variables are used for.

The char Data Type

Used to hold characters or very small integer values Usually 1 byte of memory Numeric value of character from the character set is stored in memory:

%

What is the modulus operator?

double payCheck;

Which of the following defines a double-precision floating point variable named payCheck?

True

C++ does not have a built in data type for storing strings of characters.

Determining the Size of a Data Type

The sizeof operator gives the size of any data type or variable

The #include Directive

This is a preprocessor directive, not part of C++ language Inserts the contents of another file into the program

Character Literals

must be enclosed in single quote marks. Example: 'A'

identifier

programmer-defined name for some part of a program: variables, functions, etc. The first character of must be an alphabetic character or and underscore ( _ ),

Literal

value that is written into a program's code.

Named constant (constant variable)

variable whose content cannot be changed during program execution Used for representing constant values with descriptive names: ex: const double TAX_RATE = 0.0675; const int NUM_STATES = 50; Often named in uppercase letters

string

The first step in using the string class is to #include the ___________ header file.

single, double

The float data type is considered _____ precision, and the double data type is considered _______ precision.

Floating-Point Data Types

The floating-point data types are: float double long double They can hold real numbers such as: 12.45 -3.8 Stored in a form similar to scientific notation All floating-point numbers are signed Float = single precision Double = double precision Long double = long double precision

Character Strings

A series of characters in consecutive memory locations: ex: "Hello" Stored with the null terminator, \0, at the end: Comprised of the characters between the " " Special data type supports working with strings #include <string>

The bool Data Type

Represents values that are true or false stored as small integers false is represented by 0, true by 1:

3dGraph

Which one of the following would be an illegal variable name?

The endl Manipulator

You can use this manipulator to start a new line of output. This will produce two lines of output. You can also use the \n escape sequence.


Related study sets

World History 1st Semester Final Units 1-5

View Set

Networking with Windows Server 2016 (Exam 70-741)

View Set

The Confederation and the Constitution, 1776-1790

View Set

Intuit Final Interview- Communicatio Skills and Commitment to the Job

View Set

Operations Management dExam 1 Review

View Set

BCOR 2304 Strategy and Entrepreneurship (Chapter 3)

View Set

Concepts additional practice Qs: Values, Beliefs, Caring, Health and Wellness, Communication

View Set

Certmaster CE Security+ Domain 4.0 Security Operations

View Set

Chapter 2 Fundamentals of Respiratory Care

View Set