KP4-Loops

KP4-Loops

2nd Grade

12 Qs

quiz-placeholder

Similar activities

Quant saps de Leroy Anderson?

Quant saps de Leroy Anderson?

1st - 6th Grade

10 Qs

Quiz sobre o funcionário do Mês

Quiz sobre o funcionário do Mês

1st - 5th Grade

7 Qs

glascor's quiz

glascor's quiz

KG - Professional Development

11 Qs

C. Y LENGUAJE 3 UNIDAD

C. Y LENGUAJE 3 UNIDAD

1st - 5th Grade

10 Qs

Logic Pro X 101-a

Logic Pro X 101-a

2nd Grade

10 Qs

Check Music WC 22nd June Year 7

Check Music WC 22nd June Year 7

KG - 4th Grade

10 Qs

Se divertindo com a Teoria Musical

Se divertindo com a Teoria Musical

1st - 4th Grade

10 Qs

Frida Kahlo - A artista que pintava com alma

Frida Kahlo - A artista que pintava com alma

2nd Grade

8 Qs

KP4-Loops

KP4-Loops

Assessment

Quiz

Arts

2nd Grade

Hard

Created by

MrsT Voci

Used 5+ times

FREE Resource

12 questions

Show all answers

1.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

What would be the lowest value printed by this code?

for i in range(12):

print(i)

12

0

None of these

1

2.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

What is the value of the variable 'a' after it passes through the loops?

a = 0

for i in range(2):

for j in range(4):

a += i * j

10

4

6

8

3.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

What is the value of the variable 'a' after it passes through the loops?

a = 0

for i in range(2):

for j in range(3):

a += i + j

8

9

10

3

4.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

***Add the line of code needed to accumulate the total of all values of a and then print the result.

total=0

for a in range(6):

#what goes here?

print(total)

total = total +a

total = a +1

total += a

total =+a

5.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

****You are given a function which contains a non working while loop. The function also accepts a positive integer (x). The while loop is in an infinite loop state, which would be unwise to run. The while loop continually decreases the value variable by 1. Your task is to fix the code so that the loop exits and returns the value variable when it is equal to x.

def while_loop_finisher:

value = -1

while value:

value -=1

if value == x:

return x

break

if value == 1:

return value

break

if value = x:

return x

break

if x == value:

return x

break

6.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

What is the purpose of the break statement in Python?

Skip the remainder of the if body and transfer control to the if condition

Terminate the loop and transfer control to the statement following the loop

Skip the remainder of the loop body and transfer control to the loop condition

Terminate the if statement and transfer control to the statement following the if

7.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

What does the “continue” Statement in Python do?

it terminates the execution of statements while iterating the loop

it breaks the loop

None of these

it does not break the loop

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?