Search Header Logo

Python Programming Quiz

Authored by Adham Elmuntser

Computers

1st Grade

Used 1+ times

Python Programming Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following will correctly prompt the user to enter a number and print it?

num = input("Enter a number: ") print(f"You entered: {num}")

num = input("Enter a number: ") print("You entered: " + num)

num = int(input("Enter a number: ")) print(f"You entered: {num}")

num = int(input("Enter a number: ")) print("You entered: " + num)

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following correctly uses an if-elif-else statement?

if x > 10: print("x is greater than 10") elif x < 10: print("x is less than 10") else: print("x is equal to 10")

if x > 10: print("x is greater than 10") elif x < 10: print("x is less than 10") else: print("x is 10")

if x > 10: print("greater") elif x < 10: print("less") else: print("equal")

if x > 10 print("x is greater than 10") elif x < 10 print("x is less than 10") else print("x is equal to 10")

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following for loop? for i in range(5): print(i)

1 2 3 4 5

0 1 2 3 4

0 1 2 3 4 5

1 2 3 4

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which while loop will print the numbers 0 to 4?

count = 0 while count < 5: print(count) count += 1

count = 0 while count < 5: print(count) count = count + 1

count = 0 while count < 5: print(count); count += 1

count = 0 while count < 5: print(count); count = count + 1

5.

OPEN ENDED QUESTION

3 mins • 1 pt

How can you create a list and print its contents?

Evaluate responses using AI:

OFF

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following correctly creates and prints a set?

my_set = {1, 2, 3, 4, 5}; print(my_set)

my_set = set([1, 2, 3, 4, 5]); print(my_set)

my_set = {1, 2, 3, 4, 5}; print(set(my_set))

my_set = {1, 2, 3, 4, 5}; print(str(my_set))

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you create a tuple and print its elements?

my_tuple = (1, 2, 3); print(my_tuple)

my_tuple = tuple([1, 2, 3]); print(my_tuple)

my_tuple = (1, 2, 3) for item in my_tuple: print(item)

my_tuple = (1, 2, 3); print(list(my_tuple))

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?