cs 159 exam 2
(a != 0) and !(a == 0) are complementary logical expressions (the variable a is an integer).
f
A function that accomplishes multiple processes is functionally cohesive.
f
A function that passes at least one parameter by address must pass them all by address.
f
In a pretest loop the minimum number of times that the statements found inside of the loop are executed is one.
f
In an event-controlled loop we know the total number of times that the actions found inside the body of the loop will be executed.
f
In this course you will be expected to validate that the input given is of the correct data type
f
It is a logical error to associate two switch case labels with a common set of actions.
f
It is never possible to determine if any parameters are passed to a function by address from an example call to the function.
f
The complement of x >= 3 is x <= 3
f
The dangling else logical error can be corrected by indenting the if and else the same number of spaces.
f
The only way to complement a NOT operator is with another NOT operator.
f
The recursive case does not require recursion, so it stops the chain of recursive calls.
f
The short-circuit method of evaluating logical expressions is only relevant to those expressions that make use of at least one relational operator.
f
To obtain the address of a variable we use the asterisk (*) operator
f
When attempting to print the result of a logical expression that is true as an integer the result will may be any non-zero value.
f
When the selection is based on a range of values, or the condition is not integral, we use the switch for our multiway selection needs.
f
With the use of pass by address it is now permissible for a function to be written to complete several sub-tasks of the program.
f
according to the course standards if all three expressions are not needed in a for loop then you should include a token expression rather than omit one of the three for loop expressions
f
all while loops should be converted into for loops for counter-controlled processes
f
because the control expression of a switch will generate a single value each constant expression that follows the keyword 'case' must represent a single value
f
in order for iterative processes to be considered nested they must appear in the same user-defined function
f
iterative processes are only considered to be nested when both the inner and outer loop use the same type of looping construct
f
the loop control variable in a counter-controlled process can only be incremented or decremented by one
f
the number of parentheses in a logical expression and its complement will be the same
f
the use of 'break' must be limited to repetition constructs
f
the use of 'continue' must be limited to selection constructs
f
(a != 0) and !(a) are complementary logical expressions (the variable a is an integer).
t
A structure chart may show the data that is exchanged between functions.
t
According to the course standards a 'for' loop should only be used with counter-controlled processes
t
Any statement, even another for loop, can be included in the body of a for loop.
t
Evaluate the following expression: 3 && 6 || 0
t
Expensive overhead due to the number of function calls is one limitation of recursion
t
In a pretest loop the control expression is evaluated before each iteration, including the first iteration.
t
In downward communication it is only a copy of the data that is sent to the function
t
It is a course standard to make use of { and } with all if-else constructs.
t
It is a good design practice to create a user-defined function such that it is testable apart from the rest of the program.
t
It is acceptable to consider a for loop when a repetitive process is to be executed a known number of times.
t
The break statement results in the control of the program exiting the switch statement.
t
The called function must declare a special type of variable known as a pointer to store a memory address that is sent from the calling function.
t
The case label represents an integral type that is a possible result of the control expression
t
The condition that determines whether iteration is to continue in a loop is known as the loop control expression.
t
The do while loop will test the loop control expression after the execution of the statements found inside the body of loop.
t
The else is executed only when all previously evaluated conditions are false in a multiway else-if construct.
t
The logical OR operator is true only when at least one of its operands is true.
t
The number of times that the loop control expression is evaluated is one more than the number of iterations in a pretest loop
t
The scope of an object determines the region of the program in which it is visible (and defined).
t
The work done in preparation for a loop is known as loop update.
t
There is no semi-colon following the logical expression of an if...else construct.
t
a character can represent logical data
t
a double can represent logical data
t
a function always returns control (and sometimes a value) to the function that called it
t
a large number of function calls will require a large amount of memory
t
a logical expression that contains a NOT operator may also have a NOT operator in its complement
t
an iterative solution to a counter-controlled process may include either a pretest or post-test constructs
t
each user-defined function must be limited to a single 'return' statement
t
in a 'do-while' loop the number of times the loop control expression is evaluated = the number of iterations
t
in a 'for' loop the number of times the loop control expression is evaluated is one more than the number of iterations
t
in a 'while' loop the number of times the loop control expression is evaluated is one more than the number of iterations
t
input validation is one example of an event-controlled problem
t
nested selection often involves the evaluation of two different variables in the control expressions
t
recursion is a repetitive process in which a function calls itself
t
selection alone is not used to implement input validation because it provides only a finite number of opportunities for the user to input acceptable data
t
the 'default' case is optional but when it is used it will not be followed by a constant expression
t
the executable statements represented by a 'case' may include another 'switch' construct
t
the expression that follows the keyword 'case' may include a mathematical operator
t
the expression that follows the keyword 'case' may include one or more constant operands
t
the expression that follows the keyword 'case' must not represent the same value as any other 'case'
t
the factorial is one of the most common first examples given to demonstrate the use of recursion
t
the order of operations in a logical expression and its compliment will be the same
t
the total number of iterations in a counter-controlled process can be determined prior to the first iteration
t
when the base case is reached there are no more recursive function calls and the function can begin the process of returning to previously called occurrences of the function
t
code found inside the body of the loop is also found again outside the body of the loop is indicative of what?
wrong looping construct