1,24,5,6,7,9

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

Is the following comments written using single-line or multi-line comment symbols? / * This program was written by M. A. Codewriter * /

Multi-Line

To pass an array to a function, pass the _____ of the array.

Name

The subscript of the last element in a single- dimension array is one less than the total number of elements in the array.

TRUE

The ______ indicates the number of elements, or values, an array can hold.

Size declarator

By using the same ______ for multiple arrays, you can build relationships between the data stored in the arrays.

Subscript

Each element of an array is accessed and indexed by a number known as a(n) _______.

Subscript

What is the difference between a syntax error and a logical error?

Syntax Errors are illegal uses of key word, operators, punctuation, and other language elements. Logical Errors are mistakes that cause the program to produce erroneous results.

What type of software controls the internal operations of the computers hardware?

System Software

What is the difference between system software and application software?

System Software includes the Operating Systems, Utility Programs, Software Development Tools. Application Software includes programs used by the user.

The values in an initialization list are stored in the array in the order that they appear in the list.

TRUE

To calculate the amount of memory used by an array, multiply the number of elements by the number of bytes each element uses.

TRUE

To pass an array to a function, pass the name of the array.

TRUE

When an array is passed to a function, the function has access to the original array.

TRUE

When defining a parameter variable to hold a single-deminsional array argument, you do not have to include the size declarator.

TRUE

You can write programs that use invalid subscripts for an array.

TRUE

You cannot use the assignment operator to copy one array's contents to another in a single statement.

TRUE

The if statement regards an expression with the value 0 as ______.

False

A variable defined in an inner block may not have the same name as a variable defined in the outer block.

False.

Function headers are terminated with a semicolon.

False.

In a nested loop, the outer loop executes faster than the inner loop.

False.

It is not necessary to initialize counter variable.

False.

It's safe to assume that all uninitialized variable automatically start with 0 as their value.

False.

One limitation of the for loop is that only one variable may be initialized in the initialization expression.

False.

The = operator and the == operator perform the same operation when used in a Boolean expression.

False.

The break statement causes a loop to stop the current iteration and begin the next one.

False.

The continue statement causes a terminated loop to resume.

False.

The cout statement in the following program segment will display 5: int x = 5; cout << ++x;

False.

The do-whole loop is a pretest loop.

False.

The for loop is a post test loop.

False.

The operand of the increment and the decrement operators can be any valid mathematical expression.

False.

To calculate the total number of iterations of a nested loop, add the number of iterations of all the loops.

False.

When a function terminates, it always branches back to the main, regardless where it was called from.

False.

When an if statement is nested in the else part of another statement, as in an if else if, the only time the inner if is executed is whenthe expression of the outer if is true.

False.

x = 5, y = 6, z = 8. T/F 2 != y && z != 4

False.

x = 5, y = 6, z = 8. T/F x == 5 || y > 3

False.

x >= y is the same as (x > y && x = y)

False.

A _____ is a diagram that graphically illustrates the structure of the program.

Flowchart

**** A two- demensional array is like several identical arrays put together.

TRUE

**Subscript numbers may be stored in variables.

TRUE

C++ allows you to create arrays with three or more dimensions.

TRUE

C++ allows you to partially initialized an array.

TRUE

Its best to think of two-dimensional arrays as having rows and columns.

TRUE

The individual elements of an array are accessed and indexed by unique numbers.

TRUE

The exit function can only be called from the main.

False

When a function with default arguments is called and an argument is left out, all arguments that come after it must be left out as well.

True

A condtionally executed statement should be indented one level from the if statement.

True.

A variable may be defined in the initialization expression of the for loop.

True.

All lines in a block should be indented one level.

True.

All three of the for loops expressions may be omitted.

True.

Arguments are passed to the function parameters in the order they appear in the function call.

True.

Function prototypes are terminated with a semicolon.

True.

Functions should be given names that reflect their purpose.

True.

If other functions are defined before the main, the program still starts executing at the main function.

True.

In a function prototype, the names of the parameter variables may be left out.

True.

In a nested loop, the break statement only interrupts the loop it is placed in.

True.

In a nested loop, the inner loop foes through all of its iterations for every single iteration of the outer loop.

True.

Many functions may have local variables with the same name.

True.

Overuse of global variables can lead to problems.

True.

Static local variables are not destroyed when a function returns.

True.

The cout statement in the following program segment will display 5: int x = 5; cout << x++;

True.

The scope of a variable is limited to the block in which it is defined.

True.

The scope of the parameter is limited to the function which uses it.

True.

The while loop is a pretest loop.

True.

Variables may be defined inside the body of a loop.

True.

______ variables are defined outside all functions and are accessible to any function within their scope.

global

______ variables provide an easy way to share large amounts of data among all the functions in a program.

global

The ______ is the part of a function definition that shows the function name, return type, and parameter list.

header

_____ languages are close to the level of humans in terms of readability.

high-level

To ______ a value means to increase it by one and to ______ a value means to decrease by one.

increment, decrement To increment a value means to increase it by one and to decrement a value means to decrease by one.

When a function uses a mixture of parameters with and without default arguments, the parameters with default arguments must be defined ______.

last

The logical operators have ______ Associativity.

left-to-right

The ___ search algorithm steps sequentially through an array, comparing each item with the search value.

linear/sequential

The ____ search algorithm is adequate for small arrays but not large arrays.

linear/sequential

A ______ variable is defined inside a function and is not accessible outside the function.

local

If a function had a local variable with the same name as a global variable, only the ______ variable can be seen by the function.

local

_____ languages are close to the level of the computer.

low-level

The if/else statement is actually a form of the ______ if statement.

nested

A loop that is inside another is called a ______ loop.

nested A loop that is inside another is called a nested loop.

Two or more functions may have the same name, as long as their ______ are different.

parameter lists

Special variables that hold copies of function argument are called ______.

parameters

A program's ability to run on several different types of computer systems is called _____.

portability

When the increment or decrement operator is placed after the operand (or to the operands right), the operand is being used in the ______ mode.

postfix When the increment or decrement operator is placed after the operand (or to the operands right), the operand is being used in the postfix mode.

A loop that evaluates its test expression after each repetition is an ______ loop.

posttest A loop that evaluates its test expression after each repetition is an posttest loop.

The number inside the brackets of an array definition is the _____________, but the number inside an array's brackets in an assignment statement, or any other statement that works with the contents of the array, is the __________.

size declarator, subscript

A relational expression is either ______ or ______.

true, false

In an if/else statement, the if past executes its statement or block if the expression is ______, and else part executes its statement or block if the expression is ______.

true, false

When only a copy of an argument is passed to a function, it is said to be passed by ______.

value

A _____ is a named storage location.

variable

If a function doesn't return a value, the word ______ will appear as its return type.

void

The ______ and ______ loops will not iterate at all if their test expressions are false to start with.

while and for The while and for loops will not iterate at all if their test expressions are false to start with.

If the sub-expression on the left of an ______logical operator is true, the right sub expression is not checked.

||Or

The ______ logical operator works best when testing a number to determine if it is outside a range.

||Or

The ______logical operator has higher precedence than the other logical operators.

! Net

Modify the following program so it prints two blank lines between each line of text. #include <iostream> using namespace std; int main() { cout << "Two mandolins like creatures in the"; cout << "dark"; cout << "Creating the agony of ecstasy."; cout << " -George Barker"; return 0; }

#include <iostream> using namespace std; int main() { cout << "Two mandolins like creatures in the\n"; cout << endl; cout << "dark\n"; cout << endl; cout << "Creating the agony of ecstasy.\n"; cout << endl; cout << " -George Barker"; return 0; }

Reference variables are defined like regular variables, except there is an ______ in front of the name.

&

If the sub-expression on the left of the ______ logical operator is false. the right sub expression is not checked.

&& And

The ______ logical operator works best when testing a number to determine if it is within a range.

&& And

If an array is partially initialized, the uninitialized elements will be set to _____.

0

Subscript numbering in C++ always starts with a _____.

0

How many operands does each of the following types of operators require? _____ Unary _____ Binary _____ Ternary

1, 2, 3

You cannot use the ___ operator to copy data from one array to another in a single statement.

=

You use the ______ operator to determine whether one string object is greater then another string object.

> Greater

What will the following programs print on the screen? A) #include <iostream> using namespace std; int main() { int freeze = 32, boil = 212; freeze = 0 boil = 100 cout << freeze << endl << boil << endl; return 0; } B) #include <iostream> using namespace std; int main() { int x = 0, y = 2; x = y * 4; cout << x << endl << y << endl; return 0; } C) #include <iostream> using namespace std; int main() { cout << "I am the incredible"; cout << "computing\nmachine"; cout << "\nand I will\namaze\n"; cout << "you."; return 0; } D) #include <iostream> using namespace std; int main() { cout << "Be careful\n"; cout << "This might \n be a trick "; cout << "Question\n; return 0; } E) #include <iostream> using namespace std; int main() { int a, x = 23; a = x % 2; cout << x << endl << a << endl; return 0; }

A) 0 100 B) 8 2 C) I am the incredible computing machine and I will amaze you. D) Be careful This might be a trick Question E) 23 1

Preprocessor directives begin with a A) # B) ! C) < D) * E) None of the above

A) #

Assume w = 5, x = 4, y = 8, and z = 2. What value will be stored in result in each of the following statements? A) result = x + y; B) result = z * 2; C) result = y / x; D) result = y - z; E) result = w % 2;

A) 12 B) 4 C) 2 D) 6 E) 1

How would each of the following numbers be represented in E notation? A) 3.287 x 10^6 B) -978.65 x 10^12 C) 7.65491 x 10^-3 D) -58710.23 x 10^-4

A) 3287000 B) -978650000000000 C) .00765491 D) -5.871023

When do preprocessor directive execute? A) Before the compiler compiles your program B) After the compiler compiles your program C) A the same time your compiler compiles your program D) None of the above

A) Before the compiler compiles your program

A group of statements, such as the contents of a function, is enclosed in A) Braces {} B) Parentheses () C) Brackets <> D) All of the above will do

A) Braces {}

The negation operator is A) Unary B) Binary C) Ternary D) None of the above

A) Unary

The following data 72 'A' "Hello World" 2.8712 are all examples of A) Variables B) Literals or constants C) Strings D) None of the above

A) Variables

Write assignment statements that perform the following operations with the variables a, b and c. A) Adds 2 to a and stores the result in b. B) Multiplies b times 4 and stores the result in a. C) Divides a by 3.14 and stores the result in b. D) Subtracts 8 from b and stores the result in a. E) Stores the value 27 in a. F) Stores the character 'K' in c. G) Stores the ASCII code for 'B' in c.

A) b = a + 2; B) a = b * 4; C) b = a / 3.14; D) a = b - 8; E) a = 27; F) c = 'K'; G) c = 66;

What value will be stored in the variable t after each of the following statements executes? A) t = (12 > 10); _____ B) t = (2 < 0); _____ C) t = (5 == (3 * 2)); _____ D) t = (5 == 5); _____

A) t = 22 B) t = 2 C) t = 22 D) t = 10

Any time the name of an array is used without brackets and a subscript, it is seen as _________.

Address

Explain the difference between an object file and an executable file?

An object file is the location that holds the translated machine language. Once the Linker has finished, it becomes an executable file.

Internally, the CPU consist of the _____ and the _____.

Arithmetic and Logic unit, Control Unit

Which of the following are NOT valid assignment statements? (all that apply) A) total = 9; B) 72 = amount; C) profit = 129; D) letter = 'W';

B) 72 = amount;

Which of the following are NOT valid cout statements? A) cout << "Hello World"; B) cout << "Have a nice day"\n; C) cout < value; D) cout << programming is great fun;

B) cout << "Have a nice day"\n; C) cout < value; D) cout << programming is great fun;

Why is it easier to write a program in a high - level language then in machine language?

Because Machine Language consists of 1's and 0's. (0010011100101001)

Why must programs written in a high - level language be translated into machine language before they can be run?

Because a computer's CPU can only understand Machine Language.

C++ has no array _________ checking, which means you can inadvertently store data past the end of an array.

Bounds

Which of the following statements is correct? A) #include (iostream) B) #include {iostream} C) #include <iostream> D) #include [iostream] E) All of the above

C) #include <iostream>

A(n) _____ is like a variable, but its value is read-only and cannot be changed during the program's execution. A) secure variable B) uninitialized variable C) named constant D) locked variable

C) named constant

Every complete statement ends with a A) period B) # symbol C) semicolon D) ending brace

C) semicolon

The job of the _____ is to fetch instructions, carry out the operations commanded by the instructions, and produce some outcome or resultant information.

CPU

Every C++ program must have a A) cout statement B) function main C) #include statement D) All of the above

D) All of the above

T/F You cannot initialize a named constant that is declared with the const modifier.

False

An array's size declarator can be either a literal, a named constant, or a variable.

FALSE

Arrays cannot be initialized when they are defined. A loop or other means must be used.

FALSE

If an array is partially initialized, the uninitialized elements will contain "garbage".

FALSE

If you leave an element uninitialized, you do not have to leave all the ones that follow it uninitialized.

FALSE

If you leave out the size declarator of an array definition, you do not have to include an initialization list.

FALSE

The contents of an array element cannot be displayed with cout.

FALSE

The first element of an array is accessed by the subscript 1.

FALSE

The first size declarator in the declaration of a two- dimensional array represents the number of columns. The second size declarator represents the number of rows.

FALSE

The uninitialized elements of a string array will automatically be set to the value "0".

FALSE

Two-dimensional arrays may be passed to functions, but the row size must be specified in the definition of the parameter variable.

FALSE

When an array name is used without brackets and a subscript, it is seen as the value of the first element in the array.

FALSE

All static variables are initialized to -1 by default.

False

Changes to a function parameter always affect the original argument as well.

False

It is not possible for a function to have some parameters with default arguments and some without.

False

T/F Variable names may begin with a number.

False

Starting values for an array may be specified with a(n) _________ list.

Initialization

If the size declarator of an array definition is omitted, C++ counts the number of items in the _________ to determine how large the array should be.

Initialization list

_____ is information a program gathers from the outside world.

Input

_____ is the only language computers really process.

Machine Language

Both main memory and secondary storage or types of memory. Describe the difference between the two.

Main memory is like RAM and Secondary Storage is like the Hard Drive.

_____ are characters or symbols that perform operations on one or more operands.

Operators

_____ is information a program sends to the outside world.

Output

Computers can do many different jobs because they can be _____.

Programmed

_____ characters or symbols mark the beginning or ending of programming statements, or separate items in a list.

Punctuation

Is the following comment written using single-line or multi-line comment symbols? // this program was written by M. A. Codewriter

Single-Line

A stub is a dummy function that is called instead of the actual function it represents.

True

Initialization of static local variables only happen once, regardless of how many times the function in which they are defined is called.

True

T/F A left brace in a C++ program should always be followed by a right brace later in the program.

True

T/F A variable must be defined before it can be used.

True

T/F Variable names may be up to 31 characters long.

True

The if statement regard an expression with a nonzero value as ______.

True

When an if statement is nested in the if part of another statement, the only time the inner if is executed is when the expression of the outer if is true.

True.

When you call an ofstream object's open member function, the specified file will be erased if it already exists.

True.

x != y is the same as (x > y || x < y)

True.

x = 5, y = 6, z = 8. T/F 7 <= x && z > 4

True.

x = 5, y = 6, z = 8. T/F x >= 0 || x <= y

True.

y < x is the same as x >= y

True.

Unless you explicitly initialize global variables, they are automatically initialized to ______.

Zero

A ______ is a variable that is initialized to some starting value, usually zero, and then has numbers added to it in each iteration of a loop.

accumulator An accumulator is a variable that is initialized to some starting value, usually zero, and then has numbers added to it in each iteration of a loop.

Values that are sent into a function are called ______.

arguments

Data arranged from lowest to highest order. This is ____ order.

ascending

The ____ search algorithm repeatedly divides the portion of an array being searched in half.

binary

The _____ search algorithm requires the array's contents be sorted.

binary

A search algorithm is working on a 100 element array. It immediately begins working on a 50 element chunk of the array. This is most likely a _____ algorithm.

binary search

A variable with ______ scope is only visible when the program is executing in the block containing the variable's definition.

block

The statement or block that is repeated is known as the ______ of the loop.

body The statement or block that is repeated is known as the body of the loop.

For an if statement to conditionally execute a group of statements, the statements must be enclosed in a set of ______

braces

A program will "fall through" a case section if it is missing the ______ statement.

break

The ______ statement causes a loop to terminate immediately.

break

This algorithm makes several passes through an array and causes the larger values to gradually move toward the end of the array with each pass.

bubble sort

Which of the following can be used to arrange data in either ascending or descending order?

bubble sort selection sort insertion sort ALL OF THE ABOVE

An expression using the ______ operator is called an conditional expression.

conditional

The value of a default argument must be a ______.

constant

The ______ statement causes a loop to skip the remaining statements in the current iteration.

continue

A ______ is a variable that counts the number of times a loop repeats.

counter A counter is a variable that counts the number of times a loop repeats.

The trailing else is an if/else if statement that has similar purposed as the ______ section of a switch statement.

default

______ arguments are passed to parameters automatically if no argument is provided in the function call.

default

A variable must be _____ before it can be used in a program.

defined

Either a functions ______ or its ______ must precede all calls to the function.

definition, prototype

Data arranged from highest to lowest order is called _____ order.

descending

The ______ loop always iterates at least once.

do-while The do-while loop always iterates at least once.

How may int variables months, days, and years be defined in one statement, with months initialize to two and years initialized to three?

double months = 2, days, years = 3;

How may the double variables temp, weight, and age be defined in one statement?

double temp, weight, age;

The ______ function causes a program to terminate.

exit

The value of a relational expression is 0 if the expression is ______, or 1 if the expression is ______.

false, true

The______ loop is ideal for situations that require a counter.

for The for loop is ideal for situations that require a counter.

A loop that does not have a way of stopping is called an ______ loop.

infinite or endless A loop that does not have a way of stopping is called an endless loop.

Inside the for loop's parentheses, the first expression is the ______, the second expression is the ______, and the third expression is the ______.

initialization, test, update Inside the for loop's parentheses, the first expression is the initialization, the second expression is the test, and the third expression is the update.

The three primary activities of a program are _____, _____, and _____.

input, processing, output

This algorithm begins by sorting the first two elements of the array, which become the sorted subset. Then, the third element is moved to it's correct position relative to the first two elements. At that point, the first three elements become the sorted subset. This process continues with the fourth and subsequent elements until the entire array is sorted.

insertion sort

A program is a set of _____.

instructions

The expression that is tested by a switch statement must have an ______ value.

integer

The expression following a case statement must be an ______.

integer constant

The size declarator must be a(n) _________ with a value greater than _________.

integer, 0

The selection sort is very efficient because _____.

it moves swapped data to its final position in the array

Each repetition of a loop is known as a ______.

iteration Each repetition of a loop is known as an iteration.

Words that have special meaning in a programming language are called _____.

key words

When the increment or decrement operator is placed before the operand (or to the operands left) the operator is being used in the ______ mode.

prefix When the increment or decrement operator is placed before the operand (or to the operands left) the operator is being used in the prefix mode.

A loop that evaluates its test expression before each repetition is an ______ loop.

pretest A loop that evaluates its test expression before each repetition is an pretest loop.

Since computers can't be programmed in natural human language, algorithms must be written in a _____ language.

program

Words or names defined by the programmer are called _____.

programmer-defined identifiers

A ______ eliminates the need to place a function definition before all calls to the function.

prototype

Reference variables allow arguments to be passed by ______.

reference

When used as parameters, ______ variables allow a function to access the parameters original argument.

reference

An expression using the greater than, less than, greater than or equal to, less than or equal to, equal, or not equal to operator is called a ______ expression.

relational

The ______ statement causes a function to end immediately.

return

Its best to think of a two-dimensional array as having _________ and _________.

rows, columns

A ______ is a sum of numbers that accumulated with each iteration of a loop.

running total A running total is a sum of numbers that accumulated with each iteration of a loop.

A ____ algorithm is used to locate a specific value in a dynamic variable.

searching

In this algorithm, the smallest value in the array is located and moved to element 0. Then the next smallest value is located and moved to element 1. This process continues until all of the elements have been placed in their proper order.

selection sort

Which of the following sorts is more efficient for large arrays?

selection sort

A ______ is a special value that marks the end of a series of values.

sentinel A sentinel is a special value that marks the end of a series of values.

A ____ algorithm is used to rearrange data into some specific order.

sorting

______ local variables retian their value between function calls.

static

The rules that must be followed when constructing a program are called _____.

syntax


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

Finance Ch 15 - Capital Structure

View Set

Pharm Test Specific Neurodegenerative Disorders

View Set

Chapter 2 (formulating hypotheses and research questions)

View Set