CSI-130 Quiz 2

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Charcater constants in C++ are always enclosed in

Single Quotation Marks ( ' ')

When typing your source code into the computer, you should be careful since most of your C++ instructions, header files, and variable names and case sensitive. (T/F)

TRUE

Which of the following must be included in any program that uses the cout object - opening and closing - braces - the header file iostream - comments - a namespace - None of these

The header file iostream

What will the following code display int number = 23; cout << "The number is " << "number" << endl;

The number is number

In the following statement, the character Hello! Are a(n) cout << "Hello!";

string literal

In a C++ program, two slash marks (//) indicate

the beginning of a comment

Which of the following lines must be included in a program that has a string variable? - #include (string class) - #include namespace std; - #include <string> - string var; - None of these

#include <string>

The ______ causes the content of another file to be inserted into a program.

#include directive

What is the output of the following statement cout << 4 * (15 / (1 + 3)) << endl;

12

A character literal is ____, whereas a string literal is ______

Enclosed single quotation marks, enclosed in double quotation marks

Because C++ is case-sensitive, all programs must have a function called main or Main. (T/F)

FALSE

C++ 11 introduced an alternative way to define variables, using the template keyword and an initialization value. (T/F)

FALSE

In C++ you are required to name your variables so they indicate the purpose they will be used for. (T/F)

FALSE

In programming, the terms "line and "statement" always mean the same thing. (T/F)

FALSE

The preprocessor executes after the compiler. (T/F)

FALSE

What will the following code display? cout << "Four\n" << "score\n"; cout << "and" << "\nseven"; cout << "\nyears" << " ago" << endl;

Four score and seven years ago

Every complete C++ program must have a

Function named main

In C++, if you want an integer literal to be treated as a long long int, you can append ____ at the end of the number.

LL

Data items whose values do not change while the program is running are

Literals

What will the following code display cout << "Monday"; cout << "Tuesday"; cout << "Wednesday";

MondayTuesdayWednesday

In memory, C++ automatically places a(n) _____ at the end of string literals which ______

Null terminal, marks the end of the string

What will the following code display? cout << "Roses " << "are red"; cout << "and " << "violets/n" cout << "are" << "blue" << endl;

Roses are redand violets/nareblue

A named constant is like a variable, but its content cannot be changed while the program is running. (T/F)

TRUE

A value is stored in a variable with an assignment statement. (T/F)

TRUE

C++ does not have a built-in data type for storing strings of data. (T/F)

TRUE

Escape sequences are always stored internally as a single character. (T/F)

TRUE

Floating point constants are normally stored in memory as doubles. (T/F)

TRUE

Floating-point constants are normally stored in memory as doubles. (T/F)

TRUE

In C++, key words are written in all lowercase letters. (T/F)

TRUE

Programming style refers to the way a programmer uses elements such as identifiers, spaces, and blank lines. (T/F)

TRUE

The preprocessor reads a program before it is compiled and only executes those lines beginning with a # symbol. (T/F)

TRUE

Which part of the following line is ignored by the compiler? double userName = "janedoe"; // user's name is janedoe

User's name is jane doe

You must have a ____ for every variable you intend to use in a program

Variable Definition

What will be the output after the following lines of code execute? bool choice; choice = true; cout << "Your choice is " << choice << endl;

Your choice is 1

which control sequence is used to skip over to the next horizontal tab stop?

\t

Which data type typically requires only one byte of storage

char

For every opening brace ( { ) in a C++ program, there must be a

closing brace

Which of the following statements correctly defines a named constant named TAX_RATE that holds the value 0.075? - double TAX_RATE = 0.075; - const TAX_RATE; - double TAX_RATE = 0.075; - const double TAX_RATE = 0.075; - double TAX_RATE;const - TAX_RATE = 0.075; - const TAX_RATE = 0.075;

const double TAX_RATE = 0.075;

The ______ is(are) used to display information on the computer's screen.

cout object

Using C++ 11: What data type does the compiler determine for the variable cost in the following statement? auto cost = 14.95;

double

Which of the following defines a double-precision floating-point variable named paycheck? - float payCheck; - double payCheck; - payCheck double; - Double payCheck;

double payCheck;

In a cout statement which of the following will advance the output position to the beginning of the next line - endl or \n - end1 or /n - \n or \t - \t or \b - \\ or \'

endl or \n

The data type used to declare variables that can hold real numbers is

float

The float data type is considered _____ precision and the double data type is considered ______ precision

single, double

Which of the following is NOT a valid C++ identifier - April2018 - employee_number - _1user - 1user - theLittleBrownFoxWhoRanAway

1user

What is the value of cookies after the following statements execute? int number = 38, children = 4, cookies; cookies = number % children;

2

What will the following code display? int x = 23, y = 34, z = 45; cout << x << y << z << endl;

233445

What is the value stored in the variable myNum after the following assignment statements execute myNum = 23 % 5

3

What is the value of the number after the following statements execute? int number; number = 18 % 4 + 2;

4

What is the value of the number after the following statements execute? int number; number = 18 / 4;

4

A multi line comment -begins with /* and ends with */ -can be used to mark as many lines as desired as comments -allows everything in the selected lines to be ignored -All of these are true

All of these are true

A variable definition tells the computer

The variables name and the type of data it will hold

The data type of a variable whose value can be either true or false is

bool

The numeric data types in C++ can be broken into two general categories which are

integers and floating-point numbers

Which of the following statements correctly assigns the character M to the variable named letter? - letter = M - letter = "M"; - letter = 'M'; - letter = (M); - letter = M;

letter = 'M';

Assuming that a program has the following string object definition, which statement correctly assigns the string literal "Jane" to the string object? string name; - name = Jane; - name = 'Jane'; - name = "Jane"; - string name = {Jane};

name = "Jane";

Besides the decimal number system that is most common (base 10), two other number systems that can be used in C++ programs are

octal and hexadecimal

A statement that starts with a hashtag (or pound) symbol (#) is called a

prepoccesor directive

A variable's _________ is the part of the program that has access to the variable

scope

A(n) ______ represents a storage location in the computer's memory.

variable


Set pelajaran terkait

ch 53-Deinstitutionalization of American Marriage, ch 52- Bad boys, ch 54-promises i can keep, ch 51-a school in a garden, ch 58-Cosmopolitan Canopy,ch 56--Regime Change and Revolution, Chapter 41: McDonald's

View Set

PMP® Exam Questions - Chapter 7 Project Cost Management

View Set

Essential Neuroscience 3rd Ed Siegel and Sapru Quizzes Ch 1, 3, 5, 6, 8-11, 13, 14, 18-20, 22, 25-27

View Set

Italian Study Guide Final 7 (question-answer)

View Set

10.10 Unit Test: The House on Mango Street

View Set

Mnemonics for Early/Middle/Late 8 (Shriberg)

View Set