COSC Midterm
The number of input data extracted by cin and >> depends on the number of variables appearing in the cin statement.
True: if more inputs are given, then it skips the additional input
The expression static_cast<int>(6.9) + static_cast<int>(7.9) evaluates to __________.
a. 13
_______ programs perform a specific task.
a. Application
The value of the expression 33/10, assuming both values are integral data types, is _______.
b. 3
___________ is a valid int value
b. 46259
_______ are executable statement that inform the user what to do.
b. Prompt lines
Which of the following is the newline character?
b. \n
A sequence of eight bits is called a _____.
b. byte
Suppose that x and y are int variables. Which of the following is a valid input statement?
b. cin >> x >> y;
The term GB refers to _______.
b. gigabyte
The devices that feed data and programs into computers are called _______ devices.
b. input
The declaration int a, b, c is equivalent to which of the following?
b. int a,b,c;
A program that loads an executable program into main memory is called a(n) _______.
b. loader
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, ________.
b. one = 10.5, two = 30.6
The _____ handles the overall activity of the computer and provides services.
b. operating system
Which of the following is a legal identifier?
b. program_1
Main memory is called _____.
b. random access memory
Suppose that alpha and beta are int variables. The statement alpha = ++beta; is equivalent to the statement(s) _______.
beta = beta + 1; alpha = beta;
Suppose that alpha and beta are int variables. The statement alpha = --beta; is equivalent to the statement(s) _________.
beta = beta - 1; alpha = beta;
The length of the string "computer science" is
c. 16
The value of the expression 17 % 7 is _____.
c. 3
The programming language C++ evolved from ________.
c. C
_________ represent information with a sequence of 0s and 1s.
c. Digital signals
_______ consists of 65,536 characters.
c. Unicode
Suppose that alpha and beta are int variables and alpha = 5 and beta = 10. After the statement alpha *= beta; executes, _____
c. alpha = 50
The memory allocated for a float value is _______ bytes.
four bytes
When a value of one data type is automatically assigned to another data type, a(n) _________________ type coercion is said to have occured
implicit
The ________________ handles the overall activity of the computer and provides services such as memory management, input/output activities, and storage management.
operating system
The maximum number of significant digits is called the ________________
precision
In a C++ program, statements that begin with the symbol # are called ____________________ directives.
preprocessor
A(n) ___________ is a sequence of zero or more characters
string
A(n) _________________ is a collection of statements, and when it is activated, or executed, it accomplished something.
subprogram, function, module
A(n) ______________ is a memory location whose contents can be changed.
variable
To develop a program to solve a problem, you start by analyzing the problem.
True
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.
True
The __________________ type is C++'s method for allowing programmers to create their own simple data types.
Enumeration
The ASCII data set consists of __________________ characters.
128
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;
False
In the statement cin >> x;, x can be a variable or expressioin
False: >> is binary. Additionally, cin reads and stores values in variables.
An operator that has only one operand is called a unique operator.
False: Called unary operators.
The devices that feed data and programs into computers are called output devices.
False: Devices that feed data and programs into computers are called input devices
When the computer is turned off, everything in secondary memory is lost.
False: Everything in main memory is lost, but the secondary memory stores information permanently
C++ programs have always been portable from one compiler to another
False: No always
The device that stores information permanently (unless the devices becomes unusable or you change the information by rewriting it) is called primary storage.
False: Secondary storage device is used to store information permanently until the device becomes unusable or someone rewrites the information stored in it
When you compile your program, the compiler identifies the logic errors and suggests how to correct them.
False: Syntax errors
You can use the function getline to read a string containing blanks.
True: getline reads all character in the line including any blanks, if any, until it reaches end of the current line.
_______________ functions are those that have already been written and are provided as a part of the system.
Predefined, Standard
_________________ is the process of planning and creating a program.
Programming
_______________ rules determine the meaning of instructions
Semantic
A data type is called __________________ if the variable or named constant of that type can store only one value at a time.
Simple
Choose the output of the following C++ statement: cout << "Sunny" << '\n' << "Day" << endl;
Sunny Day
_____________________ signals represent information with a sequence of 0s and 1s.
Digital
____________ 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
The command that does the linking on Visual C++ Express (2013 or 2016) and Visual Studio 2016 is Make or Remake
False: The Build or Rebuild is the command, which does the linking on Visual C++ Express (2013 or 2016) and Visual Studio 2015
The escape sequence \r moves the insertion point to the beginning of the next line.
False: \r moves the cursor to the start of the current line.
A comma is also called a statement terminator.
False: a semicolon
A mixed arithmetic expression contains all operands of the same type.
False: mixed expressions deal with differing operands.
The extraction operator >> skips only all leading blanks when searching for the next data in the input stream.
False: not only skips leading blanks, but also all leading whitespaces.
If input failure occurs in a C++ program, the program terminates immediately and displays an error message.
False: quietly continues to execute.
In C++, reserved words are the same as predefined identifiers,
False: reserved words are typically referred as keywords. Cannot be redefined.
In an output statement, each occurrence of endl advances the cursor to the end of the current line on an output device.
False: the manipulator endl is used to move the insertion point to the beginning of the next line.
It is a good idea to redefine cin and cout in your programs.
False: they already have specific meanings
_____________________ languages include FORTRAN, COBOL, Pascal, C, C++, Java, and Python.
High-level
The smallest individual unit of a program written in any language is called a(n) ____________.
Token
Entering a char value into an int variable causes serious errors, called input failure.
True
If a C++ arithmetic expression has no parentheses, operators are evaluated from left to right.
True
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
Suppose a = 5. After the execution of the statement ++a; the value of a is 6.
True
Suppose we declare a variable sum as an int. The statement "sum += 7;" is equivalent to the statement "sum = sum + 7"
True
The basic commands that a computer performs are input (get data), output (display result), storage, and performance of arithmetic and logical operations.
True
The maximum number of significant digits in data type float value is up to 6 or 7.
True
The maximum number of significant digits in value of the double type is 15.
True
In a C++ program, _____________________ are used to separate special symbols, reserved words, and identifiers.
Whitespaces
Consider the following code: // Insertion Point 1 using namespace std; const float PI = 3.14; int main() { //Insertion Point 2 float r = 2.0; floar area; area = PI*r*r; cout << "Area =" << area << endl; return 0; } //Insertion Point 3 In this code, where does the include statement belong?
a. Insertion Point 1
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
The digit 0 or 1 is called a binary digit, or _________.
a. bit
Which of the following is a reserved word in C++?
a. char
Suppose that alpha and beta are int variables. The statement alpha = beta++; is equivalent to the statement(s) ______.
alpha = beta; beta = beta + 1
Suppose that alpha and beta are int variables. The statement alpha = beta--; is equivalent to the statement(s) ________.
alpha = beta; beta = beta - 1;
_________ is a valid char value
b. 'A'
Suppose that count is an int variable and count = 1. After the statement count++; executes, the value of count is
b. 2
A program called a(n) ________ translates instructions written in high-level languages into machine code.
c. compiler
An example of a floating point data type is _______.
c. double
The basic commands that a computer performs are ____, and performance of arithmetic and logical operations.
c. input, output, storage
A program called a(n) ______ combines the object program with the programs from libraries.
c. linker
Main memory is an ordered sequence of items, called ____.
c. memory cells
The devices that the computer uses to display results are called _________ devices.
c. output
Dividing a problem into smaller subproblems is called _______ design.
c. structured
The _______ rules of a programming language tell you which statements are legal, or accepted, by the programming language.
c. syntax
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;
c. x = 10, y = 20.7
In C++, the mechanism that allows you to combine data and operations on the data into a single unit is called a(n) _________________________.
class
Several categories of computers exist, such as ______.
d. Mainframe, midsize, and micro
A(n) ______ consists of data and the operations on those data.
d. object
Suppose that sum and num are int variables and sum = 5 and num = 10. After the statement sum += num executes, ______.
d. sum = 15
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, 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