Search Header Logo

Python Variables Quiz

Authored by DirectEd Development

Other

Professional Development

Used 158+ times

Python Variables Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is a variable?

A tool to run Python programs

A container that holds information

A mathematical equation

A Python function

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is NOT a rule for naming variables in Python?

A variable name must start with a letter or underscore

Variable names are case-sensitive

A variable name can start with a number

A variable name can contain alpha-numeric characters and underscores

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the single equal sign (=) in Python do?

It compares two values

It assigns a value to a variable

It divides one value by another

It creates a new variable

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How many variables are created in the following code? cars = 100 space_in_a_car = 4.0 drivers = 30 passengers = 90 cars_not_driven = cars - drivers cars_driven = drivers carpool_capacity = cars_driven * space_in_a_car average_passengers_per_car = passengers / cars_driven

4

6

8

10

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following variable names is INVALID in Python?

my_variable

_age

1name

Name

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the following line in the code? cars_not_driven = cars - drivers

It creates a variable called cars_not_driven and assigns it the sum of cars and drivers

It creates a variable called cars_not_driven and assigns it the difference between cars and drivers

It prints the value of cars_not_driven

It declares the value of cars and drivers

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of this line of code if drivers = 30 and space_in_a_car = 4.0? carpool_capacity = drivers * space_in_a_car print(carpool_capacity)

34.0

120

12

90

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?