ONE 6th FORM Python code and pseudocode

ONE 6th FORM Python code and pseudocode

12th Grade

11 Qs

quiz-placeholder

Similar activities

AP CSP Loops Practice

AP CSP Loops Practice

9th - 12th Grade

12 Qs

Linear Search

Linear Search

12th Grade

10 Qs

WHILE Loops yr 9

WHILE Loops yr 9

9th - 12th Grade

13 Qs

Python Code Quiz

Python Code Quiz

8th - 12th Grade

11 Qs

Computer Science

Computer Science

3rd - 12th Grade

12 Qs

[AP CSP] Unit 4 Review: Functions and Lists

[AP CSP] Unit 4 Review: Functions and Lists

9th - 12th Grade

10 Qs

Banana Tales Lessons 3 & 4 Vocabulary

Banana Tales Lessons 3 & 4 Vocabulary

3rd Grade - University

10 Qs

ONE 6th FORM Python code and pseudocode

ONE 6th FORM Python code and pseudocode

Assessment

Quiz

Computers

12th Grade

Medium

Created by

Lorna Jarrett

Used 2+ times

FREE Resource

11 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Media Image

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

Media Image

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

Media Image

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

Media Image

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

Media Image

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

Media Image

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

Media Image

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

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?