Semicolon

Question: What statement is used to make decisions:

if

Question: Comments cause the computer to print the text after the // on the screen when

the program is executed:

False

Question: The escape sequence \n, when output with cout and the stream insertion

operator, causes the cursor to position to the beginning of the next line on the screen

True

Question: All variables must be declared before they are used

True

Question: All variables must be given a type when they are declared

True

Question: C++ considers the variables number and NuMbEr to be identical

False

Question: Declarations can appear almost anywhere in the body of a C++ function

True

Question: The modulus operator (%) can be used only with integer operands

True

Question: The arithmetic operators *, /, %, + and all have the same level of precedence

False

Question: A C++ program that prints three lines of output must contain three statements

using cout and the stream insertion operator

False

Question: Declare the variables c, thisIsAVariable, q76354 and number to be of type int.

int c, thisIsAVariable, q76354, number;

Question: Prompt the user to enter an integer. End your prompting message with a colon

(:) followed by a space and leave the cursor positioned after the space

std::cout << "Enter an integer: ";

Question: Read an integer from the user at the keyboard and store the value entered in

integer variable age.

std::cin >> age;

Question: If the variable number is not equal to 7, print "The variable number is not

equal to 7".

if (number!= 7) std::cout << "The variable number is not equal to 7\n";

Question: Print the message "This is a C++ program" on one line.

std::cout << "This is a C++ program\n";

Question: Print the message "This is a C++ program" with each word on a separate line.

std::cout << "This\nis\na\nC++\nprogram\n";

Question: Print the message "This is a C++ program" with each word separated from the

next by a tab. std::cout << "This\tis\ta\tC++\tprogram\n";

Question: Identify and correct the errors in the following statement (assume that the

statement using std::cout; is used):

if (c < 7);

cout << "c is less than 7\n";.

if (c < 7) cout << "c is less than 7\n";

Question: Identify and correct the errors in the following statement (assume that the

statement using std::cout; is used):

if (c => 7) cout << "c is equal to or greater than 7\n";

if (c >= 7) cout << "c is equal to or greater than 7\n";

Question: A house is to a blueprint as a(n) _________ is to a class

Object

Question: Every class definition contains keyword _________ followed immediately by

the class's name

Class

Question: A class definition is typically stored in a file with the _________ filename

extension

.h

Question: Each parameter in a function header should specify both a(n) _________ and

a(n) _________.


Понравилась статья? Добавь ее в закладку (CTRL+D) и не забудь поделиться с друзьями:  



double arrow
Сейчас читают про: