CIS C++ Chapter 2 Quiz

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

For every opening brace in a C++ program, there must be a:

Closing brace

Of the following, which is a valid C++ identifier?

All of the above are valid identifiers. (June1997, _employee_number, __department, myExtraLongVariableName)

The ___ is/are used to display information on the computer's screen.

cout object

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

scope

A character literal is enclosed is ___ quotation marks, whereas a string literal is enclosed in ___ quotation marks.

single, double

The float data type is considered ___ precision, and the double data type is considered ___ precision.

single, double

This function in C++ allows you to identify how many bytes of storage on your computer system an integer data value requires.

sizeof

___ represents storage locations in the computer's memory.

Variables

The ___ causes the contents of another file to be inserted into a program.

#include directive

What is the modulus operator?

%

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

12

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

2

What will the value of x be after the following statements execute? int x; x = 18 % 4;

2

Which one of the following would be an illegal variable name?

3dGraph

What will the value of x be after the following statements execute? int x; x = 18.0 / 4;

4

These are used to declare variables that can hold real numbers.

Floating point data types

Besides decimal, two other number systems you might encounter in C++ programs are:

Hexadecimal and Octal

These are data items whose values do not change while the program is running.

Literals

In programming terms, a group of characters inside a set of quotation marks is called a(n):

String literal

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?

name = "Jane";

If you use a C++ keyword as an identifier, your program will:

not compile

The first step in using the string class is to #include the ___ header file.

string

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

definition

Which of the following defines a double-precision floating point variable named payCheck?

double payCheck;

Every complete C++ program must have a ___.

function named main

Character constants in C++ are always enclosed in ___.

'single quotation marks'

In memory, C++ automatically places a ___ at the end of string literals.

Null terminator

A statement that starts with a # symbol is called a:

Preprocessor directive

This is used to mark the end of a complete C++ programming statement.

Semicolon

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

The beginning of a comment

___ must be included in any program that uses the cout object.

The header file iostream

Which character signifies the beginning of an escape sequence!

\

Which escape sequence causes the cursor to move to the beginning of the current line?

\r

This ccontrol sequence is used to skip over to the next horizontal tab stop.

\t

A variable whose value can be either true or false is of this data type.

bool

Which says type typically requires only one byte of storage?

char

Which of the following correctly consolidates the following declaration statements into one statement? int x = 7; int y = 16; int z = 28;

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

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

integer and floating point

Assume that a program has the following variable definition: char letter; Which of the following statements correctly assigns the character Z to the variable?

letter = 'Z';


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

Cognitive Psychology, psych 128 Fresno State, FSU Psych 128 exam 1, AP Psychology - Chapter 3 pages 101-128, psych 128 exam 1, Psych 128 Exam 1 Review, Psych 128- Fresno State- Dr. Oswald, Cognitive Psychology: Chapter 2, Intro to Cognitive Psycholog...

View Set

English Four Story Test Study Guide

View Set

CompTIA Network + Guide to Networks - Chapter 1 Review Questions

View Set

Linux Practice Questions and Quizzes

View Set

Chapter 1 Environmental Science: Understanding Our Environment

View Set

Early Intervention: Welcome to Baby Watch

View Set

Exam 2 - Strategic Management (MGMT 3013)

View Set

Micro Chapter 3 bacterial cell structure

View Set