test 1 computer science ch. 1 - 3
theDog is a valid identifier.
True
A(n) ____________________ is a location in memory, referenced by an identifier, in which a data value that can be changed is stored.
Variable
Which of the following most closely resembles human language?
a high-level language
computer
a programmable electronic device that can store, retrieve, and process data
computer program
a sequence of instructions to be performed by a computer
Algorithm
a step-by-step procedure for solving a problem in a finite amount of time
const is a valid identifier.
False. const is a reserved word
2morrow is a valid Identifier.
False. identifiers must begin with a letter or underscore.
Which one of the following is not a valid identifier in C++?
Go Home
Of the following components of a computer, which one presents the results of the processing to the outside world?
Output Device
substr
Returns a particular substring of a string
Define operating system.
The operating system manages all of the computer's resources. It can input programs, call the compiler, execute object programs, and carry out any other system commands.
DVD_ROM is a valid Identifier.
True
True or False? A C++ identifier cannot start with a digit.
True
True or False? A syntax template is a generic example of the C++ construct being defined.
True
True or False? Every C++ program must have a function named main.
True
True or False? In a computer, data is represented electronically by pulses of electricity.
True
True or False? The compiler is a program that translates a high-level language program into machine code.
True
The formal rules governing how valid instructions are written in a programming language.
syntax
In C++, the phrase "standard output device" usually refers to:
the display screen
argument list
the values in the parentheses of a function call (allows functions to communicate)
True or False? A syntax template is a generic example of the C++ construct being defined.
true
When declaring an operand such as floatPayrate, it is best to use named constants instead of literals constants because it can make your program more readable and easier to modify.
true
When dividing an integer by a float, the results are generally displayed in the form of a float if no other formatting perimeters are specified.
true
void function
A function that is called as a separate statement
elizabeth_the_2nd is a valid Identifier.
True
recycling is a valid Identifier.
True
Write a C++ program that prints out the lines of one of your favorite poems. Use a single space to separate each output line.
#include <iostream> using namespace std; int main() { cout<< "Jack and Jill went up the hill" <<endl; << "To fetch a pail of water" <<endl; << "Jack fell down and broke his crown" <<endl; << "And Jill came tumbling after" <<endl; return 0; }
What is the output of the following program fragment? (x is a float variable.) (# represents a space)x = 25.6284;cout << "**" << setw(6) << setprecision(1) << x << endl;
**##25.6
If the int variables int1 and int2 contain the values 4 and 5, respectively, then the value of the expression float(int1 / int2) is:
0.0
List the three steps in the problem-solving phase of the software life cycle.
1. Analyze the problem and specify what the solution must do 2. Develop a general solution(algorithm) to solve the problem 3. Verify that your solution really solves the problem
List the steps in the implementation phase of the software life cycle.
1. Testing your program means running(executing) your program on the computer, to see if it produces correct results 2. If it does not, then you must find out what is wrong with your program or algorithm and fix it--this is called debugging
Given the declaration statement and statement float someFloat; someFloat = 12; cout << someFloat what will be the value and output of someFloat?
12
Given that x is a float variable and num is an int variable containing the value 38, what will x contain after execution of the following statement: x = num / 4 + 3.0;
12.0
Given that x is a float variable and num is an int variable containing the value 5, what will x contain after execution of the following statement: x = num + 2;
7.0
What is the output of the following program fragment?cout << "Barrel" << endl;cout << ' ';cout << "of";cout << "Laughs" << endl;
Barrel ofLaughs
page# is a valid Identifier.
False
True or False? A literal string can continue onto more than one line, as long as it is enclosed in double quotes.
False
True or False? An assembler is a program that translates an assembly language program into a high-level language.
False
True or False? Some C++ reserved words can also be used as programmer-defined identifiers.
False
True or False? The term software refers to the physical components of a computer.
False
True or False? There is only one unique general solution (algorithm) for a given problem.
False
all-In- One is a valid identifier.
False
at
access characters directly by their positions
unary operator
an operator with just one operand
binary operator
an operator with two operands
information
any knowledge that can be communicated
Inside a computer, a single character such as the letter A usually is represented by a:
byte
A programming language is said to be ____________________ if it considers uppercase letters to be different from lowercase letters.
case-sensitive
integer
char, short, bool
A(n) ____________________ is a program that translates a high-level language program into machine code.
compiler
Of the following components of a computer, which one assures that program instructions are executed in the proper sequence?
control unit
setw
controls how many character positions the next data item should occupy when it is outputted
set precision
controls the number of decimal places (numbers to the right of the decimal point)
A specific set of values, along with operations that can be applied to those values.
data type
The process of determining the cause of an error in a program and correcting the error is called ____________________.
debugging
A(n) ____________________ is a statement that associates an identifier with a data object, a function, or a data type so that the programmer can refer to that item by name.
declaration
cctype
directive used to call toupper and tolower functions
float
double, double long
type casting
explicitly changing a value of one type into another
An arrangement of identifiers, literals, and operators that can be evaluated.
expression
C++ operand
expression or values on which an operator operates or works often constants or variables
In C++, subprograms are referred to as ____________________.
functions
showpoint
generally forces decimal points for general output
In C++ systems, names appearing in #include directives are called ____________________ files.
header
A name that is used to refer to a function or data object.
identifier
type coercion
implicitly changing a value of one type into another
Where can C++ comments appear in a computer program?
in constant and variable declarations
data
information in a form a computer can use
Any constant value written in a program is called a(n) ____________________ value.
literal
____________________ is the language made up of binary-coded instructions that are used directly by the computer.
machine language
Which problem-solving technique involves defining the beginning and ending states of a problem, then comparing different methods for getting between the states?
means-ends analysis
A language that is used to write the rules for another language
metalanguage
An identifier referring to a value that cannot be changed.
named constant
A(n) ____________________ is an input, output, or auxiliary storage device attached to a computer. It is a device that connects to the system unit and is controlled by the processor in the computer
peripheral device
programming
planning or scheduling the performance of a task or an event
A(n) ____________________ is a set of rules, symbols, and special words used to construct a computer program.
programming language
length/size
returns an integer value equal to the number of characters in the string
find
returns an integer value of the first occurrence of a particular substring
The set of rules that determines the meaning of instructions written in a programming language.
semantics
Which assignment statement could be used to store the letter A into the char variable someChar?
someChar = 'A';
fixed
specifically forces decimal formatted output when scientific E notation would have been the output