C++ Quiz 2

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

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)

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 )

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)

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 )

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

d. ('single quotation marks' )

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)

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 )

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)

What will the following code display? int number= 7; cout<< "The number is "<< "number" << endl; Select one: a. The number is number b. The number is 0 c. The number is7 d. The number is 7

a. (The number is number)

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)

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)

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)

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 )

________ 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 )

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. (b. sizeof )

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 )

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 )

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)

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 )

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 )

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

c. (double payCheck; )

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)

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 )

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 )

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)

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)

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 character signifies the beginning of an escape sequence? Select one: a. \ b. # c. { d. / e. //

a. (\)

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 )

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)

Which of the following correctly consolidates the following declaration statements into one statement? 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;)

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)

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)

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

a. (% )

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

b. (\t)


संबंधित स्टडी सेट्स

Cardiovascular System - The Heart (Chapter 18)

View Set

MGMT 352 Strategic Management Final Exam Prep Part II

View Set

The Midwife's Apprentice Ch 10-12

View Set

Choosing Precise Words to Eliminate Wordiness and Redundancy by LegitSwag69

View Set