wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Strings & Lists

Total questions: 20

Worksheet time: 18mins

Name
Class
Date
1.

Which of the operator can be used in Strings?

a)

+

b)

*

c)

Both of the above

d)

None of the above

2.

When we create a program to extract each alphabet from a given string, what is it known as?

a)

Transpose

b)

Traverse

c)

Translate

d)

Terminate

3.

Which of the following is not a comparison operator?

a)

<

b)

>

c)

==

d)

!==

4.

word = "amazing"

For the given string if we run word[2:5] what does it mean?

a)

It will extract alphabets from index 2 to index 4

b)

It will extract alphabets from index 2 to index 5

c)

It will extract alphabets from position 2 to position 4

d)

It will extract alphabets from position 2 to position 5

5.

word = "amazing"

For the given string if we run word[2:5:2] what does 2 mean in this function?

a)

It will pick only second alphabet

b)

It will pick only two alphabets

c)

It will pick every alternate alphabet

d)

It will pick first two alphabets

6.

Which method is used to convert a given string in Capital letters?

a)

Capital

b)

Upper

c)

ConverttoUpper

d)

Capitalize

7.

Which of the following is not a valid string function?

a)

isalphanumeric

b)

isspace

c)

islower

d)

isalnum

8.

string="HELlo"

What will be the result of string.isupper()?

(a)  

9.

s1="Hello"

n1=10

print(s1+n1)

What is the error in this code?

a)

Print statement not written in quotes

b)

Numeric value not written in quotes

c)

colon not written after the print statement

d)

string cannot be added to a number

10.

s1="Hello"

s2="10"

print(s1+n1)

What is the error in this code?

a)

String 2 written in quotes

b)

String cannot be multiplied with a string

c)

colon not written after print statement

d)

Number written in quotes

11.

Which brackets are used for Lists?

a)

( )

b)

[ ]

c)

{ }

d)

None of the above

12.

Which of the following does not work in Lists?

a)

lstrip & rstrip

b)

+ & * symbol

c)

Membership operators

d)

Slicing

13.

Lists are?

a)

Mutable

b)

immutable

14.

[1, 2, 8, 9] < [9, 1]


What will be the result if we compare these two lists?

a)

True

b)

False

15.

[1, 2, 8, 9] < [1, 2, 8, 4]


What will be the result if we compare these two lists?

a)

True

b)

False

16.

Which of the following operator is valid in Lists?

a)

/

b)

**

c)

+

d)

-

17.

Which method is used to delete a value from the list and display it also?

a)

del()

b)

pop()

c)

popshow()

d)

remove()

18.

Which method is used to merge two lists?

a)

append

b)

merge

c)

join

d)

extend

19.

How many elements can be inserted using append() method?

a)

1

b)

2

c)

3

d)

Any number of elements

20.

Which method is used to add a value at a specified position in the list?

a)

append

b)

extend

c)

insert

d)

pop