C++ ch. 2

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

a. single, double

the float data type is considered __________ precision and the double data type is considered __________ precision a. single, double b. double, single c. floating-point, double d. floating-point, integer e. none of these

d. all of these are true

a multi-line comment... a. begins with /* and ends with */ b. can be used to mark as many lines as desired as comments c. allows everything in the selected lines to be ignored d. all of these are true

a. true

a named constant is like a variable, but its content cannot be changed while the program is running a. true b. false

d. preprocessor directive

a statement starts with a # symbol is called a... a. comment b. function c. preprocessor directive d. header file e. none of these

b. function named main

every complete C++ program must have a... a. comment b. function named main c. symbolic constant d. cout statement e. none of these

c. the variable's name and the type of data it will hold

a variable definition tells the computer... a. the variable's name and its value b. the variable's data type and its value c. the variable's name and the type of data it will hold d. whether the variable is an integer or a floating-point number e. none of these

c. scope

a variable's __________ is the part of the program that has access to the variable a. data type b. value c. scope d. assignment e. none of these

c. name = "Jane";

assuming that a program has the following string object definition, which statement correctly assigns the string literal "Jane" to the string object? string name; a. name = Jane; b. name = 'Jane'; c. name = "Jane"; d. name = <Jane>; e. string name = (Jane);

b. string literal

in the following statement, the characters Hello! are a(n) __________ cout << "Hello!"; a. variable b. string literal c. comment d. object e. none of these

b. 12

what is the output of the following statement? cout << 4 * (15 / (1 + 3)) << endl; a. 15 b. 12 c. 63 d. 72 e. none of these

a. 2

what is the value of cookies after the following statements execute? int number = 38, children = 4, cookies; cookies = number % children; a. 2 b. 4 c. 9 d. 9.5 e. .5

c. your choice is 1

what will be the output after the following lines of code execute? bool choice; choice = true; cout << "your choice is " << choice << endl; a. true b. your choice is true c. your choice is 1 d. your choice is choice e. none of these

c. the number is number

what will the following code display? int number = 23; cout << "the number is " << "number" << endl; a. the number is 23 b. the number is23 c. the number is number d. the number is null e. the number is

b. double payCheck;

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

d. 1user

which of the following is not a valid C++ identifier? a. April2018 b. employee_number c. _1user d. 1user e. theLittleBrownFoxWhoRanAway

c. #include <string>

which of the following lines must be included in a program that has string variables? a. #include (string class) b. #include namespace std; c. #include <string> d. string var; e. none of these

b. the header file iostream

which of the following must be included in any program that uses the cout object? a. opening and closing braces b. the header file iostream c. comments d. a namespace e. none of these

c. letter = 'M';

which of the following statements correctly assigns the character M to the variable named letter? a. letter = M b. letter = "M"; c. letter = 'M'; d. letter =(M); e. letter = M;

c. const double TAX_RATE = 0.075;

which of the following statements correctly defines a named constant name TAX_RATE that holds the value of 0.075? a. double TAX_RATE = 0.075; b. const TAX_RATE; double = TAX_RATE = 0.075 c. const double TAX_RATE = 0.075; d. double TAX_RATE; const TAX_RATE = 0.075; e. const TAX_RATE = 0.075;

c. user's name is janedoe

which part of the following line is ignored by the compiler? double userName = "janedoe"; // user's name is janedoe a. "janedoe" b. user's name is c. user's name is janedoe d. // e. none of these


Ensembles d'études connexes

Arm Muscles and Clinical Correlations, PrepU Upper Extremity questions for test 3, Anatomy Exam 2

View Set

Which of the following properties are chemical and which are physical?

View Set

Level I Antiterrorism Awareness Training (2 hrs) [Pre-Test]

View Set

AP Computer Science Essay Questions Assessment

View Set

Ch 9: Nursing Care of the Growing Fetus

View Set

CH 8: Therapeutic Communication

View Set

Chapter 22 : The Respiratory System

View Set

management final ch 1-3. multiple choice

View Set