
ONE 6th FORM Python code and pseudocode

Quiz
•
Computers
•
12th Grade
•
Medium

Lorna Jarrett
Used 2+ times
FREE Resource
11 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What does the code calculate, and how would you comment on the base case in Python?
The code calculates the sum of numbers; the base case avoids infinite recursion.
The code calculates the factorial of a number; the base case stops recursion.
The code calculates the square of a number; the base case simplifies the calculation.
The code calculates powers of a number; the base case ensures all numbers are included.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Modify the pseudocode to calculate the cubes instead of the squares. Which of these changes is correct?
Replace OUTPUT i^2 with OUTPUT i^3.
Add SET cube TO i^3 above the OUTPUT line.
Replace FOR i FROM 1 TO 10 DO with FOR i FROM 1 TO 100 DO.
Replace OUTPUT i^2 with OUTPUT i*i.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How would you add a comment explaining the purpose of the modulus operator in Python?
# The modulus operator (%) checks if the number is even or odd.
# The modulus operator (%) adds two numbers.
# The modulus operator (%) finds the square root of a number.
# The modulus operator (%) divides a number and rounds down.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Write a comment for the Python code explaining the purpose of the loop.
# This loop adds all names to a list called names.
# This loop counts the number of people in the list.
# This loop greets each person by printing their name.
# This loop calculates the total length of all names.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How would you comment the line total += num to explain what it does?
# Checks if num is greater than the total variable.
# Divides the total by num and updates it.
# Multiplies num by the total and prints it.
# Adds the value of num to the total variable.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What type of decision-making structure is used, and how could you comment it effectively?
# A loop structure that checks numbers.
# An if-elif-else decision structure to classify the number.
# A recursive function that compares numbers.
# A conditional statement that calculates square roots.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How would you comment the line if command == "exit": to explain its purpose?
# Checks if the user wants to terminate the loop.
# Skips the next iteration if "exit" is entered.
# Ends the program immediately after this line.
# Runs an infinite loop when "exit" is entered.
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
Pseudocode - OCR ERL

Quiz
•
9th - 12th Grade
12 questions
Hour of Code

Quiz
•
6th - 12th Grade
9 questions
Unit 5 -- Lists, Loops, Traversals

Quiz
•
9th - 12th Grade
12 questions
Python list starter

Quiz
•
10th Grade - University
14 questions
Code.org Unit 3

Quiz
•
9th - 12th Grade
16 questions
Python U2M3 Test

Quiz
•
9th - 12th Grade
15 questions
AQA Computer Science GCSE - 3.1 Fundamentals of algorithms

Quiz
•
10th - 12th Grade
15 questions
PYTHON PROGRAMMING

Quiz
•
11th - 12th Grade
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade