Ch 2 Quiz

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

b. bool

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

c. Preprocessor directive

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

e. 3dGraph

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

d. #include directive

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

c. cout object

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

a. %

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

b. \

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

d. char

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

a. \r

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

b. double payCheck;

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. definition

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. The header file iostream

________ 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. Variables

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

c. Null terminator

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

d. single, double

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

c. name = "Jane";

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. 8

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

a. function named main

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

d. Closing brace

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

c. scope

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

b. Hexadecimal and Octal

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

d. 'single quotation marks'

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

b. not compile

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

d. LL

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

a. auto key word

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

b. The beginning of a comment

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

a. String literal

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

e. All of these are valid identifiers.

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.

d. string

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

a. single, double

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

c. integer and floating point

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

a. Literals

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

c. Floating point data types

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. \t

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

e. sizeof

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

b. Semicolon

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


Ensembles d'études connexes

Policy Provisions and Contract Law

View Set

Quiz 2: Chapter 14- Depressive Disorders

View Set

Threats, Attacks, and Vulnerabilities

View Set

98-365 Ch4 Directory Services in Windows Server

View Set