Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
67%
(3)
67% found this document useful (3 votes)
6K views
8 pages
Preeti Arora List Questions
Preeti Arora Class XIth List Questions
Uploaded by
Ghanshyam Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save Preeti Arora List Questions For Later
67%
67% found this document useful, undefined
33%
, undefined
Embed
Share
Print
Report
67%
(3)
67% found this document useful (3 votes)
6K views
8 pages
Preeti Arora List Questions
Preeti Arora Class XIth List Questions
Uploaded by
Ghanshyam Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save Preeti Arora List Questions For Later
67%
67% found this document useful, undefined
33%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 8
Search
Fullscreen
ANSWERS TO FILL IN THE BLANKS 1. sequence 2. homogeneous 3. integer 4. square brackets 5. mutable 6. removel) 7. Sorting 8. pop()/del() 9. append() 10. comparison SOLVED QUESTIONS 1. What is a list? "ANS. Alist is a mutable sequence of values which can he of any type and they are indexed by an integer. 2. What are the differences between lists and strings? ‘Ans. The differences between lists and strings are: (a) Strings cannot be changed, but lists are mutable, they can be changed. (b) Usts use square brackets unlike strings which are enclosed in quotes, (c) Strings store single type of elements but list can store elements of different types, 3. What is the difference between extend() and append()? Ans. The append() method adds a single item to the existing lst. It doesn’t return a new list, rather it modifies the original lst. The extend) adds al the items of alist at the end of another list 4, What is the difference between pop() and remove()? Ans. pop) function removes the element from the specified index, and also return the element which was removed. no index value is provided in pop), then last element is deleted. Function remove() is used when we know the element to be deleted but not the index of the element, 5. Following are the statements for creating lists, Find the errors in the statements and rewrite the same after correcting them. {a) L= 1,6,a,8 (b) 12=(10) (c) Li={(0,1,2,3] ['my", "book" }] (2) L1=(10,1,2,3}, (4,5, 61) (e) Li=f'at, "b!, 0 (1,2,3,A}) (f) L1=[Aman, Lakshay, Aushim, Nishant] Ans, (a) L1= (1,6; 'a',8) (b) L2=(10) (c) L1=( (0,1, 2,3], ['my", "book" }} (@) L1=((0,1,2,31, (4,5, 61] (e) Li=[tat, tt, tot, (1.2/3, 'A'T] {f) Li=(‘Aman', "Lakshay', 'Aushim', 'Nishant'} 6. Suppose L=["abc", (6,7,8], 3, 'mouse'] Consider the above list and answer the following: (a) £13:] (b) LE:22] (o) L222) (@) 11) Ans. (a) b(3:] {e) L222) ((6, 7, 8)] (@ 20) 7(2) Delete a given element from the list. (c) Delete the 3° element from the list (e) Add an element in the beginning of the ls. Ans. (a) remove() {d) append() 8. Write the output of the following: {a) stri="book' print (List (str1)) (b) LH12, 4y Sy 6 2, 3, 4, Ay TDs count = L.count (4) print (count) (o) b= (20, 45, 2, 20, 30, 40) L.sort () print (L) L.reverse() print (L) (2) Lettpty wt, "rt, L.renove("r") print (L) print (L.pop()) del L(2] print (L) © (e) L1=[10,20, 30, 40) L1.clear () print(bl) ‘Ans. (a) ["b', tot, to", TR" () 3 (0) (2, 10, 20, 30, 40, 45] (45, 40, 30, 20, 10, 2) (d) (tpt, twhy tat, tty a Cpt, a) 0 9, Write the output of the following: — L1=(500, 600] 12=[35, 45] Li.append (700) Ll extend (12) Li. insert (25,2) print (L1) print (L1+L2) print(b1) print (L1.index(35)) print (L2*2) ‘Ans. (500, 600, 700, 35, 45, 2) [500, 600, 700, 35, 45, 2, 35, 45] [500, 600, 700, 35, 45, 2] 3 (35, 45, 35, 45] | (o) (4) (fl (b) (e) 7. Write the most appropriate list method to perform the following tasks Get the position of an item in ‘Add single elemé ‘Add elements in the list at the en index) insert() the list. rent at the end of the list. 1d of a list. {c) pop/dell) (A) extend()[BS 10. Write the output of the following: L=() for i in range (6,10): L-append (i) for i in range(10,4,-2): Ll -append (i) for i in range (1en(L1)) L2. append (L(i]+L1 (41) 12. append (len (L) ~Len(L1)) print (12) Ans. (16, 15, 14, 1) 11, Write the output of the following: (a) L=(1,2,3,4,5,6,7,8, 9,10] S=( i for i in L if i82==0) print(s) (b) A= (1,23, 4] B=[value*3 for value in Al print (B) Ans. (a) (2,4, 68/10] (b) 13,6,9,12) 12. Write the output of the following Python program code: STRI= List ("SNo4") for i in range(Len(STR1)) if iss3 xeint (i) xtex-3 STR [i]=x elif (STRI(i).islower()): STRI (i) = STR1{4] -upper() else: STR [1] =STRI [i] *2 print (STRI) Ans. ('SS', 3, '0", 4") 13, Write the output of the following Python program code: Le "neat" xen Lis) count=1 for i in Li if iin ['a','e',"it,'0', 'u']: XeXHi .swapcase () else: if (count #2) !=0) : (+str ( (Len (L{:count})}) count=count +1 print (X) Ans. 1EAt re14. WAP to accept integer array and search a particular value in the array. itexists, then the function should display “exists”, otherwise should display “Does not exist” Ans. L~ (10,20, 3,100, 65,87, 2] Neint (input ("Enter the nu er to be searched:")) for 4 in range (len (ty): Af type (Li}) and Ufi loot: print ("Exists at position: ", i) break else: print ("Does not exist") Output: >>>Enter the number to be searched :75 Does not exist >>Enter the number to be searched :100 Exists at position :4 1S. WAP that takes a list ‘Las an argument, adds 5 in all the odd values and 10 in all the even values of the list L. Also display the list. Ans. L= (10,20, 3,100, 65,87, 2) for i in range(len(t)) : Af type (L[i})==int: LE LLL] 82= LUAl=LUil +10 else: LUD*LUi}+5 print (L) Output: [20, 30, 8, 110, 70, 92, 12) 16. WAP to display unique and duplicate items of a given list. Ans. L1=[2,7,1,4,9,5,1,4,3] L2=1) L3=[] for i in Li: if i not in 12: L2.append(i) els L3.append (i) print(L2) print (L3) Output: (2, 7, 1, 4, 9, Sy 3) a 1, 41 17, WAP to exchange first half elements of Ist with second half elements of list assuming list is having even number of elements, Ans. L=(10, 20, 30,40, 50, 60, 70) xmint (Len (L)/2) for 4 in range (x) : LS), Lixtd) ob (xt), L(4) “ print (L) Output: [40, 50, 60, 10, 20, 30, 70) sarees uns ure18. WAP to enter a string and count number of words in the given string Suppose string is: Jam fine Output should be Number of words =3 Ans. str1=input ("Enter a sentence Lestrl.split() count=0 for i in range (len (L)) count+=1 Print (‘Number of words=", count) Output: Enter a sentence: I am fine Number of words =3 19. WAP to display frequencies of all the elements of a list Ans. L=(3,21, 5,6, 3,8, 21,6] if i not in 12 count (i) append (x) 12. append (i) print ("Element', '\t\t', 'Frequency') for i in range(len(L1)): print (L2(i],"\t\e\e", LI) Output: Element Frequency 3 2 a 2 5 1 6 2 1 20. WAP to display square of an element if it isan integer and change the case if element is a string. List is received as argument which contains both numbers and strings. Ans, L=(10, "FUN", 40, "FEW", 50, "FULL"] for i in range (len(L)): if type (b(i]) LUi}= bli) #2 elif type (L[i]==str) : L[i] = (L[4]) -swapcase () print (L) Output: [100, "fun", 1600, ‘few’, 2500, *full")21. WAP in Python, where list Lis p [°RINKU", "AUSHIM", "VUAYA": ‘Ans. L= ("RINKU", "AUSHIM" count =0 for i in: assed as an argument. Display those strings which are string with "AKHTA\ 7 /VIOAYA", "AKHTAR", "LEENA", “TARUN" 4410] in (raat): count+=1 print (ip Print ("Appearing™, count, "times") Output: AUSHIM “AKHTAR AMAR Appearing 3 times 22. WAP to find and display the sum of all the values which are ending with 3 from alist ist ‘U's received 9s argument and displays the sum. Ensure that function is able to handle various situations, viz. list containing numbers and strings. eg. list is: [33,13,92,99, Output will be 49 Ans. L=(33, 13, 92,99, 3,12] sum=0 x=len(L) for i in range(0,x): if type(Llil) if L[i}$10==3: sum ##L [i] : print (sum) 12) at: 23. A list Num contains the following elements: 3,21, 5,6, 14,8, 14,3 WAP to swap the content with next value divisible by 7 so that the resultant array will look like: 3,5, 21, 6,8, 14,3, 14 Ans. num=(3, 21, 5, 6, 14, 8, 14, 3) =1en (num) iso while ich: if num[i]$7==0: ‘, num{i}, num(i+l]= num{itl], num{i) isit2 PT TEE EEE EEE LER Eee Eeeeeeee SUC La ed else: init print (num) Output: : (3, 5, 21, 6, 8, 14, 3, 14] 24. WAP to shift the negative numbers to left and the positive numbers to right so that the resultant list will look like. Original list [-12, 11, -13,-5, 6,~7, 5, -3,-6] Output should be [11, 6, 5, -6,-3, -7, -5, -13, -12] LOLs aie ie ee et all al ll cl altiAns. 1=[-12, 11, -13, -5, 6, -7, 5, - n=len (1) print (Original List:",1) for i in range(n-1) for j in range (n-i-1) : if 13] <0: UG AGL GHG) print ("After shifting list is:",1) Output: Original list: [-12, 11, -13, -5, 6-7, After shifting list is: (1i, 6, 5, ~6, ~ -13, -12) UNSOLVED QUESTIONS === 1, What are the various ways to create a list? 2, What are the similarities between strings and lists? 3. Why are lists called mutable data type? 4, What is the difference between insert() and append{) methods of a list? 5. Suppose L=(10, ("fen", "facts", "fun"], 3, 'Good") Consider the above list and answer the following: L131 (i) LEe22] (ii) Lez (w) Ba) 6, Find the output of the following L1=(1, 2, 3] 12=[4,5,6] print(Ll¢ List ("45")) print(L1.pop()) Li. remove (2) print (Ll) Ll.extend(L2) print (L2) 7. Write the output of the following: import statistics 20, 40, 50, 60, 20, 30, 40, 70) count = L.count (40) print (count) tatistics.mean(L) print (x) ? L.sort () print (L) L. reverse () print (L) 7 8 Write the output of the following Python program code: str2= list ("Cam@123*") for 1 in range (len (Str2)-1) : if lens: Str2[ij= str2(i]*2 elif (Str2 [i] -isupper ()): str2 [i] = Str2 [i]*2 elif (Str2 [i] isdigit ()): str2 [i] = print (Str2)8 g 2 3 Fy = 8 3 E oS r 5, Write 2 program that takes an array Sas an argument and add all the odd values and splay the sum. 20. Write a program to calculate mean of a given list of numbers. 41, Write a program to calculate the minimum element of a given lst of numbers. 12 Write a code to caleulate and dsplay total marks and percentage ofa student from the given list storing marks of a student. 15, Wilte a program to multiply an element by 2 fits odd index fora glven list containing both numbers and strings. 14. Write a program to count the frequency of an element in a glven lis. 45. Write a program to shif: elements of alist so that the frst element moves to the secund Index and the Second index moves to the third index, etc,, and the last element shifts to the first position. Suppose list is [10,20,30,40] After shifting it should look lke: [20,30,40,10] 16. An array Num contains the following elements: 3, 25, 13, 6, 35, 8, 14, 45 Write a function to swap the content with next value divisible by 5 so that the resultant array will look like: 25, 3, 13, 35, 6, 8, 45, 14
You might also like
E-Commerce MCQ INFOTECH 200 Questions PDF
PDF
76% (41)
E-Commerce MCQ INFOTECH 200 Questions PDF
26 pages
Class 12 Complete Book of Informatics Practices
PDF
No ratings yet
Class 12 Complete Book of Informatics Practices
220 pages
WWW Knowledgeboat Com Learn Sumita Arora Python Computer Science Class 11 Cbse Solutions BjLLA Data Representation
PDF
0% (2)
WWW Knowledgeboat Com Learn Sumita Arora Python Computer Science Class 11 Cbse Solutions BjLLA Data Representation
68 pages
XII Informatics Practices
PDF
No ratings yet
XII Informatics Practices
147 pages
CS XII Sample Paper, Project & Practical
PDF
50% (4)
CS XII Sample Paper, Project & Practical
105 pages
Set of 15 Sample Papers With Solutions & Blueprint For Class 12 IP, 2024-25 Exam Edition
PDF
No ratings yet
Set of 15 Sample Papers With Solutions & Blueprint For Class 12 IP, 2024-25 Exam Edition
142 pages
12 CS RevisionPapers2025
PDF
No ratings yet
12 CS RevisionPapers2025
86 pages
Class 12 Informatics Practices Sample Paper Set 1
PDF
100% (1)
Class 12 Informatics Practices Sample Paper Set 1
12 pages
12 Cs Preboard CHN Qpms 2024-25
PDF
No ratings yet
12 Cs Preboard CHN Qpms 2024-25
12 pages
Societal Impacts Class 12 - Aashi Nagiya
PDF
100% (1)
Societal Impacts Class 12 - Aashi Nagiya
17 pages
Solution Worksheet SQL
PDF
100% (1)
Solution Worksheet SQL
14 pages
CS Class 12 Chapter - 3 Type C Questions Solutions
PDF
No ratings yet
CS Class 12 Chapter - 3 Type C Questions Solutions
7 pages
Ip Sample Paper 7
PDF
50% (2)
Ip Sample Paper 7
8 pages
KVS PreBoard Papers 2024-25 - 241224 - 210547
PDF
No ratings yet
KVS PreBoard Papers 2024-25 - 241224 - 210547
206 pages
IP Practical 2023-24 (1 To 34)
PDF
100% (1)
IP Practical 2023-24 (1 To 34)
32 pages
Practical - With Solution - XII - IP
PDF
No ratings yet
Practical - With Solution - XII - IP
13 pages
Preeti Arora Dictionary Questions
PDF
33% (3)
Preeti Arora Dictionary Questions
6 pages
Tally Assignment 12
PDF
No ratings yet
Tally Assignment 12
90 pages
CBSE Class 12 English Answer Key 2024 Set 3 1 5 3
PDF
No ratings yet
CBSE Class 12 English Answer Key 2024 Set 3 1 5 3
23 pages
Function Practice Questions
PDF
No ratings yet
Function Practice Questions
16 pages
IP CSV Project For Class 12
PDF
No ratings yet
IP CSV Project For Class 12
22 pages
Class 8 Comp Conclusion
PDF
No ratings yet
Class 8 Comp Conclusion
1 page
12 IPRevision Papers 2025
PDF
No ratings yet
12 IPRevision Papers 2025
93 pages
Binary File Exam Based Questionyyuiis
PDF
No ratings yet
Binary File Exam Based Questionyyuiis
7 pages
CSV - Practice Paper
PDF
No ratings yet
CSV - Practice Paper
7 pages
Previous Year
PDF
No ratings yet
Previous Year
133 pages
UPSC Registration Information System by Priyanshu Panda
PDF
No ratings yet
UPSC Registration Information System by Priyanshu Panda
43 pages
List and Tuple Worksheet Solution
PDF
100% (1)
List and Tuple Worksheet Solution
8 pages
Informatics Practices Project Synopsis Title: Imdb Movie Analysis System
PDF
No ratings yet
Informatics Practices Project Synopsis Title: Imdb Movie Analysis System
24 pages
Question Bank Class Xi Ip To Be Uploaded
PDF
No ratings yet
Question Bank Class Xi Ip To Be Uploaded
19 pages
Sample Question Paper Informatics Practices (Code: 065)
PDF
100% (1)
Sample Question Paper Informatics Practices (Code: 065)
6 pages
XIth IP Python
PDF
No ratings yet
XIth IP Python
17 pages
ComputerScience SQP Set2 MS
PDF
No ratings yet
ComputerScience SQP Set2 MS
12 pages
12th Updated
PDF
100% (1)
12th Updated
10 pages
English Core (301) Als (Term Ii) - Project: Image
PDF
No ratings yet
English Core (301) Als (Term Ii) - Project: Image
12 pages
Excel Notes
PDF
No ratings yet
Excel Notes
22 pages
Python Half Source Code
PDF
No ratings yet
Python Half Source Code
2 pages
Kerala Sahodaya CME Acc (055) QP & MS Set 1 (23-24)
PDF
No ratings yet
Kerala Sahodaya CME Acc (055) QP & MS Set 1 (23-24)
30 pages
Cbleenpl 11
PDF
No ratings yet
Cbleenpl 11
12 pages
Stacks HW
PDF
100% (1)
Stacks HW
3 pages
MYSQL Assignments Final PDF
PDF
No ratings yet
MYSQL Assignments Final PDF
1 page
Kendriya Vidyalaya Sangathan Jaipur Region: Sample Question Paper (Term-I)
PDF
No ratings yet
Kendriya Vidyalaya Sangathan Jaipur Region: Sample Question Paper (Term-I)
7 pages
12 ArihantS23
PDF
No ratings yet
12 ArihantS23
196 pages
CBSE Class 12 Informatics Practice Answer Key 2023 Set 4 90
PDF
No ratings yet
CBSE Class 12 Informatics Practice Answer Key 2023 Set 4 90
20 pages
CSSC - XII Artificial Intelligence (843) - MARKING SCHEME
PDF
No ratings yet
CSSC - XII Artificial Intelligence (843) - MARKING SCHEME
8 pages
Set A 2024-25 - Ms - Pre Board Xii Ip
PDF
No ratings yet
Set A 2024-25 - Ms - Pre Board Xii Ip
12 pages
A Project Report ON Stock Market Analysis For Aissce 2021-22 Examination
PDF
No ratings yet
A Project Report ON Stock Market Analysis For Aissce 2021-22 Examination
15 pages
Assignment 1701572062
PDF
No ratings yet
Assignment 1701572062
38 pages
Social Networking Sites Among Modern Youth: - by Naveen
PDF
No ratings yet
Social Networking Sites Among Modern Youth: - by Naveen
11 pages
Class Xi Guess Paper Informatics Practices: General Instructions: MM: 70
PDF
No ratings yet
Class Xi Guess Paper Informatics Practices: General Instructions: MM: 70
8 pages
Cs Practical Manas New
PDF
No ratings yet
Cs Practical Manas New
58 pages
Chapter List
PDF
No ratings yet
Chapter List
8 pages
Avi Arora Computer Science Practical File
PDF
No ratings yet
Avi Arora Computer Science Practical File
40 pages
Project Report: Bachelor of Computer Application
PDF
No ratings yet
Project Report: Bachelor of Computer Application
78 pages
CS
PDF
No ratings yet
CS
15 pages
Lists in Python
PDF
No ratings yet
Lists in Python
8 pages
MS 2023 Comp Ip
PDF
No ratings yet
MS 2023 Comp Ip
23 pages
List WS
PDF
No ratings yet
List WS
2 pages
Payment Status: Thank You Your Payment Is Successful
PDF
No ratings yet
Payment Status: Thank You Your Payment Is Successful
1 page
Cl. Xii English Project File (Dec.)
PDF
No ratings yet
Cl. Xii English Project File (Dec.)
10 pages
SQL Problems (1) 1
PDF
No ratings yet
SQL Problems (1) 1
23 pages
Informatics Practices Sample Paper 2 CBSE Class 12
PDF
No ratings yet
Informatics Practices Sample Paper 2 CBSE Class 12
16 pages
Aissce Practical Examination 2021 Solution
PDF
No ratings yet
Aissce Practical Examination 2021 Solution
5 pages
EX - No.15-20 and SQL Exercises
PDF
No ratings yet
EX - No.15-20 and SQL Exercises
17 pages
Java String Functions': Visit at "JH X.KS'KK Ue%"
PDF
No ratings yet
Java String Functions': Visit at "JH X.KS'KK Ue%"
5 pages
Python Primer: Patrice Koehl Modified by Xin Liu in Apr., 2011
PDF
No ratings yet
Python Primer: Patrice Koehl Modified by Xin Liu in Apr., 2011
33 pages
Library Management System
PDF
No ratings yet
Library Management System
13 pages
One Columns Css File
PDF
No ratings yet
One Columns Css File
29 pages
Informatics Practice-Xii - Practice Paper
PDF
No ratings yet
Informatics Practice-Xii - Practice Paper
7 pages
© Educational Technology Department, Group Head Office, The City School. 1
PDF
No ratings yet
© Educational Technology Department, Group Head Office, The City School. 1
13 pages
Joining Notes New
PDF
No ratings yet
Joining Notes New
8 pages
Application Development: 14 Years Experience in Websites & Applications Development
PDF
No ratings yet
Application Development: 14 Years Experience in Websites & Applications Development
12 pages
802 Information Technology Sqp2019-2020
PDF
No ratings yet
802 Information Technology Sqp2019-2020
5 pages
Xith Ip Mysql Part
PDF
No ratings yet
Xith Ip Mysql Part
13 pages
Xith Ip Mysql Part
PDF
No ratings yet
Xith Ip Mysql Part
13 pages
BCA 301 Solutions
PDF
No ratings yet
BCA 301 Solutions
12 pages
MBA IT 108 Solutions
PDF
No ratings yet
MBA IT 108 Solutions
10 pages
Web Technology Brochure
PDF
No ratings yet
Web Technology Brochure
11 pages
JN Yadav Quiz Master PROJECT
PDF
No ratings yet
JN Yadav Quiz Master PROJECT
5 pages
We Can Create Dictionary With Following Four Methods
PDF
No ratings yet
We Can Create Dictionary With Following Four Methods
4 pages
G 083 19 LIC Sales Brochure Jeevan Amar Hindi Proof 12
PDF
No ratings yet
G 083 19 LIC Sales Brochure Jeevan Amar Hindi Proof 12
2 pages
View / Download Account Statement: Savings Account No.: 50100021996040, CYBERCITY
PDF
No ratings yet
View / Download Account Statement: Savings Account No.: 50100021996040, CYBERCITY
2 pages
Mysql Assignment - 1: Where Quality Matters
PDF
No ratings yet
Mysql Assignment - 1: Where Quality Matters
1 page
Mysql Assignment - 15: Where Quality Matters
PDF
No ratings yet
Mysql Assignment - 15: Where Quality Matters
1 page
A 6 R 4
PDF
No ratings yet
A 6 R 4
2 pages
PHP Basic String Functions
PDF
No ratings yet
PHP Basic String Functions
1 page
Mysql Assignment - 2: Where Quality Matters
PDF
No ratings yet
Mysql Assignment - 2: Where Quality Matters
1 page
Ip Exam 2
PDF
No ratings yet
Ip Exam 2
2 pages