Saudi Secondary School Certificate · Computer Science and Digital Skills
Python programming and algorithms
40 practice questions, each with the answer and an explanation.
Practise Python programming and algorithms now
Random questions from this topic, one at a time. You see the answer and the explanation straight after each one.
All 40 questions
- What is the output of `print([x**2 for x in range(6) if x % 2 == 0])`?
- What is the output of `print([x**2 for x in range(4) if x % 2 == 0])`?
- What is the output of `print([x**2 for x in range(5) if x % 2 == 0])`?
- What is the output of `print([x**2 for x in range(4) if x % 3 == 0])`?
- What is the output of `print([x**2 for x in range(7) if x % 2 == 0])`?
- What does `'algorithm'[3:4]` return in Python?
- What does `'network'[0:5]` return in Python?
- What does `'security'[0:8]` return in Python?
- What does `'computer'[0:8]` return in Python?
- What is the value of `s` after: `s = 0` / `for i in range(2, 8, 2): s += i`?
- What is the value of `s` after: `s = 0` / `for i in range(2, 10, 4): s += i`?
- What is the value of `s` after: `s = 0` / `for i in range(2, 12, 2): s += i`?
- What is the value of `s` after: `s = 0` / `for i in range(3, 11, 4): s += i`?
- What is the value of `s` after: `s = 0` / `for i in range(3, 9, 2): s += i`?
- A function returns 0 for n = 0, 1 for n = 1, and fib(n-1) + fib(n-2) for larger n. What is fib(12)?
- A function returns 0 for n = 0, 1 for n = 1, and fib(n-1) + fib(n-2) for larger n. What is fib(9)?
- A function returns 0 for n = 0, 1 for n = 1, and fib(n-1) + fib(n-2) for larger n. What is fib(10)?
- A function returns 0 for n = 0, 1 for n = 1, and fib(n-1) + fib(n-2) for larger n. What is fib(8)?
- A function returns 0 for n = 0, 1 for n = 1, and fib(n-1) + fib(n-2) for larger n. What is fib(11)?
- A function returns 0 for n = 0, 1 for n = 1, and fib(n-1) + fib(n-2) for larger n. What is fib(7)?
- A function returns 0 for n = 0, 1 for n = 1, and fib(n-1) + fib(n-2) for larger n. What is fib(6)?
- What is the decimal number 177 in binary?
- What is the decimal number 133 in binary?
- What is the binary number 1010001 in decimal?
- What is the binary number 1010 in decimal?
- What is the binary number 10010001 in decimal?
- What is the binary number 1100111 in decimal?
- What is the binary number 10011001 in decimal?
- What is the decimal number 49 in hexadecimal?
- What is the decimal number 148 in hexadecimal?
- What is the decimal number 175 in hexadecimal?
- What is the decimal number 190 in hexadecimal?
- What is the maximum number of comparisons needed by binary search on a sorted list of 512 items?
- What is the maximum number of comparisons needed by binary search on a sorted list of 16 items?
- What is the maximum number of comparisons needed by binary search on a sorted list of 128 items?
- What is the maximum number of comparisons needed by binary search on a sorted list of 1024 items?
- What is the maximum number of comparisons needed by binary search on a sorted list of 256 items?
- What is the maximum number of comparisons needed by binary search on a sorted list of 32 items?
- What is the maximum number of comparisons needed by binary search on a sorted list of 64 items?
- What is the output of a NOR gate when A = 0 and B = 0?
Keep practising
More Saudi Secondary School Certificate topics
- Electromagnetism, Quantum Physics, Organic Mechanisms and Kinetics43 questions
- Physical and organic chemistry43 questions
- Vectors, Calculus, Analytical Geometry and Probability Distributions42 questions
- Python Programming, Data Structures, Algorithms, Networks and Cybersecurity40 questions
- Differentiation and integration30 questions
- Networks, security and data18 questions
- Algebra, logarithms and trigonometry16 questions
- Electricity, waves and modern physics16 questions