wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python_lecture_tuple and list

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

Python-dagi kortejlar o'zgaruvchan

a)

False

b)

True

2.

Kortej(tuple)ni yaratish kodlarini tanlang

a)

t=(1,2)

b)

t=tuple(1,2)

c)

t={1,2}

d)

t=[1,2]

e)

t=tuple([1,2])

3.

dasturning natijasi

a)

('1', '2', '3', '4', '5')

b)

(1, 2, 3, 4, 5)

c)

12345

d)

"12345"

4.

dasturning natijasi

a)

<class 'tuple'>

b)

<class 'None'>

c)

<class 'list'>

d)

<class 'int'>

5.

Natija

a)

(1, '2', 3, 4, 5)

b)

<class 'tuple'>

c)

(1, 2, 3, 4, 5)

d)

<class 'list'>

6.

list1=("Red","Green","Yellow","Orange","Black")

list1.append("Emerald blue")

print(list1)

a)

("Red","Green","Yellow","Orange","Black","Emerald blue")

b)

("Red","Green","Yellow","Orange","Black")

c)

Error

d)

None

7.

list1 = "a", "b", "c", "d";


print(type(list1))

a)

Syntax not correct

b)

("a", "b", "c", "d")

c)

<class 'tuple'>

d)

<class 'list'>

8.

Natijaga nima chiqadi?

list1=["Red","Green","Blue","Yellow"]

list1.append("Black")

print(list1)

a)

<class 'list'>

b)

['Red', 'Green', 'Blue', 'Yellow', 'Black']

c)

['Black','Red', 'Green', 'Blue', 'Yellow' ]

d)

AttributeError: 'tuple' object has no attribute 'append'

9.

Natijaga nima chiqadi?

list1=['sam', "Pam", 12,44]

print(list1[-1])

a)

12

b)

sam

c)

No such index in the list

d)

44

10.

Natijaga nima chiqadi?

tuple1=['sam', "Pam", 12,44]

print(type(tuple1))

a)

<class 'list'>

b)

<class 'tuple'>

11.

Natijaga nima chiqadi?

var1=['sam', "Pam", 12,44]

var1[3]="Ram"

print(var1)

a)

['sam', 'Pam', 12, 44]

b)

['sam', 'Pam', 12, 'Ram']

c)

It will give an error

d)

['sam', 'Pam', 'Ram',44]

12.

Ushbu dasturning natijasi ?

aList = [4, 8, 12, 16]

aList[1:4] = [20, 24, 28]

print(aList)

a)

[4, 20, 24, 28, 8, 12, 16]

b)

[4, 20, 24, 28]

13.

Ushbu dasturning natijasi ?

list1= [1, 3, 2]

print(list1 * 2)

a)

[2, 6, 4].

b)

[1, 3, 2, 1, 3]

c)

[1, 3, 2, 1, 3, 2]

d)

[1, 3, 2, 3, 2, 1]

14.

Bo`sh list yaratish :

a)

fruitList = ""

b)

fruitList = ["empty"]

c)

fruitList == []

d)

fruitList = []

15.

Natija ?

x = ['ab', 'cd']

for i in x:

i.upper()

print(x)

a)

[‘ab’, ‘cd’].

b)

[‘AB’, ‘CD’].

c)

None of the above

d)

[None, None]