1 In the pseudocode below What will the final value of count

1) In the pseudocode below:

What will the final value of counter be?

2) In the pseudocode below:

How many times will the statement counter = counter + 1 be executed?

3) True or False: Some For loops cannot be rewritten as While loops.

False

4) 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

5) What kind of loop is this?

Post-test while loop.

Pre-test while loop.

Pre-test until loop.

For loop.

6) What type of loop is this?

Pre-test until loop.

Pre-test while loop.

Post-test until loop.

For loop.

Post-test while loop.

7) 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

True

False

4) 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

5) What kind of loop is this?

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

Post-test while loop.

Pre-test while loop.

Pre-test until loop.

For loop.

6) What type of loop is this?

  Declare Integer counter    counter = 0  While counter > 0          Display counter          counter = counter + 1  End While  

Pre-test until loop.

Pre-test while loop.

Post-test until loop.

For loop.

Post-test while loop.

7) 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:

  If temperature < 60 Then          If wearing == \"coat\" Then                  Display \"Aren\'t you a little warm?\"          Else                  Display \"Brr!\"          End If  Else          Display \"Seems like a nice day!\"  End If  

Pseudocode B:

  If temperature > 60 Then          Display \"Seems like a nice day!\"  Else If wearing == \"coat\" Then          Display \"Aren\'t you a little warm?\"  Else          Display \"Brr!\"  End If  
True

False

Solution

1)counter will increment 9 times and condition breaks when conter value is 10

2) it is executed 9 times

3)true

4) option A B C E

5)option A - post test while loop

6)option B - pre test while loop

7)false ,both produce unequal input

1) In the pseudocode below: What will the final value of counter be? 2) In the pseudocode below: How many times will the statement counter = counter + 1 be exec
1) In the pseudocode below: What will the final value of counter be? 2) In the pseudocode below: How many times will the statement counter = counter + 1 be exec

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site