KAMSC CS Semester 2 Exam
identifiers
A name for a variable, type, type member, template, class, function, namespace, etc.
declared
All variables must be...
e.
Counter controlled repetition requires all of the following except... a. the name of a control variable b. the initial value of the control variable c. the conditional that tests for the final value of the control variable d. the increment/decrement by which the control variable is modified each time through the loop e. all of the above are correct f. all of the above are incorrect
False
Keywords can be used as identifiers for variable names. True or False?
BASIC, COBOL, Pascal, Java, C, ForTran
Name some examples of high level languages
intialized
Not all variables need to be...
right to left
The conditional operation, unary operators increment, decrement, plus, minus, casts, and the assignment operators associate from ________ to __________
letters, digits, and underscores
What are identifiers limited to?
repetition, selection, sequence
What are the 3 control structures?
Preliminary, process, output
What are the 3 parts to the first refinement?
initialization, processing, termination
What are the 3 phases of a program?
if, if-else, switch
What are the 3 types of selection structures?
\n (new line), \t (new tab)
What are the escape sequences?
They are all translator languages
What doe compilers, assemblers, and editors all have in common?
invokes object function
What does -.operator do?
Assigns an initial value
What does initializing do?
true and false
What does the data type "bool" represent?
space is allocated in RAM
What happens when an object is created?
conditional operator (?:)
What is C++'s only ternary operator?
dividing by 0
What is a fatal logic error?
counter-controlled loop
What is another term for "for loop"?
do while loop
What is considered a post test structure?
while loop
What is considered a pretest structure?
Concatenate
What is it called when you join 2 strings together?
while loop
What is repetition?
if-else statement
What is selection?
default (ex. cout, cin)
What is sequence?
Accumulators
_______________ need to be initialized
+=
addition assignment operator
Indiscriminate branching
affects the flow of control of coding, using GOTO statements that make code difficult to follow and prone to errors
pseudocode
an artificial and informal language that helps programmers develop algorithms. (similar to everyday english)
class
an expanded concept of a data structure: instead of holding only data, it can hold both data and functions
+, -, *, /, %
binary operators
--
decrement operator
postincrement or postdecrement operator
if an increment or decrement operator is placed after a variable, it is referred to as the...
false
int can represent real numbers. True or false?
scope
This defines where a variable can be used in the program
top
This is a single statement that conveys the overall function of the program
Implementation
This is the coding phase
Design phase
This is the phase where you solve the problem
Analyze Phase
This is the testing phase
do-while loop
This makes sure the code will run at least one time
if
This selection structure either performs an action if the condition is true or skips the action if the condition is false
if-else
This selection structure performs an action if a condition is true and performs a different function if the condition is false
switch
This selection structure performs one of many different actions depending on the value of an expression
ternary operator
This takes 3 conditional operands. The first operand is a condition, the second operand is the value for the entire conditional, expression if the condition is true, and the third operand is the value for the entire conditional expression if the condition is false
control structures
serves to specify what has to be done by a program, when and under which circumstances
Bohm and Jacopini
showed that all programming code could be done through 3 structured programming things - sequence, selection, and repetition
spaghetti code
snarled, unstructured program logic
yes
Is it possible to have more than one object in one class?
data type
Declaring variables specifies what?
truncated
Dividing two integers results in integer division in which any fractional part of the calculation is lost
true
Float handles numbers with decimal points. True or false?
preincrement or predecrement operator
If an increment or decrement operator is placed before a variable, it is referred to as the...
++
Increment operator
True
the C++ compiler ignores whitespace characters. True or False?