python loop practice

python loop practice

Professional Development

12 Qs

quiz-placeholder

Similar activities

OS Ch8_2

OS Ch8_2

12th Grade - Professional Development

17 Qs

Power BI Introduction and Connecting with Data Sources

Power BI Introduction and Connecting with Data Sources

Professional Development

9 Qs

Multidimensional OLAP Cubes for Business Intelligence

Multidimensional OLAP Cubes for Business Intelligence

Professional Development

14 Qs

FOSS FEST QUIZ

FOSS FEST QUIZ

Professional Development

10 Qs

CodeMonkey Platform Management & Resources

CodeMonkey Platform Management & Resources

Professional Development

10 Qs

Physical Security Controls

Physical Security Controls

Professional Development

10 Qs

GUESS THAT WORD IN CYBER!

GUESS THAT WORD IN CYBER!

Professional Development

10 Qs

Let's Play Together

Let's Play Together

University - Professional Development

10 Qs

python loop practice

python loop practice

Assessment

Quiz

Computers

Professional Development

Practice Problem

Hard

Created by

Felipe Millacura

Used 28+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

12 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

20 sec • Ungraded

What's your mood today?

Media Image
Media Image
Media Image
Media Image

2.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What is the result of executing the following code?


number = 5

while number <= 5:

if number < 5:

number = number + 1

print(number)

The program will loop indefinitely

The value of number will be printed exactly 1 time

The while loop will never get executed

The value of number will be printed exactly 5 times

3.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What will the following code print?


counter = 1

sum = 0

while counter <= 6:

sum = sum + counter

counter = counter + 2

print(sum)

12

9

7

8

4.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What will be printed by the following code when it executes?

sum = 0

values = [1,3,5,7]

for number in values:

sum = sum + number

print(sum)

4

0

7

16

5.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What is the last thing printed when the following code is run?

number = 0

while number <= 10:

print("Number: ", number)

number = number + 1

Number: 10

Number: number

Number: 0

Number: 11

6.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What does the following code print?


output = ""

x = -5

while x < 0:

x = x + 1

output = output + str(x) + " "

print(output)

5 4 3 2 1

-4 -3 -2 -1 0

-5 -4 -3 -2 -1

This is an infinite loop, so nothing will be printed

7.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What are the values of var1 and var2 that are printed when the following code executes?

var1 = -2, var2 = 0

var1 = 0, var2 = -2

var1 = 0, var2 = -1

This is an infinite loop, so nothing will be printed

Create a free account and access millions of resources

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

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?