O-Level Computing (7155) Programming in Python quiz: variables, data types, selection, loops, lists, strings, functions quiz
15questions. Pick an answer and you'll see why right away.
Which programming language is used in the lab-based Paper 2 of O-Level Computing 7155?
What data type does Python's input() function always return?
Which line correctly reads a whole number from the user so it can be used in arithmetic?
Which of these is the bool data type?
A program sets mark = 60. The first branch runs if mark is at least 75 and prints A; the elif runs if mark is at least 50 and prints B; otherwise it prints C. What is printed?
Which operator tests whether two values are equal in Python?
When is a for loop most appropriate?
What is the main risk of a while loop?
What value does total hold after this code? total = 0; for n in range(1, 4): total = total + n
What is the index of the first item in a Python list?
Given word = "CODE", what does word[0:2] return?
Which method adds an item to the end of a Python list?
What does len(scores) return if scores = [70, 85, 60, 90]?
Why are functions useful in a program?
What does this function return? def add(a, b): return a + b -- called as add(3, 4)