Computer Science
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 digit 0 or 1 is called a binary digit, or ____.
bit
A sequence of eight bits is called a ____.
byte
The memory allocated for a float value is ____ bytes.
four
Every complete C++ program must have a(n) _______.
function named main
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, ____.
one = 10.5, two = 30.6
The ____ monitors the overall activity of the computer and provides services.
operating system
The devices that the computer uses to display results are called ____ devices.
output
A statement that begins with the # symbol is called a _______.
preprocessor directive
A ________ is a set of instructions that a computer executes to solve a problem.
program
Which of the following is a legal identifier?
program_1
a < 10 is called a(n) ________.
relational expression
Suppose that sum and num are int variables and sum = 5 and num = 10. After the statement sum += num executes, ____.
sum = 15
The ____ rules of a programming language tell you which statements are legal, or accepted by the programming language.
syntax
The rules that must be followed when writing programs in specific programming languages are called ________.
syntax
The CPU includes:
the arithmetic and logic unit (ALU) and the control unit.
Which of the following is a valid identifier name in C++?
three_stooges
The purpose of a memory address is:
to identify the location of a memory cell.
Suppose a = 5. After the execution of the statement ++a; the value of a is 6.
true
Suppose that sum is an int variable. The statement sum += 7; is equivalent to the statement sum = sum + 7;
true
Memory locations that can hold data are called:
variables
If you declare a variable and use it before initializing it the compiler will generate a(n) ________.
warning
What are the values of x and y after the following code executes? double a = 100; int b = 12; int x = b % 3; double y = a / b; int z = a / b;
x = 0, y = 8.33333 and z = 8
Considered the world's first general-purpose computer?
ENIAC
What was the purpose of the Enigma machine?
Encrypt Messages
The operator that represents logical AND is ________.
&&
____ is a valid char value.
'A'
Which of the following are valid operators in C++?
- +
Which of the following is the newline character?
/n
The C++ main function must return _______ when the program terminates successfully.
0
What will the following code display? int x = 10, y = 3, z = 6; cout << (x == y) << " "; cout << (z <= x) << " "; cout << (y != z) << " "; cout << (x > y && z < x) << " "; cout << (y < x && z < x) << " "; cout << (x < y || z < 0) << endl;
011110
What is displayed by the following code? int x= 5; int y= -2; int z = 2; cout << (x + y * z <= x + z * z - x) << endl;
1
If a is 3, b is 5, and c is 7, which of the following are true? b == 5; c == (a + b) - 1; b > 5; a >= 3; c <= (a * b) / a
1,2 and 4
The expression static_cast<int>(6.9) + static_cast<int>(7.9) evaluates to ____.
13
The length of the string "computer science" is ____.
16
Suppose that count is an int variable and count = 1. After the statement count++; executes, the value of count is ____.
2
The value of the expression 17 % 7 is ____.
3
The value of the expression 33/10, assuming both values are integral data types, is ____.
3
A comma is also called a statement terminator.
False
A mixed arithmetic expression contains all operands of the same type.
False
An operator that has only one operand is called a unique operator.
False
In C++, reserved words are the same as predefined identifiers.
False
The devices that feed data and programs into computers are called output devices.
False
The escape sequence \r moves the insertion point to the beginning of the next line.
False
When the computer is turned off, everything in secondary memory is lost.
False
Consider the following code. // Insertion Point 1 using namespace std; const float PI = 3.14; int main() { //Insertion Point 2 float r = 2.0; float area; area = PI * r * r;cout << "Area = " << area <<endl; return 0; } // Insertion Point 3 In this code, where does the include statement belong?
Insertion Point 1
What will the following code display? cout << "Larry"; cout << "Moe"; cout << "Curly";
Larry Moe Curly
___ are executable statements that inform the user what to do.
Prompt lines
Main memory is called ____.
Random Access Memory
The computer's main memory is commonly known as:
Random Access Memory (RAM)
Why is secondary storage needed?
Secondary storage is used to store longer-term information
The statements written by programmers are called ________.
Source Code
Choose the output of the following C++ statement: cout << "Sunny " << '\n' << "Day " << endl;
Sunny Day
What are the two types of programs?
System and Application Programs
What was the purpose of the Hollerith machine?
Tabulating the U.S. census data
In a C++ program, two forward slash characters "//" are used to indicate:
The beginning of a comment.
Ada Lovelace is credited as being
The first programmer
What is an object program?
The machine language version of the high-level language program (i.e. C++)
What happens if you use a C++ keyword as an identifier name?
The program will not compile.
What is displayed by the following code? int amount = 100; amount += amount * 2; cout << amount << endl;
300
____ is a valid int value.
46259
The expression static_cast<int>(9.9) evaluates to ____.
9
The operator used to test two operands for equality is ________.
==
What is used to terminate a statement in C++?
A semi-colon
What is an algorithm?
A step-by-step problem-solving process in which a solution is arrived at in a finite amount of time.
An Integrated Development Environment (IDE) typically includes
A text editor A debugger A compiler
An example of a floating point data type is ____.
double
What are the advantages of problem analysis and algorithm design over directly writing a program in a high-level language?
A well-analyzed problem leads to a well-designed algorithm. Moreover, a program that is well analyzed is easier to modify as well as spot and fix errors.
A set of precise steps for solving a problem is known as a(n):
Algorithm
The ____ is the brain of the computer and the single most expensive piece of hardware in your personal computer.
CPU
Who designed the Difference Engine #2?
Charles Babbage
Who was ADA Lovelaces' mentor?
Charles Babbage
________ are used to translate programming language source code instructions into the appropriate machine language instructions.
Compilers
What are the two main components of a computer?
Hardware and software
What is linking?
In linking, an object program is combined with other programs in the library, used in the program, to create the executable code.
What will the following code display? int three = 3; cout << "There are " << "three" << " stooges" << endl; cout << "Curly is my favorite of the " << three << endl;
There are three stooges Curly is my favorite of the 3
If a C++ arithmetic expression has no parentheses, operators are evaluated from left to right.
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
The maximum number of significant digits in float values is up to 6 or 7.
True
The maximum number of significant digits in values of the double type is 15.
True
The first commercially produced digital computer?
UNIVAC
A step-by-step problem-solving process in which a solution is arrived at in a finite amount of time is called a(n) ____.
algorithm
Suppose that alpha and beta are int variables and alpha = 5 and beta = 10. After the statement alpha *= beta; executes, ____.
alpha = 50
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;
At the heart of a computer is its central processing unit. The CPU's job is to:
carry out the operations commanded by the instructions fetch instructions and produce some result
Which of the following is a reserved word in C++?
char
Syntax errors are detected by the ________.
compiler
A program called a(n) ____ translates instructions written in high-level languages into machine code. decoder
complier
The devices that feed data and programs into computers are called ____ devices.
input
The basic commands that a computer performs are ____, and performance of arithmetic and logical operations. storage, directory, log
input,output,storage
The declaration int a, b, c; is equivalent to which of the following?
int a,b,c;
A program called a(n) ____ combines the object program with the programs from libraries.
linker
The error generated when all the parts that make up a program cannot be put together because one or more are missing is called a ________.
linker error
Data values that do not change while a program executes are ________.
literals
A program that loads an executable program into main memory is called a(n) ____.
loader
Mistakes by the programmer that cause a program to produce incorrect results are called ________.
logic errors
The operator that represents logic OR is ________.
||