Ch 2 Quiz

Ace your homework & exams now with Quizwiz!

Every complete C++ program must have a ________. Select one: a. function named main b. comment c. symbolic constant d. preprocessor directive e. cout statement

a. function named main

________ represent storage locations in the computer's memory. Select one: a. Literals b. Variables c. Comments d. Integers e. None of these

b. Variables

Which character signifies the beginning of an escape sequence? Select one: a. // b. \ c. { d. / e. #

b. \

A variable whose value can be either true or false is of this data type. Select one: a. binary b. bool c. T/F d. float e. None of these

b. bool

What is the modulus operator? Select one: a. % b. * c. || d. + e. &

a. %

These are data items whose values do not change while the program is running. Select one: a. Literals b. Variables c. Comments d. Integers e. None of these

a. Literals

In programming terms, a group of characters inside a set of quotation marks is called aNo: Select one: a. String literal b. Variable c. Operation d. Statement e. None of these

a. String literal

Which escape sequence causes the cursor to move to the beginning of the current line? Select one: a. \r b. \b c. \t d. \n e. \a

a. \r

In C++ 11, the ________ tells the compiler to determine the variable's data type from the initialization value. Select one: a. auto key word b. #include preprocessor directive c. variable's name d. dynamic_cast key word e. None of these

a. auto key word

n memory, C++ automatically places a ________ at the end of string literals. Select one: a. Semicolon b. Quotation marks c. Null terminator d. Newline escape sequence e. None of these

c. Null terminator

A statement that starts with a # symbol is called a: Select one: a. Comment b. Function c. Preprocessor directive d. Key word e. None of these

c. Preprocessor directive

This control sequence is used to skip over to the next horizontal tab stop. Select one: a. \' b. \n c. \t d. \h e. \a

c. \t

The ________ causes the contents of another file to be inserted into a program. Select one: a. Backslash b. Pound sign c. Semicolon d. #include directive e. None of these

d. #include directive

Character constants in C++ are always enclosed in ________. Select one: a. (parentheses) b. {braces} c. [brackets] d. 'single quotation marks' e. "double quotation marks"

d. 'single quotation marks'

For every opening brace in a C++ program, there must be a: Select one: a. String literal b. Function c. Variable d. Closing brace e. None of these

d. Closing brace

In C++ 11, if you want an integer literal to be treated as a long long int, you can append ________ at the end of the number. Select one: a. L b. <INT> c. I d. LL e. None of these

d. LL

Which data type typically requires only one byte of storage? Select one: a. float b. double c. int d. char e. short

d. char

A character literal is enclosed in ________ quotation marks, whereas a string literal is enclosed in ________ quotation marks. Select one: a. double, single b. triple, double c. open, closed d. single, double e. None of these

d. single, double

The first step in using the string class is to #include the ________ header file. Select one: a. iostream b. cctype c. cmath d. string e. None of these

d. string

Which one of the following would be an illegal variable name? Select one: a. dayOfWeek b. itemsorderedforthemonth c. June1997 d. _employee_num e. 3dGraph

e. 3dGraph

Of the following, which is a valid C++ identifier? Select one: a. June1997 b. _employee_number c. ___department d. myExtraLongVariableName e. All of these are valid identifiers.

e. All of these are valid identifiers.

This function in C++ allows you to identify how many bytes of storage on your computer system an integer data value requires. Select one: a. bytes b. f(x) c. int d. len e. sizeof

e. sizeof

The float data type is considered ________ precision, and the double data type is considered ________ precision. Select one: a. single, double b. float, double c. integer, double d. short, long e. None of these

a. single, double

Besides decimal, two other number systems you might encounter in C++ programs are: Select one: a. Octal and Fractal b. Hexadecimal and Octal c. Unary and Quaternary d. Base 7 and Base 9 e. None of these

b. Hexadecimal and Octal

This is used to mark the end of a complete C++ programming statement. Select one: a. Pound Sign b. Semicolon c. Data type d. Void e. None of these

b. Semicolon

In a C++ program, two slash marks ( // ) indicate: Select one: a. The end of a statement b. The beginning of a comment c. The end of the program d. The beginning of a block of code e. None of these

b. The beginning of a comment

________ must be included in any program that uses the cout object. Select one: a. Opening and closing braces b. The header file iostream c. Comments d. Escape sequences e. None of these

b. The header file iostream

You must have a ________ for every variable you intend to use in a program. Select one: a. purpose b. definition c. comment d. constant e. None of these

b. definition

Which of the following defines a double-precision floating point variable named payCheck? Select one: a. Double payCheck; b. double payCheck; c. float payCheck; d. payCheck double;

b. double payCheck;

If you use a C++ key word as an identifier, your program will: Select one: a. Execute with unpredictable results b. not compile c. understand the difference and run without problems d. Compile, link, but not execute e. None of these

b. not compile

Assuming you are using a system with 1-byte characters, how many bytes of memory will the following string literal occupy? "William" Select one: a. 14 b. 7 c. 8 d. 1

c. 8

These are used to declare variables that can hold real numbers. Select one: a. Integer data types b. Real data types c. Floating point data types d. Long data types e. None of these

c. Floating point data types

The ________ is/are used to display information on the computer's screen. Select one: a. Opening and closing braces b. Opening and closing quotation marks c. cout object d. Backslash e. None of these

c. cout object

The numeric data types in C++ can be broken into two general categories: Select one: a. numbers and characters b. singles and doubles c. integer and floating point d. real and unreal e. None of these

c. integer and floating point

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? Select one: a. name = (Jane); b. name = 'Jane'; c. name = "Jane"; d. name = Jane;

c. name = "Jane";

A variable's ________ is the part of the program that has access to the variable. Select one: a. data type b. value c. scope d. reach e. None of these

c. scope


Related study sets

Shock, Sepsis, and Multiple Organ Dysfunction Syndrome (Iggy ch. 37 & Urden ch. 34)

View Set

Fundamentals CH 21, 37-38, 11-17

View Set

management exam #2 cengage flashcards chapter 6

View Set

Pharm: 54 Sexually Transmitted Infections, 53: Men's Health , 5: Pediatric Considerations, 52 Women's Health (Test 1)

View Set

Psychology A Concise Introduction Chapter 3

View Set

Human Resources-chapter 3- Not definitions

View Set