C++ Chapter 2

Ace your homework & exams now with Quizwiz!

These are data items whose values do not change while running the program

Constants

What causes output to be displayed on screen

cout

A variable's ________ is the part of the program that has access to the variable

scope

A character literal is enclosed in ________ quotation marks, whereas a string literal is enclosed in ______ quotation marks

single, double

What is the Modulus Operator

%

Which of the following would be an illegal variable name? dayOfWeek Correct 3dGraph _employee_num June1997 itemsorderedforthemonth

3dGraph

These are used to declare variables that can hold real numbers

Floating point data types

What will the following code display? cout << "Four\n" << "score\n"; cout << "and" << "\nseven"; cout << "\nyears" << " ago" << endl; Four score and seven years ago Four score and seven years ago Four score and seven years ago Four score and seven years ago

Four score and seven years ago

Besides decimal, two other number systems you might encounter in C++ programs are:

Hexadecimal and Octal

If you use a c++ keyword as an identifier, your program will:

Not Compile

In programming terms, a group of characters inside a set of quotation marks is call a(n)

String Literal

Which character signifies the beginning of an escape sequence?

\

Assume that program has the following variable definition: char letter; Which of the following statements correctly assigns the character Z to the variable? letter = Z; letter = "Z"; letter = 'Z'; letter = (Z);

letter = 'Z';

Assume that a program has the following string object definition: string name; Which of the following statements correctly assigns a string literal to the string object? name = Jane; name = "Jane"; name = 'Jane'; name = (Jane);

name = "Jane";

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

A closing brace

You must have a _______ for every variable you intend to use in a program

definition

Every complete C++ program must have a ________

function named main

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

Null Terminator

a statement that starts with a # symbol is called a:

Preprocessor directive

This is used to mark the end of a complete C++ programming statement

Semicolon

In a C++ program, two slash marks (//) indicate:

The beginning of a comment

What will the following code display? int number = 7; cout<< "The number is " << "number" << endl;

The number is 7

The numeric data types in C++ can be broken into two general categories:

integer and floating point

Of the following, which is a valid C++ identifier? June1997 _employee_number ___department myExtraLongVariableName These are all valid identifiers.

These are all valid identifiers.

A variable whose value can be either true or false is of this date type

bool


Related study sets

Western Civilizations Final Exam Study Sheet

View Set

PSYCHIATRIC/MENTAL HEALTH NURSING

View Set

Li- Knowledge and clinical judgment/Nursing Concepts / PRIORITY/

View Set

SAU Conceptual Physics Dynamic Study Module CH.7

View Set

OSHA 10: Walking Working Surfaces

View Set

Marketing Final Exam Chapter's 10,11, & 12

View Set

Fundies IV Midterm + Final (ALL) Quizzes

View Set

3.1 ATP Synthase and Chemiosmosis Theory

View Set