C++ chapter 4

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

The ______ provides a convenient way to merge the source code from one file with the source code in another file, without having to retype the code.

#include directive

The symbol for the extraction operator in C++ is _________

>>

The ________ combines the object file with other machine code necessary for your C++ program to run correctly.

Linker

The ________ stream manipulator advances the cursor to the next line on the computer screen

endl

A _______ error occurs when you break one of the programming language's rules

syntax

A source file has an extension of _______

.cpp

The insert a comment into a C++ program you begin the line with _______.

//

List comments that should be on the C++ program

//name date //project //declaring variables //enter input items //calculations //display //end program

The using directive ends with a _____

;

The symbol for the insertion operator is C++ is ________

<<

The _______ symbol in an assignment statement is called the assignment operator

=

T/F The c++ instructions entered in a program are called source code and are saved in a source file, which has an extension of.c

False

T/F a stream is defined in C++ as a sequence of words

False

T/F the cin object typically is used with the insertion operator (<<)

False

Which are easier to locate, syntax or logic errors? why?

Syntax error because they trigger an error message from the C++ compiler.

Why is it important that each cin statement should be preceded by an accompanying cout statement?

The cout statement prompts the user to enter something (because the user has to know what has to be entered)

T/F A program should display (on the computer screen) a separate and meaningful prompt for each item of data the user should enter.

True

T/F Machine code is usually called object code

True

T/F Sytax errors are much easier to locate than logic errors

True

T/F The execution of a C++ program begins with the main function.

True

T/F the cin object tells the computer to pause program execution while the user enters one or more characters at the keyboard

True

T/F the following statement adds a value of 1 to the sum variable: sum += 1;

True

T/F the processing of locating and correcting the errors in a program is called debugging

True

How should the average calculation below be modified to compute the correct average of the two numbers? int num1 = 10; int num2 = 20; double average = 0.0; average = num1 + num2 / 2;

average = (static_cast <double> (num1) + static_cast <double> (num2)) / 2.0

Add the necessary stream manipulators to the following statement to produce the following output: A BC D Note that you can only add the appropriate stream manipulators, not the string literal constants within the cout statements. cout << "A"; cout << "B"; cout << "c"; cout << "D";

cout << "A" << endl; cout << "BC" << end1; cout << "D" << end1;

An IDE (Integrated Development Environment) contains both the ________ and ________ in one integrated environment.

editor, compiler

The file containing all of the machine code necessary to run your C++ program as many times as desired without the need for translating the program again is called the _______

executable file

The _______ step in the problem-solving process is to code the algorithm into a program

fourth

The first line in a function is called the function _________

header

Write the C++ statements to declare a variable called age, and prompt the user for their age.

int age - 0; cout << "Enter the age: "; cin >> age;

The ______ file must be included in any program that uses the cin or cout objects

iostream

A ______ error is often difficult to find, and can occur for many reasons, such as entering instructions in the incorrect order.

logic

The #include directive ends with a _______

none of the above

The operator with the highest precedence number in C++ is ______.

parentheses

The ______ step in the problem-solving process is to evaluate and modify the program

sixth

The original program instructions entered into an editor is called the ________

source code

Explicit type conversion is accomplished in C++ with the ________ operator.

static_cast

A ________ is defined in C++ as a sequence of characters.

stream

The object used in C++ to handle standard input and output operations are called ______ objects

stream

Write the equivalent C++ statement of the following statement using a single arithmetic assignment operator. sum = sum + 47;

sum + = 47;

Which C++ program instruction will subtract a value of 1 from the sum variable?

sum -= 1;

Dividing one integer by another integer in C++ may not give you the result you are expecting. Explain, including an example, what occurs in C++ when one integer is divided by another integer.

two integers divided by each other is always going to equal a integer. So for example, 10 divided by 3 is 3 as an integer, but that's not the exact answer. It chops off the extra decimals to make it an integer.

The symbol for the modulus operator in C++ is _________

%

The function _______ is the code contained between a function's opening and closing braces.

body

The _________ step in the problem-solving process in to desk-check the program

fifth

The _______ tells the compiler where it can find the definitions of keywords and classes.

using directive

The extraction operator stops removing characters from the cin object when it encounters a _________

white-space character

The _________ object tells the computer to pause program execution while the user enters one or more characters at the keyboard.

Cin


Conjuntos de estudio relacionados

Study Plan Questions - Marketing Test 2

View Set

RN- General information- NCLEX STYLE QUESTIONS- MED SURG

View Set

Internal Medicine EORE- Vignettes

View Set

Fundamentals of Nursing - Test 1

View Set

physics misconceptual questions test 3

View Set

Unit 7: Chemical and Waste Management Part 1

View Set