1Which logical operators perform shortcircuit evaluation Sel
1)Which logical operators perform short-circuit evaluation? (Select all that apply.)
NOT
AND
OR
None of the above
2)Boolean variables are commonly used as _______, which indicate whether a specific condition exists.
input variables
while loops
output variables
unconditional expressions
flags
3)System tests typically utilize which kind of testing?
Black box testing
Ad hoc testing
Unit testing
White box testing
4)The order (sequence) of statements in a program is:
Always important.
Sometimes important.
Never important.
5)Designing a program to avoid common errors is called ____________ programming.
validation
defensive
detective
\"garbage in, garbage out\"
direct
6)Following are some techniques that can be used for designing black box tests. Match each technique with its definition.
Involves identifying the causes (input conditions) and effects (output conditions) and generating test cases accordingly.
Involves dividing input values into valid and invalid partitions and selecting representative values from each partition as test data.
Involves determination of boundaries for input values and selecting values that are at the boundaries and just inside/ outside of the boundaries as test data.
Equivalence partitioning
Boundary value analysis
Cause effect graphing
7)Match the following testing terms to their definition.
Tests the smallest unit of a program, such as a single module.
Describes a particular test to be performed in order to determine whether the item under test works correctly for a given set of conditions (e.g., inputs).
Describes how a system will be tested.
Tests a complete software system to verify that it meets requirements.
Tests performed by giving certain inputs and examining the outputs against expected outputs.
Tests in which the internal implementation of the item being tested is not known to the tester.
Unit tests
System tests
Black box tests
Functional tests
Test plan
Test case
8)Which of the following statements is true about this Boolean expression?
The expression is never true
The expression is true for numbers between 0 and 100
The expression is true for numbers greater than 100
The expression is true for numbers less than 0
The expression is always true
9)In the pseudocode below:
What will be the output from calling loop(6) (separate each output with a single space)?
Hint: You may find it easier to write a Python program to calculate the above instead of trying to work out the answer on paper. Whichever way you find easier is acceptable.
10)In the pseudocode below:
What will be the output from calling fibo(5) (separate each output with a single space)?
Hint: You may find it easier to write a Python program to calculate the above instead of trying to work out the answer on paper. Whichever way you find easier is acceptable.
11) In the following pseudocode:
What will be the output from this loop (separate each output with a single space)?
Hint: You may find it easier to write a Python program to calculate the above instead of trying to work out the answer on paper. Whichever way you find easier is acceptable.
12) In the pseudocode below:
What will be the output when the main module is called (separate each output with a single space)?
Hint: You may find it easier to write a Python program to calculate the above instead of trying to work out the answer on paper. Whichever way you find easier is acceptable.
13) In the pseudocode below:
What will be the output when the main module is called (separate each output with a single space)?
Hint: Pay particular attention to the type of the variable named \"half\" in the \"halve\" function. Integers are always whole numbers, so if half is an integer, then:
half = 3/2
would result in half being equal to 1 (not 1.5, which isn\'t a whole number).
Additional hint: you might decide that it\'s easier to write the Python code for the above pseudocode and to see what the program actually produces instead of trying to just figure it out on paper. If so, then
Set half = n / 2
can be written in Python as:
half = int(n / 2)
14) What will the output be for the following pseudocode:
Separate each output with a single space.
15) In the pseudocode below:
What will the final value of counter be?
16) In the pseudocode below:
How many times will the statement counter = counter + 1 be executed?
17) True or False: Some For loops cannot be rewritten as While loops.
False
18) Which of the following types of logic can be included inside of a loop (check all that apply):
If statements
Module and function calls
Other loops
Module and function definitions
Sequences of statements
19) What kind of loop is this?
Post-test while loop.
Pre-test while loop.
Pre-test until loop.
For loop.
20) What type of loop is this?
Pre-test until loop.
Pre-test while loop.
Post-test until loop.
For loop.
Post-test while loop.
21) True or False: For any integer value of temperature, the following two pieces of pseudocode always return the same results.
Hint: What output will be produced for the following values of temperature: 59; 60; 61? Are these outputs the same for both versions of the pseudocode?
Pseudocode A:
Pseudocode B:
False
22) Which of the following are legal Boolean values in pseudocode?
False
None
0
True
\"False\"
\"True\"
23) In the following pseudocode, what relational operator should be in the blank?
Enter the correct relation in the box below (do not include any spaces).
24) Correctly order the following lines of pseudocode to create a working algorithm.
| NOT | ||||||||||||||||||||||||||||||||||||||||||||||||||
| AND | ||||||||||||||||||||||||||||||||||||||||||||||||||
| OR | ||||||||||||||||||||||||||||||||||||||||||||||||||
| None of the above 2)Boolean variables are commonly used as _______, which indicate whether a specific condition exists.
|
Solution
answers:
1. AND
2. commonly used in while loop as condional expressions
3.black box testing
4.always important
5. defencive programming
6.
Cause Effect Graphing: Involves identifying the causes (input conditions) and effects (output conditions) and generating test cases accordingly.
Equivalence partitioning: Involves dividing input values into valid and invalid partitions and selecting representative values from each partition as test data.
Boundary Value Analysis: involves determination of boundaries for input values and selecting values that are at the boundaries and just inside/ outside.
7. unit testing: Tests the smallest unit of a program, such as a single module.
functional testing: Describes a particular test to be performed in order to determine whether the item under test works correctly for a given set of conditions
system testing:
Tests a complete software system to verify that it meets requirements.
black box: Tests a complete software system to verify that it meets requirements.
white box:
Tests in which the internal implementation of the item being tested is not known to the tester
static testing:
Tests performed by giving certain inputs and examining the outputs against expected outputs.





