CS 1336.008 Homework 02

¡Supera tus tareas y exámenes ahora con Quizwiz!

Which of the following hexadecimal numbers is equivalent to the binary number 11110110? a. 0xF4 b. 0x76 c. 0xE6 d. 0xF6 e. 0xE4

d. 0xF6

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

d. function named main

Which of the following binary numbers is equivalent to the hexadecimal number 0x30? a. 01010000 b. 00110000 c. 01110000 d. 00011000 e. 01100000

b. 00110000

Which of the following correctly consolidates the following declaration statements into one statement? int x = 7; int y = 16; int z = 28; Select one: a. int x, y, z= 7, 16, 28 b. None of these will work. c. int x=7, y=16, z=28; d. int x=7; y=7; z=28; e. int x= 7 y=4 z=4

c. int x=7, y=16, z=28;

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

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

c. scope

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. not compile

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 of the following hexadecimal numbers is equivalent to the binary number 00111100? a. 0x3C b. 0x1D c. 0x2C d. 0x4A e. 0x3B

a. 0x3C

What is the value of cookies after the execution of the following statements? int number= 38, children=4, cookies; cookies = number % children; Select one: a. 2 b. 0 c. 9 d. .5 e. None of these

a. 2

Which of the following decimal numbers is equivalent to the hexadecimal number 0xFC? a. 252 b. 1512 c. 15 d. 27 e. 12

a. 252

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. 8 b. 14 c. 7 d. 1

a. 8

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

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

In C++, which symbol is used to represent the modulus operator? a. % b. + c. || d. & e. *

a. %

What will the following code display? cout << "Monday"; cout << "Tuesday"; cout << "Wednesday"; Select one: a. MondayTuesdayWednesday b. Monday Tuesday Wednesday c. "Monday" "Tuesday" "Wednesday" d. Monday Tuesday Wednesday

a. MondayTuesdayWednesday

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

a. \

Which data types are used in C++ to store real numbers (select all that apply). a. float b. double c. int d. byte e. char f. long int g. string

a. float b. double

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

b. 12

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: 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 the above

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

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

b. Variables

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

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. int b. sizeof c. bytes d. f(x) e. len

b. sizeof()

Look at the following program and answer the question that follows it. Note: The bold numbers are line numbers for reference and not part of the program. 1 // This program displays my gross wages. 2 // I worked 40 hours and I make $20.00 per hour. 3 #include <iostream> 4 using namespace std; 5 6 int main() 7 { 8 int hours; 9 double payRate, grossPay; 10 11 hours = 40; 12 payRate = 20.0; 13 grossPay = hours * payRate; 14 cout << "My gross pay is $" << grossPay << endl; 15 return 0; 16 } Which line(s) in this program cause output to be displayed on the screen? Select one: a. 13 b. 15 c. 14 d. Lines 8 and 9 e. Lines 13 and 14

c. 14

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

c. 3dGraph

In 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 \0

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

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

c. char

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

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

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.

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

e. \r


Conjuntos de estudio relacionados

Energy changes and chemical reactions

View Set

History of Photography Final Exam

View Set

Othello - Love and Relationships

View Set

Physics Practice Questions- Ch. 16-17

View Set

Chapter 16 inflammation and immunity study with chapter 39

View Set

Unit 9 Intellectual Property (okrent)

View Set