Search Header Logo

Python Midterm Exam

Authored by Carlos Cabrera

Information Technology (IT)

University

Used 1+ times

Python Midterm Exam
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

50 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the result of the following operation? python Copy 7 % 3

1

2

3

4

2.

FILL IN THE BLANK QUESTION

30 sec • 1 pt

Fill in the Blank: Complete the following code to print the type of a variable x which is set to 1.0. python Copy x = 1.0 print(_______(x))

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which operator is used to raise a number to the power of another number?

%

**

//

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Fill in the Blank: Write a Python statement that checks if 'apple' is in the list fruits.

in

not in

is

equals

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Write a Python program that prints numbers from 1 to 5 using a for loop.

for i in range(1, 6): print(i)

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

for i in range(5): print(i)

for i in range(1, 6): print(i, end=' ')

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following Python code? python Copy list = [1, 2, 3, 4, 5] print(list[3])

1

2

3

4

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you add 'Python' to the following dictionary as a new key with the value 'Easy'?

my_dict['Python'] = 'Easy'

my_dict.add('Python', 'Easy')

my_dict.insert('Python', 'Easy')

my_dict.update({'Python': 'Easy'})

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?