What data type would you use to store the value True or False?
easyWhat is a string?
easyExplain what casting means and give an example.
mediumWhat is a constant? How is it different from a variable?
easyExplain the purpose of comments in code.
easyWhich data type would be most appropriate for storing the number of students in a class?
easyExplain why it is good practice to use a constant (e.g. VAT_RATE = 0.2) rather than writing the value 0.2 directly throughout a program.
mediumA variable is declared as: age = "16". What problem might this cause later in the program if age is used in a calculation like age + 1?
mediumWhat is the difference between declaring a variable and assigning a value to it?
mediumWhich of these is the most suitable data type for storing a product's price, e.g. ยฃ4.99?
easyWhat are the three basic programming constructs?
easyWhat is the difference between = and == in most programming languages?
easyWhat does this pseudocode output? total โ 0 FOR num IN [3, 6, 9] total โ total + num ENDFOR OUTPUT total
mediumWhat is an infinite loop? How would you cause one accidentally?
mediumWhat is the difference between a FOR loop and a WHILE loop?
mediumWhich programming construct would be used to repeatedly ask a user for input until they enter a valid value?
easyTrace this pseudocode and state the final value of x: x โ 1 WHILE x < 10 x โ x * 2 ENDWHILE OUTPUT x
mediumWhich of the following correctly demonstrates "sequence" as a programming construct?
easyA program needs to check a student's grade and output "Pass" if it is 40 or above, or "Fail" otherwise. Which construct is needed, and write the pseudocode for it.
mediumWhat will the following pseudocode output? FOR i โ 1 TO 3 IF i = 2 THEN OUTPUT "two" ELSE OUTPUT i ENDIF ENDFOR
mediumWhat is the purpose of a RETURN statement in a function?
mediumWhat is the difference between a procedure and a function?
mediumWhat is a "parameter" in the context of a function or procedure?
easyConsider this function: FUNCTION double(num) RETURN num * 2 ENDFUNCTION What is the result of calling double(7)?
easyExplain one advantage of breaking a program into functions/procedures rather than writing all the code in one block.
mediumA function is defined as: FUNCTION calculateArea(width, height). What are "width" and "height" examples of?
easyWrite pseudocode for a function called isEven that takes one parameter, num, and returns True if num is even and False otherwise.
mediumA procedure is defined as: PROCEDURE displayMessage(name). Which of the following calls is correct, assuming name is a string parameter?
easyExplain what happens to a variable declared inside a function once the function finishes executing (assuming it is a "local" variable).
hardConsider this function: FUNCTION addTax(price, taxRate) RETURN price + (price * taxRate) ENDFUNCTION What value is returned by addTax(100, 0.2)?
mediumWhat does the following Python code output? words = ["cat", "dog", "bird"] print(words[1])
easyWhat is a one-dimensional array?
easyGiven the array scores = [45, 67, 23, 89], what is the value of scores[2]?
easyWhat is a two-dimensional (2D) array best used to represent?
mediumGiven a 2D array grid where grid[1][2] = 9, explain what the two indices 1 and 2 represent.
mediumWrite pseudocode to declare a 1D array called temperatures that can store 7 integer values, and set every value to 0.
mediumA program stores student names in a 1D array called names, with 30 elements (indices 0 to 29). Which pseudocode would correctly output every name?
mediumExplain why a 2D array would be more appropriate than several separate 1D arrays for storing a seating plan in a classroom with rows and columns of desks.
hardGiven the 2D array board = [[1,2,3],[4,5,6],[7,8,9]], what is the value of board[2][0]?
mediumWrite pseudocode using a nested FOR loop to output every element of a 2D array called grid, which has 3 rows and 4 columns.
hardWhat is concatenation? Write a Python example.
easyWhat does the following Python code output? name = "Computing" print(len(name))
easyWhat is a "substring"?
easyWhat does the following Python code output? word = "Python" print(word[0:3])
mediumWhat does the following Python code output? name = "computer science" print(name.upper())
easyWrite a line of pseudocode or Python that concatenates the strings "Hello, " and a variable called name, and stores the result in a variable called greeting.
easyA string variable contains " Hello " with extra spaces at the start and end. Which type of string operation would remove these extra spaces?
mediumGiven the string fullName = "Ada Lovelace", write pseudocode/Python to extract just the first name ("Ada"), explaining which string function(s) you would need.
hardWhat does the following code output? word = "code" print(word + word.upper())
mediumExplain why string manipulation functions like length, substring, and case conversion are useful when validating user input, such as a username.
hardWhat is the purpose of opening a file in "write" mode?
easyWhy is it important to close a file after a program has finished reading from or writing to it?
mediumWhat is the difference between "write" mode and "append" mode when opening a file?
mediumWrite pseudocode to open a file called "scores.txt" for reading, read one line from it, and store the line in a variable called data.
mediumA program needs to read every line from a text file called "names.txt" and output each one. What programming construct would typically be used alongside file reading commands to achieve this?
mediumWhat does "EOF" stand for, and why is it useful when reading from a file?
mediumWrite pseudocode that opens a file called "log.txt" in append mode and writes the string "Login successful" to it as a new line.
mediumA program reads data from "records.txt" but the file does not exist on the computer. What is most likely to happen?
mediumExplain one advantage of storing data in a text file rather than only keeping it in variables while a program runs.
mediumA program writes each new high score to a file called "highscores.txt" every time it is run, without deleting previous scores. Which file mode should be used, and why?
medium