Search Header Logo

Python Basics Worksheet

Authored by Sandip Sadhukhan

Information Technology (IT)

University

Used 5+ times

Python Basics Worksheet
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 is a valid variable name in Python?

2nd_sem_marks

total-marks

student_name

if

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code?

x = 10

y = 3.14

print(type(x + y))

class <'int'>

<class 'float'>

<class 'complex'>

Error

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of these is NOT a mutable data type in Python?

list

dictionary

tuple

set

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the value of a after executing this code?

a = 5

b = a

a = 10

5

10

None

Error

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following creates an empty list?

list = {}

list = []

list = ()

list = set()

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output?

colors = ["red", "green", "blue"]

print(colors[1][-1])

green

n

e

IndexError

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which method adds a single element at the end of a list?

append()

extend()

insert()

add()

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?