Search Header Logo

Python for loop

Authored by Sherif Abdelhamid

Computers

University

Used 59+ times

Python for loop
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

8 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

An infinite loop is :A loop runs infinite times when the condition-------------.

never fails

run one time

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

In programming, what is iteration/looping?

The repetition of steps within a program

The order in which instructions are carried out

A decision point in a program

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

numbers = [5, 14, 9, 17]

for number in numbers:

if number % 3 == 0:

print(number)


The output will be?

17

9

14

9

17

14

17

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

numbers = [5, 14 ,9, 17]

for number in numbers:

if number >= 9:

print (number)


The output will be?

17

9

14

9

17

14

17

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

How many times does the following program print the word ‘computer’:

word= "computer"  
for num in range(1,6):
 
    print(word)

5
6
1
0

6.

MULTIPLE CHOICE QUESTION

1 min • 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)

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Three of the for loops below will provide identical values for i. Which for loop will provide values that do not match the others?

for i in range(0, 5):

for i in range(5):

for i in range(0, 5, 1):

for i in range(5, 0, 1):

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?

Discover more resources for Computers