1/149
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
What does the term hardware refer to?
The physical components that make up a computer
A(n) __________ is a set of instructions that the computer follows to solve a problem.
program
Computer programs are also known as
software
At the heart of a computer is its central processing unit. The CPU's job is:
All of these
A computer stores a program while it is running
in main memory
The __________ decodes an instruction and generates an electronic signal
Control Unit
The CPU's control unit retrieves the next instruction in a sequence of program instructions from main
memory in the __________ stage.
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?
decode
The two parts of the CPU are
the Control Unit and the Arithmetic and Logic Unit
A volatile type of memory that is used for temporary storage is
RAM
The purpose of a memory address is:
to identify the location of a byte in memory
Programs are normally stored in __________ and loaded into main memory as needed
secondary storage
A computer monitor is a type of
output device
Which of the following is not a common input device
printer
Which of the following is not one of the major components of a computer system?
the preprocessor
A set of well-defined steps for performing a task or solving a problem is known as a(n):
algorithm
When a programmer saves to a file the statements he or she writes to create a program, these statements are
source code
The programmer usually enters source code into a computer with
text editor
In the process of translating a source file into an executable file, which of the following is the correct sequence?
Source code, preprocessor, modified source code, compiler, object code, linker, executable code.
An Integrated Development Environment (IDE) typically consists of
All of the above
________ are used to translate each source code instruction into the appropriate machine language instruction.
compilers
This is a set of rules that must be followed when constructing a program
syntax
Words that have a special meaning and may be used only for their intended purpose are known as
Key words
Which of the following best describes an operator?
An operator allows you to perform operations on one or more pieces of data.
This is used in a program to mark the beginning or ending of a statement, or separate items in a list:
punctuation
Characters or symbols that perform operations on one or more operands are:
operators
This is a complete instruction that causes the computer to perform some action:
statement
A named storage location in the computer's memory that holds a piece of information is a(n):
variable
A variable definition defines the name of a variable that will be used in a program, as well as:
the type of data it will be used to hold
Three primary activities of a program are:
input, processing, output
Which step uncovers any syntax errors in your program?
compiling
Mistakes that cause a running program to produce incorrect results are called
logic errors
The programming process consists of several steps, which include
design, creation, testing, debugging
The first step in writing a program is to
clearly define what the program is to do
A model often used when creating a program that begins with the overall task and refines it into smaller subtasks is a(n)
hierarchy chart
A model often used when creating a program that begins with the overall task and refines it into smaller subtasks is a(n)
desk checking
The two methods used by C++ to write computer programs are:
procedural programming and object-oriented programming
In a C++ program, two slash marks (//) indica
the beginning of a comment
A statement that starts with a hashtag (or pound) symbol (#) is called a
a preprocessor directive
For every opening brace ({) in a C++ program, there must be
closing brace
The __________ is(are) used to display information on the computer's screen.
cout object
In the following statement, the characters Hello! are a(n)
cout << "Hello!";
string literal
The __________ causes the content of another file to be inserted into a program
#include directive
Which of the following must be included in any program that uses the cout object?
the header file iostream
Character constants in C++ are always enclosed in
single quotation marks ( ' ' )
Every complete C++ program must have a
function names main
In a cout statement, which of the following will advance the output position to the beginning of the next line?
endl or \n
What will the following code display?
cout << "Monday";
cout << "Tuesday";
cout << "Wednesday";
MondayTuesdayWednesday
What will the following code display?
int number = 23;
cout << "The number is " << "number" << endl;
The number is number
What will the following code display?
cout << "Four\n" << "score\n";
cout << "and" << "\nseven";
cout << "\nyears" << " ago" << endl;
Four
score
and seven
years ago
What will the following code display?
cout << "Roses " << "are red";
cout << "and " << "violets/n"
cout << "are" << "blue" << endl;
Roses are red and violets/nare blue
Which control sequence is used to skip over to the next horizontal tab stop?
\t
A(n) __________ represents a storage location in the computer's memory.
variable
Data items whose values do not change while the program is running are
literals
A variable definition tells the computer
the variable's name and the type of data it will hold
You must have a _____________ for every variable you intend to use in a program.
variable definition
Which of the following is not a valid C++ identifier?
1user
What will the following code display?
int x = 23, y = 34, z = 45;
cout << x << y << z << endl;
233445
The numeric data types in C++ can be broken into two general categories which are
integers and floating-point numbers
Besides the decimal number system that is most common (base 10), two other number systems that can be used in C++ programs are
octal and hexadecimal
A character literal is __________, whereas a string literal is __________
enclosed in single quotation marks, enclosed in double quotation marks
Which data type typically requires only one byte of storage?
char
In C++11, if you want an integer literal to be treated as a long long int, you can append__________ at the end of the number.
LL
The data type used to declare variables that can hold real numbers is
double
The float data type is considered ___________ precision and the double data type is considered__________ precision
single, double
Which of the following statements correctly assigns the character M to the variable named letter?
letter = ‘M’;
Which of the following lines must be included in a program that has string variables?
#include<string>
Assuming that a program has the following string object definition, which statement correctly assigns the string literal "Jane" to the string object? string name;
name = "Jane";
In memory, C++ automatically places a(n) __________ at the end of string literals which __________.
null terminator, marks the end of the string
Which of the following defines a double-precision floating-point variable named payCheck?
double payCheck;
The data type of a variable whose value can be either true or false is
bool
What will be the output after the following lines of code execute?
bool choice;
choice = true;
cout << "Your choice is " << choice << endl;
Your choice is 1
Using C++11: What data type does the compiler determine for the variable cost in the following
statement?
auto cost = 14.95;
double
A variable's __________ is the part of the program that has access to the variable.
scope
What is the value stored in the variable myNum after the following assignment statement executes? myNum = 23 % 5
3
What is the value of cookies after the following statements execute?
int number = 38, children = 4, cookies;
cookies = number % children;
2
What is the value of number after the following statements execute?
int number;
number = 18 / 4;
4
What is the value of number after the following statements execute?
int number;
number = 18 % 4 + 2;
4
What is output of the following statement?
cout << 4 * (15 / (1 + 3)) << endl;
12
Which part of the following line is ignored by the compiler?
double userName = "janedoe"; // user's name is janedoe
//user’s name is janedoe
A multi-line comment
all are true
Which of the following statements correctly defines a named constant named TAX_RATE that holds
the value 0.075?
const double TAX_RATE = 0.075;
Given the following program, which line(s) cause(s) output to be displayed on the screen?
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 }
line 14
The __________ causes a program to wait until information is typed at the keyboard and the [Enter] key is pressed.
cin object
The __________ operator always follows the cin object, and the __________ operator follows the cout object.
>>, <<
Which of the following must be included in any program that uses the cin object?
the header file iostream
When a user types values at the keyboard, those values are first stored
in the keyboard buffer
Which of the following will allow the user to input the values 15 and 20 and have them stored in variables named base and height, respectively?
cin >> base >> height;
What will be displayed after the following statements execute?
int num1 = 5;
int num2 = 3;
cout << "The result is " << (num1 * num2 + 10) << endl;
The result is 25
What is the value of result after the following statement executes?
result = (3 * 5) % 4 + 24 / (15 - (7 - 4));
5
In the following statement, what will be executed first according to the order of precedence?
result = 6 - 3 * 2 + 7 - 10 / 2;
3 * 2
Associativity is either right to left or
left to right
What is the value of x after the following code executes?
int x = 0;
int y = 5;
int z = 4;
x = x + y + z * 2;
13
What is the value of average after the following code executes?
double average;
average = 1.0 + 2.0 + 3.0 / 3.0;
4.0
What is the value of cube after the following code executes?
double cube, side;
side = 5.0;
cube = pow(side, 3.0);
125.0
When the final value of an expression is assigned to a variable, it will be converted to
the data type of the variable
When C++ is working with an operator, it strives to convert operands to the same type. This is known as
type conversion
When a variable is assigned a number that is too large for its data type, it
overflows
What is the value of x after the following code executes?
int x;
x = 3 / static_cast<int>(4.5 + 6.4);
0
Which statement is equivalent to the following?
number += 1;
number = number +1;