Search Header Logo

Unit 5 Python CodeHS

Authored by Chad (SCMS)

Used 9+ times

Unit 5 Python CodeHS
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

About

This quiz focuses on Python programming loops and control structures, specifically while loops and for loops. The material is appropriate for high school students in grades 9-12 who are learning introductory computer science or programming concepts. Students need to understand fundamental loop mechanics including how for loops work with the range() function and its parameters (start, stop, step), how while loops execute based on boolean conditions, and when to use control statements like break to exit loops early. The questions assess students' ability to trace through code execution, predict program output, analyze loop conditions using comparison and logical operators, and determine appropriate loop structures for different scenarios. Students must grasp concepts such as loop iteration counting, variable state changes within loops, exclusive versus inclusive ranges, and the critical difference between definite iteration (for loops) and indefinite iteration (while loops). This quiz was created by a classroom teacher who designed it for students studying introductory Python programming in high school. The assessment serves as an excellent tool for formative evaluation after students have completed initial instruction on loop structures and control flow. Teachers can deploy this quiz as a warm-up activity to activate prior knowledge before advancing to more complex programming concepts, or use it as homework to reinforce classroom learning about loop syntax and behavior. The variety of question types makes it particularly effective for review sessions where students need to practice code tracing and logical reasoning skills. This material aligns with Computer Science standards including CSTA K-12 CS Standards 3A-AP-10 (Use flowcharts and/or pseudocode to address complex problems as algorithms), 3A-AP-11 (Create clearly named variables that represent different data types), and 3A-AP-13 (Create prototypes that use algorithms to solve computational problems by leveraging prior student knowledge).

    Content View

    Student View

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

Media Image

What is the benefit of using the break command as in the program below?

The user can enter as many answers as they want

The program will break out of the loop as soon as the user enters the magic_number

The loop will prompt the user to enter a number no matter what input they give

The loop will give the magic_number after a certain number of tries

2.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

Media Image

What will be printed to the screen when this program is run?

100 0 -75 -125 -150

-150

-175

175

3.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

Media Image

What does this program print?

It’s still a nice day

It’s still a nice day

It’s still a nice day

It’s still a nice day

It’s still a nice day

It’s still a nice day

It’s still a nice day

It’s still a nice day

It’s still a nice day

It’s still a nice day

It’s still a nice day

It’s still a nice day

It’s still a nice day

It’s still a nice day

4.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

Media Image

What is the value of sum when this loop completes?

8

9

20

0

5.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

Which of the following while loops would continue to loop as long as num has values between the range of 3-12, exclusive?

while num > 12 and num < 3:

# do something with num

while num < 12 or num < 3:

# do something with num

while num <= 12 and num >= 3:

# do something with num

while num < 12 and num > 3:

# do something with num

6.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

Media Image

If the user enters ‘4’, I want the loop to exit. Where should the break command be placed in order to end the loop when the user enters this value?

Line 3

Line 5

Line 7

Line 9

7.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

Which of the following for loops would print the following numbers?

3 5 7 9

for i in range(3, 10, 2):

print(i)

for i in range(3, 9, 2):

print(i)

for i in range(9):

print(i)

for i in range(3,9):

print(i)

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?