[go: up one dir, main page]

0% found this document useful (0 votes)
849 views4 pages

Xi CS Worksheet List Tuples

This document contains a worksheet on lists and tuples in Python with 20 multiple choice and output-based questions. Some of the questions ask students to define key terms like lists and tuples, compare operations between the two, find errors in code, and write examples of common list and tuple methods. The questions cover basic and advanced topics about using lists and tuples in Python programs.

Uploaded by

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

Xi CS Worksheet List Tuples

This document contains a worksheet on lists and tuples in Python with 20 multiple choice and output-based questions. Some of the questions ask students to define key terms like lists and tuples, compare operations between the two, find errors in code, and write examples of common list and tuple methods. The questions cover basic and advanced topics about using lists and tuples in Python programs.

Uploaded by

mirthika .R
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

VELAMMAL BODHI CAMPUS , ANUPPANADI

XI COMPUTER SCIENCE ( 083 ) – WORKSHEET #1 ON LISTS AND TUPLES

PROGRAMMING IN PYTHON - NOVEMBER 2022

1 MARK QUESTIONS :

1. Define List in Python with an example.


2. Write down the types of Python Lists.
3. What are the common List operations ?
4. What is the purpose of built-in list functions ?
5. Write down the 3 methods use for deletion operation on lists .
6. Define the term “Sorting”.
7. What is the similarity between Lists and Strings in Python ?
8. Find output :
Lst7 = “Efforts Never Fail”
print(Lst7[::-1])

9. What is the size or length of the below list :

L25 = [ 1,2,[ ‘Indian’,’Ocean’ ], ‘g’, 22.98 , 7 , 777 ]

10.What is the difference between pop( ) and remove( ) methods ?


11.What do you mean by “Tuple” ?
12.What is a singleton tuple ? Give a clear example.
13.Which sequence object is faster ? List or Tuple ? Justify your answer.

14.We can only add tuple to a _____________________.


(a) String (b) List (c) Set (d) Tuple

15.How to use membership operators with Python Tuples ? Give two examples.
16.When we do use min( ) and max( ) functions , all values in the tuple must
be of same ___________. (a) value (b) radix (c) sign (d) type
17.What is the similarity between strings and tuples.

18.Find the output :


Tpl = ( 11, 22, 33, 44, 55 , 66 )
Tpl = Tpl + ( 77,)
print(Tpl7)
19. Find the error(s) :
tup8 = ( 5, ‘six’, 7.0 )
print(max(tup8))
20.Differentiate List and Tuple data sequences in Python.

**********************************
FIND OUTPUT FOR THE BELOW QUESTIONS: ( 2 MARKS QUESTIONS )
1. L1 = [ 34,87,,’Computer’,12.75,’Product’,’Career’ ]
print(L1[2:-2])
print(L1[:])
print(L1[6])
print(L1[:3] + L1[3:])

2. >>>List7 = [ 4,3,7,6,4,9.5,0,3,2]
>>>List7[1:10:3]
>>>List7[::-1]
>>>List7[1:3] + List7[-5:-3]
>>>sum(List7)

3. Write a Python Program to find the sum of all elements in a list.


Assume the List Lst1 = [ 35, 6, 8, 11, 18 , 30, 10 ]

FIND OUTPUT FOR THE BELOW QUESTIONS: ( 2 MARKS QUESTIONS )


4. States = [ ‘Tamil Nadu’ , ‘ Kerala’ , ‘Telangana’, ‘Andhra Pradesh’ , ‘Karnataka’ ]
Places = States
Places[2] = ‘ Odissa ‘
print(Places)
print(States)
print(States[:3])
print(States[::3])

5. Lst5 = [1,3,5,7,9]
Lst6 = [2,4,6,8,,10]
print(Lst5 + Lst6}
print(Lst5 + 77)
print(Lst5 + “Python” }
print(Lst6+Lst6}

6. fruits = [ ‘ Orange ’ , ‘ Mango ‘ , ‘ Grapes ‘ , ‘ Banana ‘ , ‘ Apple ‘ ]


print( “Water Melon” not in fruits )
print( “ Mango ” not in fruits )
print( fruits[2 : 5 ])
print( fruits.append(‘Custard Apple’ ))
print(fruits)
7. What is the difference between Insertion Sort and Bubble Sort ?

8. Find errors in the below code :

(a) Ls12 = 17,14,g,56


(b) ListFlowers = ( ‘ Lily ‘ , ‘ Rose ‘ , ‘ Jasmine ‘ )
(c) L96 = [ [ 11,22,33] [‘ Da ‘ , ‘ Vinci ‘ , ‘ Code ‘ ] ]
(d) LMovies = [ Titanic , SpiderMan , Jurassic Park , WhoAmI ]

9. Write the most appropriate List method to perform the following tasks :
(a) Add elements in the list at the end of the list .
(b) Get the position of an item in the list
(c) Delete a given element from the list.
(d) To remove more than one element in the list

10. Write most appropriate List method to perform the following tasks :

(i) To return the number of items / elements in the list


(ii) To delete the second element from the list
(iii) To add a single element at the end of the list
(iv) To add an item / element in the beginning of the list

11. Find the output :


name = (‘ I ’ , ‘ n ’ , ‘d’ , ‘i ‘ , ‘a’ , ‘ n ‘ )
n = len(name)
for i in range(n) :
print(name[i])

12. Tup01 = ( ‘ Titanic Ship ‘ , [5 , 10 , 15] , ‘g’ , ( 22 , 44 , 66 ) , ‘ WARS ‘ , 1947 )


print(Tup01[2:3])
print(Tup01[3][1])
print(len(Tup01))
print(any(Tup01))
13.List down the advantages and disadvantages of tuples.

14.(a) What are the similarities between strings and tuples ?


(b) Define “ Singleton Tuple ”. Give a clear example.

15. Find the output :

PyTup7 = ( 11 , 22, 33 , 44 , 55 , 66 , 77 )
PyTup7 = PyTup7 + ( 88 , )
print(PyTup7)
print(PyTup7.index(22,1,3)
print(PyTup7.count(99))
print(min(PyTup7))
16.Find the output :

(a) Numbers = ( 24 , 1, 8 , 6 , 22 , 3 , 31 , 2 , 27 )
print(sorted (Numbers)

(b) ( 0 , -7 , - 3 ) < ( 0 , -9 , -5 )

(c) TN1 = ( 24 , 26 , 28 )
TN2 = ( 24.00 , 26.00 , 28.00 )
print(TN1 == TN2)

(d) Tpl = ( 3 , 6, 9 )
del Tpl
print(Tpl)

17. Find the errors :


(a) Tp2 = ( ‘Bio War’ , 2.0 , 1942 , ‘S’ )
print(min(Tp2)

(b) Tup1976 = ( 9 , 8 , 7 , 6 , 5 )
Tup1976[2] = 44

(c ) Tp2 = ( 24 )
Tp3 = ( 48 , 72 , 96 )
Tp1 = Tp2 + Tp3

( d ) T75 = ( 5 , 10 , 15 , 20 , 25 )
w , x , y , z = T75

18. Write the common operations on Tuples with purpose, syntax and
examples for each operation.

19. What are the different functions / methods available in Python for
deletion operation on tuples ? Give examples .

20. Explain the below built-in methods used along with Python Lists :

(a) extend ( ) (b) insert ( ) (c) reverse( ) ( d ) sort( )

****************************************

You might also like