COSC 1436- FINAL EXAM

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

A file must be ______ before data can be written to or read from it. A) closed B) opened C) buffered D) initialized E) None of these

B

A function _______ eliminates the need to place a function definition before all calls to the function. A) header B) prototype C) argument D)parameter E) none of these

B

A _____ argument is passed to a parameter when the actual argument is left out of the function call. A) false B) true C) null D) default E) None of these

D

What will the value of x be after the following statements execute? int x = ; x = 18 % 4 A) 4 B) 0.45 C) unknown D) 2

D

Which of the following would be an illegal variable name? A) dayOfWeek B) June1997 C) _employee_num D) itemsorderedforthemonth E) 3dGraph

E

During which stage does the CPU retrieve from the main memory the next instruction in the sequence of program instructions? A) fetch B) execute C) portability stage D) decode

A

The do-while loop Is a(n) ________ loop that is ideal in situations where you always want the loop to iterate at least once A) post-test B) pre-test C) infinite D) null-terminated E) None of these

A

The name of an array stores the _______ of the first array element A) memory address B) value c) element number D) data type E) None of these

A

The purpose of a memory address is: A) To identify the location of a byte in memory B) To prevent multitasking C) To obtain an algorithm D) To improve the effectiveness of high-level languages E) None of these

A

The statement cin >> setw(10) >> str; will read up to this many characters into str A) 9 B) 10 C) 11 D) 8 E) None of the above

A

These are data items whose values do not change while the program is running. A) Literals B) Variables C) Comments D) Integers E) None of these

A

This function tells the cin object to skip one or more characters in the keyboard buffer. A) cin.ignore B) cin.jump C)cin.hop D) cin.skip E) none of these

A

To allow file access in a program, you must #include this header file. A) fstream B) fileaccess C) file D) cfile

A

To write data to a file, you define an object of this data type. A) ofstream B) ifstream C) fstream D) outputFile

A

True/ False: One reason for using functions is to break programs into manageable units, or modules A) True B) False

A

True/False: A static variable that is defined within a function is initialized only once, the first time the function is called A)True B) False

A

True/False: Multiple relational expressions cannot be placed into the test condition of a for loop A) true B) false

A

True/False: string objects have a member function named c_str that returns the contents of the object formatted as a null-terminated C-string. A) True B) False

A

True/False• The update expression of a for loop can contain more than one statement, e.g. counter++, total+= sales A) true B) false

A

What is assigned to the variable a given the statement below with the following assumptions: x = 10, y = 7, and z, a, and b are all int variables a = x >= y; A) 1 B) 0 C) The string "X >= Y" D) 10 E) 7

A

What is the value of cookies after the execution of the following statements? int number = 38, children = 4, cookies; cookies = number % children; A) 2 B) 0 C) 9 D) .5 E) None of these

A

What is the value of the following expression TRUE | | FALSE A) true B) -1 C) +1 D) false

A

Programmer-defined names of memory locations that may hold data are: A) Operators B) Variables C) Syntax E) None of these

B

Something within a while loop must eventually cause the condition to become false, or a(n)______ results. A) null value B) infinite loop C) unexpected exit D) compiler error E) None of these

B

A variable's ________ is the part of the program that has access to the variable. A) data type B ) value C) scope D) reach E) none of these

C

In C++, if you want an integer literal to be treated as long long int, you can append _____ at the end of the number. A) L B) <INT> C) I D) LL E) none of these

D

Every complete C++ program must have a _____________. A) comment B) symbolic constant C) preprocessor directive D) cout statement E) function name

E

In a function header, you must furnish: A) data type(s) of the parameters B) data type of the return value C) the name of function D) names of parameter variables E) All of these

E

Of the following, which is a valid C++ identifier? A) June1997 B) _employee_number C) ___department D) myExtraLongVariableName E) All of these are valid identifiers

E

Which of the following is a common input device? A) Keyboard B) Mouse C) Scanner D) Microphone E) all of the above

E

This vector function returns the number of elements in a vector. A) length B) elements C) size D) num_elements

C

True/False: A local variable and a global variable may not have the same name within the same program. A) true B) false

B

When a program lets the user know that an invalid choice has been made. This is known as: A) input validation B) output correction C) compiler criticism D) output validation E) None of these

A

For every opening brace in a C++ program, there must be a: A) String literal B) Function C) Variable D) Closing braces E) None of these

D

What is the output of the following program? #include <ioscream> using namespace std; int getValue(int); int main ( ) { int x = 2; cout << getValue(x) << endl; return 0; } int getValue (int num) { return num + 5; } A) 5 B) 2 C) "getValue(x)" D) 7

7

A for statement contains three expressions: initialization, test, and A) update B) reversal C) null D) validation E) None of these

A

A variable declaration announces the name of a variable that will be used in a program, as well as: A) The type of data it will be used to hold B) The operators that will be used on it C) The number of times it will be used in the program D) The area of the code in which it will be used E) None of these

A

A(n) _______ can be used to specify the starting values of an array. A) initialization list B) array name C) subscript D) element E) None of these

A

An array can easily be stepped through by using a A) for loop B) reference variable C) named constant D) null value E) None of these

A

What will the following code display? cout << "Four" << "score"<< endl; cout << "and" << "seven"<< endl; cout << "years" << "ago"<< endl; A) Fourscore andseven yearsago B) Four score and seven years ago C) Four score and seven years ago D) Fourscoreandsevenyearsago

A

A set of well-defined steps for performing a task or solving a problem is known as a(n): A) Hierarchy B) Algorithm C) Central Processing Unit D) Encoded instruction E) None of these

B

A variable whose value can be either true or false is of this data type A) binary B) bool C) T/F D) float E) None of these

B

What is the value of donuts after the following code executes: int donuts = 10; if (donuts = 1) donuts= 0 else donuts += 2; A) 1 B) 10 C) 0 D) 12

C

When writing functions that accept multi-dimensional arrays as arguments, _______ must be explicitly stated in the parameter list. A) all dimensions B) all but the first dimension C) the size declarator of the first dimension D) all element values E) None of these

B

Which character signifies the beginning of an escape sequence? A) // B) \ C) # D) { E) /

B

Which of the following best describes an operator? A) An operator is a word that has a special meaning B) An operator allows you to perform operations on one or more pieces of data C) An operator marks the beginning or ending of a statement or is used to separate times in a list D) An operator is a symbolic name that refers to a variable E) An operator is a rule that must be followed when constructing a program

B

Which of the following is not one of the five major components of a computer system? A) Input/Output device •B) Preprocessor C) The CPU (central processing unit) D) Main memory E) Secondary storage device

B

You must have a _____ for every variable you intend to use in a program A) purpose B) definition C) comment D) constant E) none of these

B

You must have a ________ for every variable you intend to use in a program. A) purpose B) definition C) comment D) constant E) none of these

B

______ must be included in any program that uses cout object A) opening and closing brackets B) the header file iostream C) comments D) escape sequences E) none of these

B

_______ read a line of input, including leading and embedded spaces, and stores it in a string object. A) cin.get B) getline C) cin.getline D)get E) none of these

B

________ functions may have the same name, as long as their parameter lists are different. A) Only two B) Two or more C) zero D) Un-prototyped E) None of these

B

A(n) ______ is a diagram that shows the logical flow of a program A) UML diagram B) flowchart C) Hierarchy chart D) Program Schematic E) None of these

B) flowchart

This statement will pause the screen, until the [enter] key is pressed. A) cin.ignore( ); B) cin; C) cin.get( ); D) cin.getline( ); E) cin.input( );

C

This stream manipulator forces cout to print the digits in fixed-point notation. A) setprecision(2) B) setw(2) C) fixed D) setfixed(2) E) none of these

C

This term refers to the programmer reading the program from the beginning and stepping through each statement. A) Psuedocoding B) Software Engineering C) Desk Checking D) Spot Checking E) None of these

C

Three primary activities of a program are: A) Variables, Operators, and Key Words B) Lines, Statements. and Punctuation C) Input, Processing, and Output D Integer, Floating-point, and Character E) None of these

C

What is the last legal subscript that can be used with the following array? int values[5]; A) 0 B) 5 c) 4 D) 6

C

What is the output of the following segment of code if the value 4 is input by the user when asked to enter a number? int num; int total = 0; cout << "Enter a number from 1 to 10: "; cin >> num; switch (num) { case 1: case 2: total = 5; case 3: total = 10; case 4: total = total + 3; case 8: total = total + 6; default: total = total + 4; A) 0 B) з C) 13 D) 28 E) None of these

C

What statement best describes a variable and its primary purpose? A) A variable is a collection of eight bits. B) A variable is a structured, general-purpose language designed primarily for teaching programming. C) A variable is a named storage location in a computer's memory used for holding a piece of information. D) A variable is a word that has a special meaning to the compiler E) A variable is a "line" of code in the body of a program, which may change.

C

What will be the value of result after the following code has been executed? int a = 60; int b = 15; int result = 10; if (a = b) result *= 2; A) This code will not compile. B) 120 C) 20 D) 10

C

What will the following code display: int x = 0; for (int count = 0; count < 3; count++) x+= count; cout << x << endl; A 0 1 2 B) 6 C) 3 D) 0

C

When the final value of an expression is assigned to a variable, it will be converted to: A) the smallest C++ data type B) the largest C++ data type C) The data type of the variable D) The data type of the expression E) none of these

C

Which escape sequence causes the cursor to move to the beginning of the current line? A) \b B) \n C) \r D) \t E) \a

C

It is _________ to pass an argument to a function that contains an individual array element, such as numbers [3] A) illegal in C++ B) legal in C++ C) not recommended by the ANSI committee D) not good programming practice E) None of these

B

It is a good programming practice to your functions by writing comments that describe what they do A) execute B) document C) eliminate D) prototype E) None of these

B

Look at the following function prototype. int myFunction(double); What is the data type of the function's return value? A) double B) int C) void D) Can't tell from prototype

B

Mistakes that cause a running program to produce incorrect results are called: A) Syntax errors B) Logic errors C) Compiler errors D) linker errors E) None of these

B

Programmer-defined names of memory locations that may hold data are: A) Operators B) Variables C) Syntax D) Operands E) None of these

B

The programmer usually enters source code into a computer using the: A) Pseudocode B) A text editor C) A hierarchy chart D) A compiler E) None of these

B

The while loop contains an expression that is tested for a true or false value, and a statement or block that is repeated as long as the expression: A) is false B) is true C) does not evaluate to true or false D) evaluates to true or false E) none of these

B

These operators connect two or more relational expressions into one or reverse the logic of an expression. A) relational B) logical C) irrational D) negation E) None of these

B

These types of arguments are passed to parameters automatically if no argument is provided in the function call. A) Local B) Default C) Global D) Relational E) None of these

B

This is a complete instruction that causes the computer to perform some action. A) Line B) Statement C) Variable D) Key Word E) None of these

B

This is a pre-test loop that is ideal in situations where you do not want the loop to iterate if the condition is false from the beginning. A) do- while B) while C) for D) infinite E) none of these

B

This is a variable that is regularly incremented or decremented each time a loop iterates. A) constant B) counter C) control statement D) null terminator E) none of these

B

This is used in a program to mark the beginning or ending of a statement, or separate items in a list. A) Separators B) Punctuation C) Operators D) Keywords E) None of these

B

This operator performs a logical NOT operation A) -- B) ! C) <> D) >< E) None of these

B

This step will uncover any syntax errors in your program. A) Editing B) compiling C) linking D) Executing E) None of these

B

To access an array element, use the array name and the element's A) data type B) subscript C) name D) value E) None of these

B

True/False: Although two-dimensional arrays are a novel idea. there is no known way to pass one to a function. A) True B) False

B

True/False: Assume array1 and array2 are the names of arrays. To assign the contents of array2 to array1, you would use the following statement. array1 = array2; A)True B)False

B

True/False: If you attempt to store data past an array's boundaries, it is guaranteed that the compiler will issue an error. A) True B) False

B

True/False: In C++ 11, the range-based for loop is best used in situations where you need the element subscript for some purpose. A) True B) False

B

True/False: The increment and decrement operators can be used in mathematical expressions; however, they cannot be used in relational expressions. A) True B) False

B

True/False: The statement: double money [25.00]; is a valid C++ array definition. A) True B) False

B

True/False: When a function is called, flow of control moves to the function's prototype A) True B) False

B

True/False: You may not use the break and continue statements within the same set of nested loops A) True B) False

B

True/raise: Local variables are initialized to zero by default A) True B) False

B

What does the term hardware refer to? A) The relative difficulty of programming B) The physical components that a computer is made of C) The way a computer's storage space is organized D) The logical flow of instructions E) None of these

B

What is the output of the following code? int w = 98; int x = 99; int y = 0; int z = 1; if ( >= 99) cout << y << endl; else cout << z << endl; } else { if ( x == 99) cout << x << endl; else cout << w << endl; } A) 0 B) 1 C) 99 D) 98

B

What is the output of the following statement? cout << 4 * (15 / (1 + 3)) << endl; A) 15 B) 12 C) 63 D) 72 E) None of these

B

What will the value of x be after the following statements execute? int x; x = 18.0 / 4; A) 4.5 B) 4 C) unknown D) .45 E) none of these

B

What will the value of x be after the following statements execute? int x; x= 18 / 4; A) unknown B) 4 C) 0 D) 4.5

B

When the increment operator precedes its operand, as in ++num1, the expression is in this mode. A) postfix B) prefix C) preliminary D) binary E) none of these

B

Which line in the following program will cause a compiler error? 1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 const int MY_VAL = 77; 7 MY_VAL = 99; 8 cout << MY_VAL << endl; 9 return 0; 10 } A) 6 B) 9 C) 7 D) 8

C

Which line in the following program will cause a compiler error? 1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 const int MY_VAL; 7 MY_VAL = 77; 8 cout << MY_VAL << endl; 9 return 0; 10 } A) 9 B) 8 C) 6 D) 7

C

Which statement will read an entire line of input into the following string object? string address; A) cin << address; B) cin address; C) getline(cin, address); D) cin.get(address) E) None of the above

C

Words that have a special meaning and may be used only for their intended purpose are known as: A) Operators B) Programmer Defined Words C) Key Words D) Syntax E) None of these

C

You may define a _____ in the initialization expression of a for loop. A) constant B) function C) variable D) new data type E) None of these

C

______ are used to translate each source code instruction into the appropriate machine language instruction. A) Modules B) Library routines C) Compilers D) Preprocessor directives E) None of these

C

internally, the CPU consists of two parts: A)The Output Device and the Input Device B) The Software and the Hardware C) The Control Unit and the Arithmetic and Logic Unit D) The Single-task device and the multi-task device E) None of these

C

This is a volatile type of memory, used for temporary storage. A) Address B) ALU C) RAM D) Disk drive E) none of these

C) RAM

A set of well-defined steps for performing a task or solving a problem is Known A) Hierarchy B) Algorithm C) Central Processing Unit D) Encoded instruction E) None of these

D

A two-dimensional array of characters can contain A) strings of the same length B) strings of different lengths C) uninitialized elements D) All of these E) None of these

D

An example of a secondary storage device is: A) The commuter's main memory B) The keyboard C) The monitor D) The disk drive E) None of these

D

An integrated Development Environment typically consists of: A) A text editor B) A compiler C) A debugger D) All of these E) None of these

D

At the heart of a computer is its central processing unit. The CPU's job is: A) To fetch instructions B) To carry out the operations commanded by the instructions C) To produce some outcome or resultant information D) All of these E) None of these

D

Character literals are enclosed in ________; string literals are enclosed in ________. A) double, single B) triple, double C) open, closed D) single, double E) None of these

D

How many elements does the following array have? int bugs [1000]; A) 1001 B) 999 C) Cannot tell from the code D) 1000

D

In the process of translating a source file into an executable file, which of the following is the correct sequence? A) Source code, linker, object code, compiler, modified source code, preprocessor, executable code B) preprocessor, source code, compiler, executable code, linker, modified source code, object code C) Source code, preprocessor, modified source code, linker, object code, compiler, executable code D) Source code, preprocessor, modified source code, compiler, object code, linker, executable code E) Source code, compiler, modified source code, preprocessor, object code, linker, executable code

D

Input values should always be checked for A) Appropriate range B) reasonableness C) Division by zero, if division is taking place D) All of these E) None of these

D

The ______ decodes an instruction and generates electrical signals. A) Arithmetic and Logic Unit B) Main memory C) BIOS D) Control Unit E) None of these

D

The _______ causes the contents of another file to be inserted into a program. A) Backslash B) Pound sign C) Semicolon D) #include directive E) none of these

D

The ________ is automatically appended to a character array when it is initialized with a string constant. A) array name B) number of elements C) value of the first element D) null terminator E) None of these

D

The first step in using the string class is to #include the ______ header file. A) iostream B) cctype C) cmath D) string E) none of these

D

The first step in using the string class is to #include the _______ header file A) iostream B) cctype C) cmath D) string E) None of these

D

The name for a memory location that may hold data is: A) A keyword B) Syntax C) Operator D) Variable E) None of these

D

The range-based for loop, in C++ 11, is designed to work with a built-in variable known as the A) counter variable B) i variable C) iterator D) range variable E) None of these

D

The statement. int grades [ ] ={ 100, 90, 99, 80}; shows an example of: A) default arguments B) an illegal array declaration C) an illegal array initialization D) implicit array sizing E) None of these

D

The value in a ________ variable persists between function calls A) counter B) local C) dynamic D) static local

D

This is a set of rules that must be followed when constructing a program. A) Punctuation B) Portability C) Operators D) Syntax E) Keywords

D

This is a special value that marks the end of a list of values. A) constant B) variable C) loop D) sentinel E) None of these

D

This may be used to write information to a file A) cout object B) pen object C) output object D) stream insertion operator E) None of these

D

This operator takes an operand and reverses its truth or falsehood. A) | | B) relational C) arithmetic D) ! E) None of the above

D

This statement may be used to stop a loop's current iteration and begin the next one. A) break B) terminate C) re-iterate D) continue E) none of these

D

To use the rand() function, you must #include this header file in your program. A) iostream B) ionmanip C) iorand D) cstdlib E) none of these

D

What does the following statement do? vector<int> v(10, 2); A) It creates a vector object with a starting size of 2 and the first element initialized with the value 10. B) It creates a vector object with a starting size of 10 and the first element initialized with the value 2. C) It creates a vector object and initializes all the first two elements with the values 10 and 2 D) It creates a vector object with a starting size of 10 and all elements are initialized with the value 2.

D

Assuming outFile is a file stream object and number is a variable, which statement writes the contents of number to the file associated with outFile? A) outFile << number; B) outFile >> number; C) number >> outFile; D) write(outFile, number);

A

Assuming you are using a system with 1-byte characters, how many bytes of memory will the following string literal occupy? "William" A) 8 B) 14 C) 7 D) 1

A

Even when there is no power to the computer, data can be held in: A) secondary storage B) The input device C) The output device D) The algorithm E) None of these

A

If a function is called more than once in a program, the values stored in the function's local variables do not _________ between function calls A) persist B) execute C) communicate D) change E) None of these

A

In C++ 11, the ______ tells the compiler to determine the variable's data type from the initialization value A) auto keyword B) #include preprocessor directive C) variable's name D) dynamic_cast keyword E) None of these

A

In programming terms, a group of characters inside a set of quotation marks is called a(n): A) String literal B) Variable C) Operation D) Statement E) None of these

A

The float data type is considered ________ precision, and the double data type is considered ________ precision. A) single, double B) float, double C) integer, double D) short, long E) None of these

A

The purpose of a memory address is: A) To identify the location of a byte in memory B) To prevent multitasking C) To obtain an algorithm D) To improve the effectiveness of high-level languages D) Encoded instruction E) None of these

A

The while loop has two important parts: an expression that is tested for a true or false value. and: A) a statement or block that is repeated as long as the expression is true B) a statement or block that is repeated only if the expression is true C) a statement or block that is repeated once, if the expression is false D) one line of code that is repeated once, if the expression is true

A

This function in C++ allows you to identify how many bytes of storage on your computer system an integer data value requires. A) sizeof B) bytes C) int D) f(x) E) none of these

A

This is a dummy function that is called instead of the actual function it represents A) stub B) overloaded function C) driver D) main function

A

This operator increments the value of its operand and then uses the value in context. A) prefix increment B) postfix increment C) prefix decrement D) postfix decrement E) none of these

A

True/False: A while loop's body can contain multiple statements, as long as they are enclosed in braces. A) True B) False

A

True/False: An initialization expression may be omitted from the for loop if not initialization is required A) True B) False

A

True/False: An output file is a file that data is written to A) true B) false

A

True/False: It is not considered good programming practice to declare all of your variables globally. A) True B) False

A

True/False: It is possible to define a file stream object and open a file in one statement A) true B) false

A

What will the following code display? int x = 0, y = 1, z = 2; cout << x << y << z << endl; A) 012 B) xyz C) 0 1 2 D) 0 1 2

A

What will the following program display? #include <iostream> using namespace std; int main( ) { int a = 0, b = 2, x = 4, y = 0; cout << (a == b) << " "; cout << (a != b) << " "; cout << (b <= x) << " "; cout << (y > a) << endl; return 0; } A) 0 1 1 0 B) 0 0 1 0 C) 1 1 0 1 D) 1 0 0 1 E) None of the above

A

How many times will the following loop display "Hello"? for ( int i = 1; i < 20; i++) cout << "Hello!" << endl; A) 20 B) 19 C) An infinite number of times D) 21

B

If a function does not have a prototype, default arguments may be specified in the function __ A) call B) header C) execution D) return type E) None of these

B

If you use a C++ key word as an identifier, your program will: A) Execute with unpredicted results B) not compile C) understand the difference and run without problems D) compile, link, but not execute E) none of these

B

If you want a user to enter exactly 20 values, which loop would be best to use? A) do-while B) for C) while D) infinite E) none of these

B

In any program that uses the cin object, you must include the ________ A) compiler B) iostream header file C) linker D) >> and << operators E) none of these

B

A(n) _____ is the most fundamental set of programs on a computer A) Compiler B) Operating System C) Application D) Utility program E) None of these

B

A(n) _______ is the most fundamental set of programs on a computer A) Compiler B) Operating System C) Application D) Utility Program E) None of these

B

An element of a two-dimensional array is referred to by _____ followed by ________ A) the array name, the column number of element B) the row subscript of the element, the column subscript of the element C) a comma, a semicolon D) the row subscript of element, the array name E) None of these

B

Besides decimal, two other number systems you might encounter in C++ programs are: A) Octal and Fractal B) Hexadecimal and Octal C) Unary and Quaternary D) Base 7 and Base 9 E) None of these

B

Besides decimal, two other number systems you might encounter in C++ programs are: A) octal and fractal B) Hexadecimal and Octal C) Unary and Quaternary D) Base 7 and Base 9 E) none of these

B

During which stage does the central processing A) fetch B) Decode C) Execute D) Portability stage

B

EXIT FAILURE and are named constants that may be used to indicate success or failure when the exit ( ) function is called A) EXIT_ TERMINATE B) EXIT_SUCCESS C) EXIT_OK D) RETURN_OK E) None of these

B

Given the following function definition void calc (int a, int b) { int c; c = a +32 a = a *3 b = c + a; } What is the output of the following code fragment that involves calc? int x = 1; int y= 2; int z = 3; calc(x, y) cout << x << " " << y << " " << z << endl; A) 1 2 3 B) 1 6 3 C) 3 6 3 D) 1 14 9 E) None of these

B

Hew many times will the following loop display "Hello"? for (int i =0; i <= 20; i++) cout << "Hello!" << endl; A) 20 B) 21 C) 19 D) an infinite number of times

B

How man times will the following loop display "Hello"? for ( int i = 20; i > 0; i--) cout << "Hello!" << endl; A) an infinite number of times B) 20 C) 21 D) 19

B

A file ______ is a small holding section of memory that file-bound information is first written to. A) name B) numbee C) buffer D) segment E) none of these

C

A(n) ____ is Information that is passed to a function and a(n) ____ is information that is received by a function: A) function, call, function header B) parameter, argument C) argument, parameter D) prototype header E) None of these

C

A(n) ______ is a set of instructions that the computer follows to solve a problem A) Compiler B) Linker C) Program D) Operator E) None of these

C

An array's size declarator must be a ________ with a value greater than __________ A) number, one B) number, zero C) constant integer expression, zero D) variable, -1 E) None of these

C

Associativity is either right to left or: A) Top to bottom B) Front to back C) Left to right D) Undeterminable E) None of the above

C

Assume that a program has the following variable definition: char letter; Which of the following statements correctly assigns the character Z to the variable? A) letter = (Z); B) letter = "Z"; C) letter = 'Z'; D) letter = Z;

C

Assuming dataFile is a file stream object the statement: dataFile.close( ); A) is illegal in C++ B) needs a filename argument to execute correctly C) closes a file D) is legal but risks losing valuable data E) none of these

C

By using the same _________ you can build relationships between data stored in two or more arrays. A) array name B) data C) subscript D) arguments E) None of these

C

Characters or symbols that perform operations on one or more operands are: A) Syntax B) Op codes C) operators D) program ops E) None of these

C

Computer programs are also known as. A) hardware C) software D) silverware E) None of these

C

Every complete C++ program must have a _____ A) cout statement B) symbolic constant C) function named main D) comment E) preprocessor directive

C

If you place a semicolon after the test expression in a while loop, it is assumed to be a(n): A) pre-test loop B) post-test loop C) null statement D) infinite loop E) None of these

C

In a broad sense, the two primary categories of programming languages are: A) Mainframe and PC B) Hardware and Software C) Low-level and High-level D) COBOL and BASIC E) None of these

C

In a for statement, this expression is executed only once. A) test B) null C) initialization D) validation E) None of these

C

In memory, C++ automatically places a ____ at the end of string literals. A) semicolon B) Quotation marks C) Null terminator D) Newline escape sequence E) none of these

C

Look at the following statement. while (x++ < 10) which operator is used first? A) ++ B) Neither. The expression is invalid C) <

C

Relational operators allow you to _____ number. A) add B) multiply C) compare D) average E) None of these

C

The _______ of a variable is limited to the block in which it is declared. A) precedence B) associativity C) scope D) branching ability E) None of these

C

The computer's main memory is commonly known as: A) The hard disk B) The floppy disk C) RAM D) Secondary storage E) None of these

C

The default section or a switch statement performs a similar task as the ________ portion of an if/else if statement. A) conditional B) break C) trailing else D) All of these E) None of these

C

The numeric data types in C++ can be broken into two general categories: A) numbers and characters B) singles and doubles C) integer and floating point D) real and unreal E) none of these

C

The programming process consists of several steps, which include: A) Input, Processing, and Output B) Key Words, Operators, and Punctuation C) Design, Creation, Testing, and Debugging D) Syntax, logic, and error handling E) None of these

C

The statements written by the programmer are called: A) Syntax B) Object code C) Source code D) Runtime libraries E) None of these

C

The value in this type of local variable persists between function calls A) global B) internal C) static D) dynamic E) None of these

C

These are used to declare variables that can hold real numbers. A) integer data types B) Real data types C) Floating point data types D) Long data types E) none of these

C

This control sequence is used to skip over to the next horizontal tab stop. A)\* B) \a C) \t D) \h E) \n

C

This is a variable, usually a bool or an int, that signals when a condition exists. A) relational operator B) aritmetic operator C) flag D) float E) None of these

C

This manipulator causes the field to be left-justified with padding spaces printed to the right. A) left_justify B) right C) left D) left_pad E) none of these

C

This manipulator is used to establish a field width for the value immediately following it. A) field_width B) set_ field C) setw D) iomanip E) none of these

C

This statement causes a function to end A) end B) terminate C) return return D) release E) None of these

C

What is the output of the following int x = 5; if (x = 2) cout << "This is true!" << endl; else cout << "This is false!" << endl; cout << "this is all folks!" << endl; A) This is true! B) This is false! C) This is true! This is false! D) This is true! This is all folks!

D

What is the output of the following code segment? n = 1; while (n<= 5) cout << n << " "; n++; A) 2 3 4 5 6 B) 2 3 4 5 C) 1 2 345 D) 1 1 1... and on forever E) 1 2 3 4

D

What is the value of the following expression? true && false A) -1 B) true C) +1 D) false

D

What will the following code display? Int number = 6; cout << number++ << endl; A) 0 B) 7 C) 5 D) 6

D

What will the following code display? cout << "Four \n" << "score\n"; cout << "and " << "\nseven"; cout << "\nyears" << " ago"<< endl; A) Four score and seven years ago B) Four score and seven years ago C) Four score and seven years ago D) Four score and seven years ago

D

What will the following code display? int number = 6; ++number; cout << number << endl; A) 5 B) 6 C) 0 D) 7

D

What will the following code display? int number = 6; int x = 0; x = number--; cout << x << endl; A) 7 B) 0 C) 5 D) 6

D

What will the following code display? int number = 6; number ++; cout << number << endl; A) 0 B) 5 C) 6 D) 7

D

What will the following loop display? int x = 0; while (x<5) { cout << x<< endl; x++ } A) 0 1 2 3 4 5 B) 1 2 3 4 C) The loop will display numbers starting at 0 for infinity D) 0 1 2 3 4

D

When this operator is used with string operands it concatenates them, or joins them together. A) & B) * C) % D) + E) None of the above

D

Which of the following correctly consolidates the following declaration statements into one statement? int x =7; int y = 16; int z = 28; A) int x = 7; y = 16; z = 28; B) int x = 7 y = 16 z= 28; C) int x, t, z = 7, 16, 28 D) int x = 7, y = 16, z = 28; E) None of these will work

D

Which statement correctly uses C++ 11 to initialize a vector of ints named n with the values 10 and 20? A) int vector n ({10}, {20}); B) vector n<int>(10, 20); C) vector<int> n = {10, 20}; D) vector<int> n { 10, 20};

D

A function _______ contains the statements that make up the function. A) call B) expression C) prototype D) parameter list E) definition

E

Which escape sequence causes the cursor to move to the beginning of the current line? A) \t B) \b C)\a D) \n E) \r

E


Conjuntos de estudio relacionados

Assessment and Management of Patients with Diabetes

View Set

LI274 Answers to All Quizzes From First Half

View Set

CH 12 SOC: GENDER, SEX, AND SEXUALITY

View Set

Complementary and Alternative Medicine (CAM)

View Set