COSC final exam review

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

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

A. f(x) B. Int C. Len D. Sizeof E. Bytes Answer: D. Sizeof

This operator takes an operant and reverses its truth or false hood.

A. || B. Relational C. Arithmetic D. ! E. None of these Answer: D. !

This operator performs a logical NOT operation.

A. — B. ! C. <> D. >< E. None of these

This operator is known as the logical OR operator.

A. — B. // C. # D. || E. None of these Answer: D. ||

An Integrated Development Environment typically consists of:

a. A text editor b. A compiler c. A debugger d. All of these Answer: All of these

_______ represent storage locations in the computer's memory.

A. Literals B. Variables C. Comments D. Integers E. None of these Answer: B. Variables

Which of the following is a preprocessor directive?

A) cin >> rate; B) // This program calculates the user's pay. C) int main() D) pay = hours * rate; E) #include <iostream> Answer: E) #include <iostream>

What will the following code display? Cout << "Monday"; Cout << "Tuesday"; Cout << "Wednesday";

A. "Monday" "Tuesday" "Wednesday" B. Monday Tuesday Wednesday C. Monday Tuesday Wednesday D. MondayTuesdayWednesday Answer: D. MondayTuesdayWednesday

When this operator is used with string opera dis it concatenates them, or joins them together.

A. & B. * C. % D. + E. None of these Answer: D. +

What is the value of the following expression? True || true

A. -1 B. False C. True D. +1 Answer: C. True

What is the value of the following expression? False || true

A. -1 B. + 1 C. True D. False Answer: C. True

What is the value stored at x, given the statements: Int x; X = 3 / static_cast<int> (4.5 + 6.4);

A. .3 B. 0 C. .275229 D. 3.3 E. None of these

Assume that x is an int variable. What value is assigned to x after the following assignment statement is executed? X = -3 + 4 % 6 / 5;

A. 0 B. 1 C. 2 D. -3 E. None of these Answer: D. -3

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

A. 0 B. Unknown C. 4.5 D. 4

Assume that x is an int variable. What value is assigned to x after the following assignment statement is executed? x = -3 + 4 % 6 / 5;

A. 0 B. 1 C. 2 D. -3 E. None of these Answer: D. -3

Given the following code segment, what is output after "result = " ? Int x = 1, y = 1, z = 1; Y = y + z; X = x + y; Cout << "result = " << ( x < y ! y : x) << endl;

A. 0 B. 1 C. 2 D. 3 E. None of these Answer: D. 3

What is the value of donuts after the following code executes? int donuts = 10; If (donuts != 10) donuts = 0; Else donuts += 2;

A. 12 B. 0 C. 2 D. 10 Answer: A. 12

What is the value of donuts after the following code executes? Int donuts = 10; If (donuts = 1) Donuts = 0 Else Donuts += 2;

A. 12 B. 0 C. 1 D. 10 Answer: B. 0

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. 120 B. This code will not compile C. 20 D. 10 Answer: C. 20

After execution of the following code, what will be the value of input_value if the value is entered at the keyboard at run time? Cin >> input_value; If (input_value > 5) Input_value = input_value + 5; Else if (input_value > 2) Input_value = input_value +10 Else Input_value = input_value + 15;

A. 15 B. 0 C. 5 D. 10 E. 25 Answer: A. 15

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 Answer: A. 2

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 Answer: A. 2

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

A. 2 B. Unknown C. 4 D. 0.45 Answer: A. 2

What is the value of number after the following statements execute? Int number = 10; Number += 5; Number -= 2; Number *= 3;

A. 30 B. 3 C. 39 D. 2 Answer: C. 39

What is the value of number after the following statements execute? Int number = 10; Number += 5; Number -= 2; Number *= 3;

A. 39 B. 2 C. 3 D. 30 Answer: A. 39

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

A. 4. 5 B. 4 C. Unknown D. 0 Answer: B. 4

What is the value of average after the following ode executes? Double average; Average = 1.0 + 2.0 + 3.0 / 3.0;

A. 4.0 B. 2.0 C. 1.5 D. 6.0 Answer: A. 4.0

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. 7 C. 9 D. 8 Answer: B. 7

What will the value of result be after the following statement executes? Result = 6 - 3 * 2 + 7 - 10 / 2;

A. 6 B. 8 C. 1. 5 D. 2 Answer: D. 2

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. 1 C. 7 D. 14 Answer: A. 8

Look at the following program and answer the question that follows it. 1. // This program displays my gross wages. 2. // I worked 40 hours and I make $20.00 per hour. 3. #include <iostream> 4. Using namespace std; 5. 6. Int main ( ) 7. { 8. Int hours; 9. Double payRate, grossPay; 10. 11. Hours = 40; 12. PayRate = 20.0; 13. GrossPay = hours * payRate; 14. Cout << "My gross pay is $" << grosspay << endl; 15. Return 0; 16. } Which line(s) in this program cause output to be displayed on the screen?

A. 8 and 9 B. 14 C. 13 D. 15 E. 13 and 14 Answer: B. 14

Which line in the following program will cause a compiler error? 1. #include <iostream> 2. Using namespace std; 3. 4. Int main ( ) 5. { 6. Int number = 5; 7. 8. If (number >= 0 && <= 100) 9. Cout << "passed. \n"; 10. Else 11. Cout << "failed. \n" 12. Return 0; 13. }

A. 9 B. 10 C. 8 D. 6 Answer: C. 8

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. 7 D. 6 Answer: D. 6

This operator is used in C++ to represent equality.

A. = B. >< C. ! ! D. == E. None of these Answer: D. ==

What statement best describes a variable and its primary purpose?

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

Relational operators allow you to _____ numbers.

A. Add B. Multiply C. Compare D. Average E. None of these Answer: C. Compare

This is a volatile type of memory, used for temporary storage.

A. Address B. ALU C. RAM D. Disk drive E. None of these Answer: C. RAM

Which of the following best describes an operator?

A. An operator is a word that has a special meaning. B. An operator is a rule that must be followed when constructing a program C. An operator marks the beginning or ending of a statement, or is used to seperate items in a list D. An operator is a symbolic name that refers to a variable E. An operator allows you to perform operations on one or more pieces of data Answer: E. An operator allows you to perform operations on one or more pieces of data

Which of the following best describes an operator?

A. An operator marks the beginning or ending os a statement, or is used to separate items in a list. B. An operator is a rule that must be followed when constructing a program. C. An operator allows yo to perform operations on one or more pieces of data. D. An operator is a word that has a special meaning. E. An operator is a symbolic name that refers to a variable Answer: C. An operator allows you to perform operations on one or more pieces of data

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 Answer: D. Control Unit

In C++ 11, the _____ tells the compiler to determine the variable's data type from the initialization value.

A. Auto key word B. #include preprocessor directive C. Variable's name D. Dynamic_cast key word E. None of these Answer: A. Auto key word

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 Answer: D. #include directive

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

A. Binary B. Bool C. T/F D. Float E. None of these Answer: B. Bool

The ______ operator always follows the cin object, and the ______ operator follows the cout object.

A. Binary, unary B. Conditional, binary C. >>, << D. <<, >> E. None of these Answer: C. >>, <<

Without this statement appearing in a switch construct, the program "falls through" all of the statements below the one with the matching case expression.

A. Break B. Exit C. Switch D. Scope E. None of these Answer: A. Break

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 these Answer: C. Getline (cin, address);

You want the user to enter the length, width, and height from the keyboard. Which cin statement is correctly written?

A. Cin << length; width; height; B. Cin.get (length, width, height); C. Cin >> length, width, height; D. Cin >> length >> width >> height; Answer: D. Cin >> length >> width >> height;

_____ reads a line of inputs, 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 Answer: B. Getline

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 Answer: A. Cin.ignore

The statement will pause the screen, until the [enter] key is pressed.

A. Cin.input (); B. Cin.ignore (); C. Cin.get(); D. Cin; E. Cin.getline(); Answer: C. Cin.get();

When using the sqrt function you must include this header file.

A. Cmath B. Iostream C. Cstdlib D. Cstring E. Iomanip Answer: A. Cmath

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

A. Comment B. Function C. Preprocessor directive D. Key word E. None of these Answer: C. Preprocessor directive

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 Answer: B. Iostream header file

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 Answer: C. Program

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 Answer: B. Operating system

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 Answer: C. Program

The default section of 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 Answer: C. Trailing else

During which stage does the central processing unit retrieve from main memory the next instruction in the sequence of program instructions?

A. Decode B. Execute C. Portability stage D. Fetch Answer: D. Fetch

During which stage does the central processing unit analyze the instruction and encode it in the form of a number, and then generate an electronic signal?

A. Decode B. Fetch C. Execute D. Portability stage Answer: A. Decode

This step will uncover any syntax errors in your program.

A. Editing B. Compiling C. Linking D. Executing E. None of these Answer: B. Compiling

In the C++ the = operator indicates:

A. Equality B. Assignment C. Subtraction D. Negation E. None of these Answer: B. Assignment

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

A. Execute with unpredictable results B. Not compile C. Understand the difference and run without problems D. Compile, link, but not execute E. None of these Answer: B. Not compile

During which stage does the central processing unit analyze the instruction and encode it in the form of a number, and then generate an electronic signal?

A. Fetch B. Portability stage C. Decode D. Execute Answer: C. Decode

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 Answer: C. Setw

Which data type typically requires only one byte of storage?

A. Float B. Int C. Char D. Double E. Short Answer: C. Char

The total number of digits that appear before and after the decimal point is sometimes referred to as:

A. Floating points B. Significant digits C. Precision D. Significant digits and precision E. None of these Answer: D. Significant digits and precision

The total number of digits that appear before and after the decimal point is sometimes referred to as:

A. Floating points B. Significant digits C. Precision D. Significant digits and precision E. None of these Answer: D. Significant digits and precision

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 Answer: A. Four Score And Seven Years ago

What will the following code display? Cout << "Four" << "score" << endl; Cout << "and" << "seven" << endl; Cout << "years" << "ago " << endl;

A. Four score Andseven Yearsago B. Four score and seven years ago C. Four Score And Seven Years Ago D. Fourscoreandsevenyearsago Answer: A. Four score Andseven Yearsago

Every complete C++ program must have a _______.

A. Function named main B. Comment C. Preprocessor directive D. Symbolic constant E. Cout statement Answer: A. Function named main

Computer programs are also known as:

A. Hardware B. Firmware C. Software D. Silverware E. None of these Answer: C. Software

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 Answer: B. Algorithm

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 Answer: A. Input validation

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 Answer: C. Design, creation, testing, and debugging

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 Answer: C. Floating point data types

To use the rand() function, you must #include this header file in your program.

A. Iostream B. Iomanip C. Iorand D. Cstdlib E. None of these Answer: D. Cstdlib

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 Answer: D. String

Which is true about the following statement? Cout << setw(4) << num4 << " ";

A. It allows four spaces for the value in the variable num4 B. It outputs "setw(4)" before the clue in the variable num4 C. It should use setw(10) to output the value in the variable num10 D. It inputs up to four characters stored in the variable num4 E. None of these Answer: A. It allows four spaces for the value in the variable num4

Which of the following would be an illegal variable name?

A. June1997 B. DayOfWeek C. Itemsorderedforthemonth D. _employee_num E. 3dGraph Answer: E. 3dGraph

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 Answer: E. All of these are valid identifiers

Which of the following is a common input device?

A. Keyboard B. Mouse C. Scanner D. Microphone E. All of these Answer: E. All of these

In C++ 11, if your want an integer literal to be treated as a long long int, your can append _____ at the end of the number

A. L B. <INT> C. I D. LL E. None of these Answer: D. LL

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 Answer: C. Left

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; Answer: A. Letter = 'Z';

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 Answer: B. Statement

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 Answer: A. Literals

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 Answer: C. Low-level and high-level

______ 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 Answer: C. Compilers

________ are used to translate each source code instruction into the appropriate machine lanuguage instruction.

A. Modules B. Library routines C. Compilers D. Preprocessor directives E. None of these Answer: C. Compilers

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?

A. Name = "Jane"; B. Name = (Jane) C. Name = Jane; D. Name = 'Jane'; Answer: A. Name = "Jane"

The statement: Cin >> setw(10) >> str; Will read up to this many characters into str.

A. Nine B. Ten C. Eleven D. Eight E. None of these Answer: A. Nine

What statement is equivalent to the following? Number += 1;

A. Number = number + 1; B. Number + 1; C. Number = 1; D. None of these Answer: A. Number = number + 1;

The control sequence is used to skip over to the next horizontal tab stop.

A. Octal and Fractal B. Hexadecimal and Octal C. unwary and Quaternary D. Base 7 and Base 9 E. None of these Answer: B. Hexadecimal and Octal

When a relational expression is false, it has the value ______.

A. One B. Zero C. Zero, one, or minus one D. Less than zero E. None of these Answer: B. Zero

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

A. Opening and closing braces B. The header file iostream C. Comments D. Escape sequences E. None of these Answer: B. The header file iostream

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

Programmer-defined names of memory locations that may hold data are:

A. Operators B. Variable C. Syntax D. Operates E. None of these Answer: B. Variable

The ______ causes a program to wait until information is typed at the keyboard and the enter key is pressed.

A. Output stream B. Cin object C. Cout object D. Preprocessor E. None of these Answer: B. Cin object

When converting some algebraic expressions to C++, you may need to insert _______ that do not appear in the algebraic expression.

A. Parentheses B. Exponents C. Calculations D. Coercion's E. None of these Answer: A. Parentheses

If you intend to place a block of statements within an if statement, you must place these around the block.

A. Parentheses B. Square brackets C. Angle brackets D. Curly braces E. None of these Answer: D. Curly braces

This is a set of rules that must be followed when construction a program.

A. Portability B. Punctuation C. Operators D. Key words E. Syntax Answer: E. Syntax

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 Answer: C. Scope

Which of the following is not one of the five major components of a computer system?

A. Preporcessor B. The CPU C. Secondary storage device D. Main memory E. input/output device Answer: preprocessor

The programmer usually enters source code into a computer using:

A. Pseudocode B. A text editor C. A hierarchy chart D. A compiler E. None of these Answer: B. A text editor

This term refers to the programmer reading the program from the beginning and stepping through each statement.

A. Pseudocoding B. Software engineering C. Desk checking D. Spot checking E. None of these Answer: C. Desk checking

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 Answer: B. Definition

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 Answer: A. Secondary storage

Which of the following is not one of the five major components of a computer system?

A. Secondary storage device B. Input/output device C. Preprocessor D. Main memory E. The CPU (central processing unit) Answer: C. Preprocessor

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

A. Semicolon B. Quotation marks C. Null terminator D. New line escape sequence E. None of these Answer: C. Null terminator

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. Key words E. None of these Answer: B. Punctuation

This stream manipulator forces cout to print the digits in fixed-point notation.

A. Setprecison(2) B. Setw(2) C. Fixed D. Setfixed(2) E. None of these Answer: C. Fixed

What will the following segment of code output if the value 11 is entered at the keyboard? int number; cin >> number; if (number > 0) cout << "C++ "; else cout << "Soccer"; cout << " is "; cout << " fun " << endl;

A. Soccer is fun B. Soccerfun C. C++ D. C++ is fun E. C++fun Answer: D. C++ is fun

Which character signifies the beginning of an escape sequence?

A. \ B. // C. / D. { E. # Answer: A. \

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

A. \b B. \n C. \a D. \r E. \t

The function pow(x, 5.0), requires this header file.

A. cmath B. Iomanip C. Iostream D. Cstring E. Cstdlib Answer: A. Cmath

In the process of translating a source file into and executable file, which of the following is the correct sequence?

A. Source code, compiler, modified source code, preprocessor, object code, linker, executable code. B. Source code, linker, object code, compiler, modified source code, preprocessor, executable code. C. Preprocessor, source code, compiler, executable code, linker, modified source code, object code. D. Source code, preprocessor, modified source code, linker, object code, compiler, executable code. E. Source code, preprocessor, modified source code, compiler, object code, linker, executable code. Answer: E. Source code, preprocessor, modified source code, compiler, object code, linker, executable code.

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 Answer: A. String literal

This statement uses the value of a variable or expression to determine where the program will branch to.

A. Switch B. Select C. Associative D. Scope E. None of these Answer: A. Switch

The statements written by the programmer are called:

A. Syntax B. Object code C. Source code D. Runtime libraries E. None of these Answer: C. Source code

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 Answer: C. Operators

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 Answer: B. Logic errors

An example of a secondary storage device is:

A. The computer's main memory B. The keyboard C. The monitor D. The disk drive E. None of these Answer: D. The disk drive

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

A. The end of a statement B. The beginning of a comment C. The end of the program D. The beginning of a block of code E. None of these Answer: B. The beginning of a comment

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 Answer: C. RAM

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 Answer: C. The control unit and the arithemtic and logic unit

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 Answer: B. The physical components that a computer is made of

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 Answer: C. The data type of the variable

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 Answer: A. The type of data it will be used to hold

What is the output of the following code segment? 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! E. None of these Answer: D. This is true! This is all folks!

At the heart of a computer is its central processing. 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 Answer: D. All of these

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 Answer: A. To identify the location of a byte in memory

Associativity is either right to left or:

A. Top to bottom B. Front to back C. Left to right D. Undeterminable E. None of these Answer: C. Left to right

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 Answer: B. Flowchart

What will the value of x be after the following statements execute? int x = 0; int y = 5; int z = 4; x = y + z * 2;

A. Unknown B. 13 C. 0 D. 18 Answer: B. 13

Three primary activities of a program are:

A. Variable, operators, and key words B. Lines, statements, and punctuation C. Input, processing, and output D. Integer, floating-point and character E. None of these Answer: C. Input processing, and output

Which statement is equivalent to the following? X = x * 2;

A. X * 2; B. X *= 2; C. X = x * x; E. None of these Answer: B. X *= 2;

Which of the following expressions will determine whether x is less than or equal to y?

A. X >= y B. X =< y C. X <= y D. X > y Answer: C. X <= y

What will the following segment of code output? Assume the user enters a grade of 90 from the keyboard. cout << "Enter a test score: "; cin >> test_score; if (test_score < 60); cout << "You failed the test!" << endl; if (test_score > 60) cout << "You passed the test!" << endl; else cout << "You need to study for the next test!";

A. You failed the test! B. You passed the test! C. You failed the test! You passed the test! D. You failed the test! You did poorly on the test! E. None of these Answer: B. You passed the test!

You can use these to override the rules of operator precedence in a mathematical expression.

A. [Brackets] B. (Parentheses) C. {Braces} D. The escape character \ E. None of these Answer: B. (Parentheses)


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

Exam 3 - Chapter 9: Creating and Maintaining High-Performance Organizations

View Set

Mental Health test #3 Chapter 12 Abuse and Violence, Abuse and violence prepU, Ch 12: Prep-U, Chapter 12 Abuse and Violence Questions

View Set

Chapter 34 Pediatric Emergencies

View Set

ICORE Operations: Inventory Management - The Newsvendor Model (SINGLE period inventory model)

View Set