LOGO100 logo

Manchester CODE100 Quiz and Knowledge rounds

Pseudo Code Quiz Round

These rounds are run on Slido and challengers need to pick an answer on their phones. This means both understanding the question and speed are of the essence.

Question 1

You are given the following pseudo code:

Function MYSTERY takes inputs num and x:
  Calculate 10 to the power of x and assign it to n
  Multiply num by n
  Round the result to the nearest integer
  Divide the result by n
  Return the result
End Function

What does this function do?

Question 2

You are given the following pseudo code:

Function CALCULATE_REMAINDERS takes inputs x and y:
    Initialize originalX as x
    Create an empty list called remainders

    While x is less than or equal to twice the value of originalX:
        Calculate the remainder of y divided by x
        Add the remainder to the list remainders
        Increment x by 1
        Increment y by 1

    Calculate the sum of remainders

    Return the sum of remainders
End Function

If X were 5, and Y were 17, what would this function return?

See codepen.

Question 3

You are given the following pseudo code:

Function CALCULATE_TOTAL_INVESTMENT takes input x:
    Set earnings to 0

    For each month from 1 to x:
        Add the value of month to earnings

    Calculate totalInvestmentRounded as the rounded-up value of earnings divided by 10

    Return totalInvestmentRounded
End Function

If x were 6, what would this function return?

See codepen.

Question 4

You are given the following pseudo code:

Function CONVERT takes inputs output and value:
    Initialize result as an empty string

    If output is equal to 'A':
        Set result as (value - 32) * 5 / 9

    If output is equal to 'B':
        Set result as value * 9 / 5 + 32

    Return result
End Function

See codepen.

Question 5

You are given the following pseudo code:

Function CRACK_THE_CODE takes input:
    Initialize result as an empty string

    For each character i in input:
        Get the Unicode code point of i
        Decrement the code point by i
        Convert the modified code point to its corresponding character
        Append the resulting character to result
    
    Return result
End Function

Which input would correctly return “Manchester”?

See codepen.

Back to all puzzles