COSC-1436 midterm review
A step-by-step problem-solving process in which a solution is arrived at in a finite amount of time is called a(n) ____. a. algorithm b. linker c. analysis d. design
a
The extraction operator >> skips only all leading blanks when searching for the next data in the input stream.
b
The memory allocated for a float value is ____ bytes. a. two b. four c. eight d. sixteen
b
The term GB refers to ____. a. giant byte b. gigabyte c. group byte d. great byte
b
The value of the expression 33/10, assuming both values are integral data types, is ____. a. 0.3 b. 3 c. 3.0 d. 3.3
b
Which of the following is a legal identifier? a. program! b. program_1 c. 1program d. program 1
b
Which of the following is the newline character? a. \r b. \n c. \l d. \b
b
____ are executable statements that inform the user what to do. a. Variables b. Prompt lines c. Named constants d. Expressions
b
____ is a valid int value. a. 46,259 b. 46259 c. 462.59 d. -32.00
b
A(n) ____________________ is a collection of statements, and when it is activated, or executed, it accomplishes something.
subprogram function module
Entering a char value into an int variable causes serious errors, called input failure.
t
If a C++ arithmetic expression has no parentheses, operators are evaluated from left to right.
t
Suppose a = 5. After the execution of the statement ++a; the value of a is 6.
t
Suppose we declare a variable sum as an int. The statement "sum += 7;" is equivalent to the statement "sum = sum + 7;".
t
The maximum number of significant digits in float values is up to 6 or 7.
t
The maximum number of significant digits in values of the double type is 15.
t
The number of input data extracted by cin and >> depends on the number of variables appearing in the cin statement.
t
To develop a program to solve a problem, you start by analyzing the problem.
t
When reading data into a char variable, after skipping any leading whitespace characters, the extraction operator >> finds and stores only the next character; reading stops after reading a single character.
t
You can use the function getline to read a string containing blanks.
t
A(n) ____________________ is a memory location whose contents can be changed.
variable
In a C++ program, ____________________ are used to separate special symbols, reserved words, and identifiers.
whitespaces
____________________ can be used to identify the authors of the program, give the date when the program is written or modified, give a brief explanation of the program, and explain the meaning of key statements in a program.
Comments
____________________ languages include FORTRAN, COBOL, Pascal, C, C++, Java, and Python.
High-level
Which of the following is a reserved word in C++? a. char b. Char c. CHAR d. character
a
____ programs perform a specific task. a. Application b. System c. Operating d. Service
a
In C++, the mechanism that allows you to combine data and operations on the data into a single unit is called a(n) ____________________.
class
A(n) ____ consists of data and the operations on those data. a. disk b. compiler c. interpreter d. object
d
Several categories of computers exist, such as ____. a. microframe, midframe, and miniframe b. midsize, microframe, and mainframe c. mainsize, midsize, and microsize d. mainframe, midsize, and micro
d
Suppose that alpha and beta are int variables. The statement alpha = beta--; is equivalent to the statement(s) ____. a. alpha = 1 - beta; b. alpha = beta - 1; c. beta = beta - 1; alpha = beta; d. alpha = beta; beta = beta - 1;
d
Suppose that sum and num are int variables and sum = 5 and num = 10. After the statement sum += num executes, ____. a. sum = 0 b. sum = 5 c. sum = 10 d. sum = 15
d
The ____________________ type is C++ 's method for allowing programmers to create their own simple data types.
enumeration
A comma is also called a statement terminator.
f
A mixed arithmetic expression contains all operands of the same type.
f
An operator that has only one operand is called a unique operator.
f
C++ programs have always been portable from one compiler to another
f
If input failure occurs in a C++ program, the program terminates immediately and displays an error message.
f
In C++, reserved words are the same as predefined identifiers.
f
In an output statement, each occurrence of endl advances the cursor to the end of the current line on an output device.
f
In the statement cin >> x;, x can be a variable or an expression.
f
It is a good idea to redefine cin and cout in your programs.
f
The command that does the linking on Visual C++ Express (2013 or 2016) and Visual Studio 2015 is Make or Remake.
f
The device that stores information permanently (unless the device becomes unusable or you change the information by rewriting it) is called primary storage.
f
The escape sequence \r moves the insertion point to the beginning of the next line.
f
The following statements will result in input failure if the input values are not on a separate line. (Assume that x and y are int variables.) cin >> x; cin >> y;
f
When you compile your program, the compiler identifies the logic errors and suggests how to correct them.
f
When a value of one data type is automatically changed to another data type, a(n) ____________________ type coercion is said to have occurred.
implicit
The smallest individual unit of a program written in any language is called a(n) ____________________.
token
The devices that feed data and programs into computers are called output devices.
False
When the computer is turned off, everything in secondary memory is lost.
False
The ASCII data set consists of ____________________ characters.
128
____________________ signals represent information with a sequence of 0s and 1s.
Digital
____________________ functions are those that have already been written and are provided as part of the system.
Predefined Standard
____________________ is the process of planning and creating a program.
Programming
____________________ rules determine the meaning of instructions.
Semantic
Information stored in main memory must be transferred to some other device for permanent storage.
True
Main memory is directly connected to the CPU.
True
The basic commands that a computer performs are input (get data), output (display result), storage, and performance of arithmetic and logical operations.
True
Suppose that alpha and beta are int variables. The statement alpha = ++beta; is equivalent to the statement(s) ____. a. beta = beta + 1; alpha = beta; b. alpha = beta; beta = beta + 1; c. alpha = alpha + beta; d. alpha = beta + 1;
a
The digit 0 or 1 is called a binary digit, or ____. a. bit b. bytecode c. Unicode d. hexcode
a
The expression static_cast<int>(6.9) + static_cast<int>(7.9) evaluates to ____. a. 13 b. 14 c. 14.8 d. 15
a
The expression static_cast<int>(9.9) evaluates to ____. a. 9 b. 10 c. 9.9 d. 9.0
a
15. ____ is a valid char value. a. "-129" b. 'A' c. "A" d. 129
b
A program that loads an executable program into main memory is called a(n) ____. a. compiler b. loader c. linker d. assembler
b
A sequence of eight bits is called a ____. a. binary digit b. byte c. character d. double
b
In a C++ program, one and two are double variables and input values are 10.5 and 30.6. After the statement cin >> one >> two; executes, ____. a. one = 10.5, two = 10.5 b. one = 10.5, two = 30.6 c. one = 30.6, two = 30.6 d. one = 11, two = 31
b
Main memory is called ____. a. read only memory b. random access memory c. readily available memory d. random read only memory
b
Suppose that count is an int variable and count = 1. After the statement count++; executes, the value of count is ____. a. 1 b. 2 c. 3 d. 4
b
Suppose that x and y are int variables. Which of the following is a valid input statement? a. cin >> x >> cin >> y; b. cin >> x >> y; c. cin << x << y; d. cout << x << y;
b
The ____ handles the overall activity of the computer and provides services. a. central processing unit b. operating system c. arithmetic logic unit d. control unit
b
The declaration int a, b, c; is equivalent to which of the following? a. inta , b, c; b. int a,b,c; c. int abc; d. int a b c;
b
The devices that feed data and programs into computers are called ____ devices. a. entry b. input c. output d. secondary
b
A program called a(n) ____ combines the object program with the programs from libraries. a. assembler b. decoder c. linker d. compiler
c
A program called a(n) ____ translates instructions written in high-level languages into machine code. a. assembler b. decoder c. compiler d. linker
c
An example of a floating point data type is ____. a. int b. char c. double d. short
c
Choose the output of the following C++ statement: cout << "Sunny " << '\n' << "Day " << endl; a. Sunny \nDay b. Sunny \nDay endl c. Sunny Day d. Sunny \n Day
c
Dividing a problem into smaller subproblems is called ____ design. a. OOD b. top-down refinement c. structured d. analog
c
Main memory is an ordered sequence of items, called ____. a. pixels b. registers c. memory cells d. addresses
c
Suppose that alpha and beta are int variables and alpha = 5 and beta = 10. After the statement alpha *= beta; executes, ____. a. alpha = 5 b. alpha = 10 c. alpha = 50 d. alpha = 50.0
c
Suppose that alpha and beta are int variables. The statement alpha = --beta; is equivalent to the statement(s) ____. a. alpha = 1 - beta; b. alpha = beta - 1; c. beta = beta - 1; alpha = beta; d. alpha = beta; beta = beta - 1;
c
Suppose that alpha and beta are int variables. The statement alpha = beta++; is equivalent to the statement(s) ____. a. alpha = 1 + beta; b. alpha = alpha + beta; c. alpha = beta; beta = beta + 1; d. beta = beta + 1; alpha = beta;
c
Suppose that x is an int variable and y is a double variable. The input is: 10 20.7 Choose the values after the following statement executes: cin >> x >> y;. a. x = 10, y = 20 b. x = 10, y = 20.0 c. x = 10, y = 20.7 d. x = 10, y = 21.0
c
The ____ rules of a programming language tell you which statements are legal, or accepted, by the programming language. a. semantic b. logical c. syntax d. grammatical
c
The basic commands that a computer performs are ____, and performance of arithmetic and logical operations. a. input, file, list b. output, folder, storage c. input, output, storage d. storage, directory, log
c
The devices that the computer uses to display results are called ____ devices. a. exit b. entry c. output d. input
c
The length of the string "computer science" is ____. a. 14 b. 15 c. 16 d. 18
c
The programming language C++ evolved from ____. a. BASIC b. assembly c. C d. C+
c
The value of the expression 17 % 7 is ____. a. 1 b. 2 c. 3 d. 4
c
____ consists of 65,536 characters. a. ASCII-8 b. ASCII c. Unicode d. EBCDIC
c
____ represent information with a sequence of 0s and 1s. a. Analog signals b. Application programs c. Digital signals d. System programs
c
The memory space for a(n) ____________________ data value is 4 bytes.
int.
Assembly language uses easy-to-remember instructions called ____________________.
mnemonics
In C++, you can use a(n) ____________________ to instruct a program to mark those memory locations in which data is fixed throughout program execution.
named constant
In ____________________ design, the final program is a collection of interacting objects.
object-oriented
In object-oriented design, the first step in the problem-solving process is to identify the components called ____________________, which form the basis of the solution, and to determine how they interact with one another.
objects
The ____________________ handles the overall activity of the computer and provides services such as memory management, input/output activities, and storage management.
operating system
In a C++ program, statements that begin with the symbol # are called ____________________ directives.
preprocessor
The maximum number of significant digits is called the ____________________.
prescision
A data type is called ____________________ if the variable or named constant of that type can store only one value at a time.
simple
A(n) ____________________ is a sequence of zero or more characters.
string