Photo AI

For each of the pseudocode algorithms shown below, tick the appropriate box to show whether they will loop infinitely or not - OCR - GCSE Computer Science - Question 6 - 2018 - Paper 1

Question icon

Question 6

For-each-of-the-pseudocode-algorithms-shown-below,-tick-the-appropriate-box-to-show-whether-they-will-loop-infinitely-or-not-OCR-GCSE Computer Science-Question 6-2018-Paper 1.png

For each of the pseudocode algorithms shown below, tick the appropriate box to show whether they will loop infinitely or not. 1. x = 0 while True print... show full transcript

Worked Solution & Example Answer:For each of the pseudocode algorithms shown below, tick the appropriate box to show whether they will loop infinitely or not - OCR - GCSE Computer Science - Question 6 - 2018 - Paper 1

Step 1

Will loop infinitely

96%

114 rated

Answer

  1. x = 0
    • This will loop infinitely because the condition in 'while True' is always true.

Step 2

Will not loop infinitely

99%

104 rated

Answer

  1. x = 0

    • This will not loop infinitely because the loop will terminate once x reaches 10.
  2. x = 0

    • This will not loop infinitely because the value of x is incremented, allowing the loop to terminate once x reaches 10.
  3. y = 5

    • This will not loop infinitely because the for loop will execute a fixed number of times (5) and then terminate.

Step 3

Using pseudocode, write an algorithm that will use a count-controlled loop to print out the numbers 1 to 10 in ascending order.

96%

101 rated

Answer

for i = 1 to 10
    print i
next

This pseudocode uses a count-controlled loop that starts at 1 and goes up to 10, printing each number in ascending order.

Join the GCSE students using SimpleStudy...

97% of Students

Report Improved Results

98% of Students

Recommend to friends

100,000+

Students Supported

1 Million+

Questions answered

;