Search Header Logo
For Loop List

For Loop List

Assessment

Presentation

•

Computers

•

8th Grade

•

Medium

Created by

Asma Al-Faran

Used 42+ times

FREE Resource

0 Slides • 21 Questions

1

Fill in the Blank

Will it print the items in a list on same line or separate line?

languages = ["Java", "Python", "C"]

for x in languages:

print(x)

2

Fill in the Blank

What is the output?

languages = ["Java", "Python", "C"]

for x in languages:

print(x)

3

Fill in the Blank

What is X?

for x in languages:

print(x)

4

Fill in the Blank

What is language?

for x in languages:

print(x)

5

Fill in the Blank

What is the output?

for x in "Python":

print(x)

6

Fill in the Blank

What is python?

for x in "Python":

print(x)

7

Fill in the Blank

for counter in range(10):

print(counter)

What will be the final line output by this program?

(Type your answer as a number)

8

Multiple Choice

Choose the correct output of the following code.

for i in range(10,15):       

print(i)

1

10

11

12

13

14

2

10

11

12

13

14

15

3

11

12

13

14

4

Error

9

Multiple Choice

What is the output of the following:-

x = "123"

for i in x:

print("a")

1

x

1

a

2

1

2

3

3

x

1

2

3

4

a

a

a

10

Multiple Choice

What is the output of the following:-

print(list(range(10)))

1

[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

2

[1,2,3,4,5,6,7,8,9,10]

3

[2,3,4,5,6,7,8,9,10,11]

4

[0,1,2,3,4,5,6,7,8,9,10]

11

Multiple Choice

Choose the correct answer

for i in "python":

print(i)

1

Error

2

p

y

t

h

o

n

3

p?y?t?h?o?n?

4

both b and c

12

Multiple Choice

Choose the correct answer

for i in "python":

print(i, end="?")

1

Error

2

p

y

t

h

o

n

3

p?y?t?h?o?n?

4

both b and c

13

Multiple Choice

What will be the output of the following Python code?

x = 'abcd'

for i in range(len(x)):

print(i)

1

1234

2

abcd

3

0123

4

error

14

Multiple Choice

code:

___ counter in range(2):

print(counter)

What word is missing from the code above. The program outputs the numbers 0 and 1.

1

and

2

for

3

while

4

if

5

nor

15

Multiple Choice

Choose the set of values of i that will be displayed on the screen.

for i in range(1,6):

print(i*2)

1

2,4,6,8,10

2

1,2,3,4,5

3

1,2,3,4,5,6,

4

2,4,6,8,10,12

16

Multiple Choice

Choose the set of values of i that will be displayed on the screen.

for i in range(2,5):

print(i)

1

2

3

4

2

1,2,3,4,5

3

1,2,3,4,5,6,

4

2,4,6,8,10,12

17

Multiple Choice

What is the result of running the following code?

nums = [3, 6, 10]

for i in nums:

print(i-1)

1

2

5

9

2

3

6

10

3

3

4

5

6

7

8

9

4

2,4,6,8,10,12

18

Multiple Choice

What is the result of running the following code? Exiting the loop with break

nums = [3, 6, 7, 10, 24, 25]

for i in nums:

print(i)

if i ==10:

break

1

2

5

9

2

3

6

7

10

3

3

4

5

6

7

8

9

4

2,4,6,8,10,12

19

Multiple Choice

What is the result of running the following code? Exiting the loop with break

nums = [3, 6, 7, 10, 24, 25]

for i in nums:

if i ==10:

print(i)

break

1

2

5

9

2

3

6

7

10

3

3

4

5

6

7

8

9

4

10

20

Multiple Choice

Choose the set of values of i that will be displayed on the screen.

for x in range(2, 5):

print(x)

else:

print("Done!")

1

2

3

4

Done!

2

3

4

5

Done!

3

2

3

4

5

Done!

4

2

3

4

last item: 4

21

Multiple Choice

Choose the set of values of i that will be displayed on the screen.

for x in range(2, 5):

print(x)

else:

print("last item: ", x)

1

2

3

4

2

3

4

5

last item

3

2

3

4

5

last item: 5

4

2

3

4

last item: 4

Will it print the items in a list on same line or separate line?

languages = ["Java", "Python", "C"]

for x in languages:

print(x)

Show answer

Auto Play

Slide 1 / 21

FILL IN THE BLANK