0% found this document useful (0 votes)
11 views2 pages

Python HW 5

Uploaded by

charlottelauyee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views2 pages

Python HW 5

Uploaded by

charlottelauyee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Practice before week 9 classroom lecture

1. Which one is correct:


A. List is un-changeable B. Set is un-changeable C. Tuple is un-changeable D. Dictionary is un-changeable

2. Which one can NOT get a list:


A. B. C. D.

3. Which one can get a Dictionary:


A. B. C. D.

4. Which one can get a Tuple:


A. B. C. D.

5. Which one is correct:


A. List is un-ordered B. Set is un-ordered C. Tuple is un-ordered D. Dictionary is un-ordered

6. Use which to add an item to a list b:


A. b.add_item( ) B. [Link]( ) C. [Link]( ) D. [Link]( )

7. Use which to delete the first item of list s:


A. [Link][0] B. [Link](0) C. [Link][1] D. [Link](1)

8. Use which to delete the first item of list s:


A. del s[0] B. del s[1] C. del s(0) D. del s(1)

Based on these two lists (x and a), please answer question 9-14:

9. How to get the result by print(x):


A. [Link](x) B. [Link](x) C. [Link](a) D. [Link](a)

10. Which one can Not get the result by print(x):


A. [Link] (a) B. [Link] ( len(x) , a ) C. [Link] ( 5, a ) D. [Link] ( 6 , a )

11. How to get the result by print(x):


A. x [2] = a B. x. insert (2, a) C. x. insert (1, a) D. x [1] = a E. x [1:2] = a

12. Which one can Not get the result by print(x):


A. del x B. del x [0: ] C. [Link]() D. del x [0 :6 ]

13. How to get the result by print(x):


A. x [1 : 5] = a B. x [0 : 4] = a C. x [1 : 4] = a D. x [0 : 3] = a

14. How to get the result by print(x):


A. x [ 0 : 1]=a B. x [ 0 ]=a C. x [ 0 : 0]=a D. x [ 1 : 1]=a

Gap filling: Question 15-20

15 Gap filling: what is the result of

Result:
1
16 Gap filling: what is the result of

Result:

17 Gap filling: what is the result of

Result:

18 what is the result of the below code?

Result:

19 What is the result of the below code? Please write in the blank box:

20 What is the result of the below code? Please write in this blank box:

Student Name:
Student ID: Date:
2

You might also like