Question: 1:True or False: Some For loops cannot be rewritten as While loops 2:In the pseudocode below: Function Integer perfect(Integer n) Declare Integer count = 0

1:True or False: Some For loops cannot be rewritten as While loops

2:In the pseudocode below:

Function Integer perfect(Integer n) Declare Integer count = 0 Declare Integer sum = 0 While count < n Set count = count + 1 Set sum = sum + count End While Return sum End Function Function Integer perfect_sum(Integer n) Declare Integer count = 0 Declare Integer sum = 0 While count < n Set count = count + 1 Set sum = sum + perfect(count) End While Return sum End Function Module main() Display perfect_sum(5) End Module 

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.

3:

What will the output be for the following pseudocode:

Declare Integer counter = 1 While counter < 10 Set counter = counter + 2 Display counter End While 

Separate each output with a single space.

4:

Boolean variables are commonly used as _______, which indicate whether a specific condition exists.

Question 13 options:

output variables

while loops

flags

unconditional expressions

input variables

5:

In the pseudocode below:

Module fibo(Integer n) Declare Integer first = 1 Declare Integer second = 1 Declare Integer next = 0 Declare Integer counter = 0 While counter < n Set counter = counter + 1 Set next = first + second Set first = second Set second = next Display next End While End Module 

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.

6:

In the pseudocode below:

Function Integer fibo_2(Integer n) If n == 1 Then Return 1 Else If n == 2 Then Return 1 Else Return fibo_2(n - 1) + fibo_2(n - 2) End If End Function Module loop(Integer n) Declare Integer counter = 0 While counter < n counter = counter + 1 Display fibo_2(counter) End While End Module 

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.

7:

What kind of loop is this?

Declare Integer counter counter = 0 Do Display counter counter = counter + 1 Until counter > 10 

Question 18 options:

Pre-test while loop.

Post-test while loop.

For loop.

Pre-test until loop.

Post-test until loop.

8:

System tests typically utilize which kind of testing?

Question 19 options:

Ad hoc testing

Black box testing

White box testing

Unit testing

9:

In the pseudocode below:

Function Integer halve(Integer n) Declare Integer half Set half = n / 2 Return half End Function Function Integer log2(Integer n) Declare Integer lg2 = 0 While n > 1 Set n = halve(n) Set lg2 = lg2 + 1 End While Return lg2 End Function Module main() Display log2(8) Display log2(4) Display log2(1) Display log2(13) End Module 

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)

10:

In the following pseudocode, what relational operator should be in the blank?

Display "Are you happy and you know it? (Y/N)" Input happy If happy ____ "Y" Then Display "Clap your hands!" End If 

Enter the correct relation in the box below

11:

Which of the following are legal Boolean values in pseudocode?

Question 22 options:

True

None

"True"

"False"

0

False

12:

In the following pseudocode:

Function Integer loop_rule(Integer n) If n is even Then Set n = n / 2 Else Set n = n * 3 + 1 End If Display n Return n End Function Function Integer loop(Integer n) Declare Integer count = 0 While n != 1 Set count = count + 1 Set n = loop_rule(n) End While Return count End Function Module main() Display loop(3) End Module 

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.

Question 23 options:

13:

Designing a program to avoid common errors is called ____________ programming.

Question 24 options:

"garbage in, garbage out"

detective

direct

validation

defensive

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!