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
Assignment 1701572062
PDF
No ratings yet
Assignment 1701572062
38 pages
Lists in Python (1)
PDF
No ratings yet
Lists in Python (1)
8 pages
XII - Comp. Scioence
PDF
0% (1)
XII - Comp. Scioence
175 pages
cblecspu09
PDF
50% (2)
cblecspu09
9 pages
12 CS RevisionPapers2025
PDF
No ratings yet
12 CS RevisionPapers2025
86 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
Sql problems (1) 1
PDF
No ratings yet
Sql problems (1) 1
23 pages
E-Commerce MCQ INFOTECH 200 Questions PDF
PDF
76% (41)
E-Commerce MCQ INFOTECH 200 Questions PDF
26 pages
Board Questions and Answers Q No 5 of 7 SQL Worksheets With Answers
PDF
No ratings yet
Board Questions and Answers Q No 5 of 7 SQL Worksheets With Answers
44 pages
12 Information Practices Text Book Preeti Arora
PDF
No ratings yet
12 Information Practices Text Book Preeti Arora
45 pages
Medical Store Ip Project
PDF
No ratings yet
Medical Store Ip Project
34 pages
12 CS PreBoard SET QPMS 2024-25
PDF
No ratings yet
12 CS PreBoard SET QPMS 2024-25
14 pages
Project Report: Bachelor of Computer Application
PDF
No ratings yet
Project Report: Bachelor of Computer Application
78 pages
Previous Year
PDF
No ratings yet
Previous Year
133 pages
Chapter 8 - JOINS and SET Operations
PDF
No ratings yet
Chapter 8 - JOINS and SET Operations
44 pages
ComputerScience SQP Set1 MS
PDF
No ratings yet
ComputerScience SQP Set1 MS
11 pages
ComputerScience SQP Set3 MS
PDF
No ratings yet
ComputerScience SQP Set3 MS
12 pages
ComputerScience-SQP Set5-MS
PDF
No ratings yet
ComputerScience-SQP Set5-MS
13 pages
Informatics Practices Sample Paper 2 CBSE Class 12
PDF
No ratings yet
Informatics Practices Sample Paper 2 CBSE Class 12
16 pages
QP-2 CS
PDF
No ratings yet
QP-2 CS
7 pages
CSV Files
PDF
No ratings yet
CSV Files
14 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
Set a 2024-25_ms_pre Board Xii Ip
PDF
No ratings yet
Set a 2024-25_ms_pre Board Xii Ip
12 pages
ComputerScience SQP Set2 MS
PDF
No ratings yet
ComputerScience SQP Set2 MS
12 pages
UPSC Registration Information System by Priyanshu Panda
PDF
No ratings yet
UPSC Registration Information System by Priyanshu Panda
43 pages
12PB24CS04AK
PDF
No ratings yet
12PB24CS04AK
15 pages
Assertion and Reason Based Questions: Pip Install Matplotlib
PDF
No ratings yet
Assertion and Reason Based Questions: Pip Install Matplotlib
57 pages
CH 7 - Introduction To SQL and Its Commands For Board Exam
PDF
No ratings yet
CH 7 - Introduction To SQL and Its Commands For Board Exam
28 pages
Worksheet Dataframes Solved-23
PDF
No ratings yet
Worksheet Dataframes Solved-23
6 pages
Set of 15 Sample Papers With Solutions & Blueprint For Class 12 Computer Science, 2024-25 Exam Edition
PDF
No ratings yet
Set of 15 Sample Papers With Solutions & Blueprint For Class 12 Computer Science, 2024-25 Exam Edition
163 pages
MS 2023 Comp Ip
PDF
No ratings yet
MS 2023 Comp Ip
23 pages
Class 12 Ip Practical Programs 2024-25
PDF
100% (1)
Class 12 Ip Practical Programs 2024-25
43 pages
Web Application Notes Unit-4
PDF
100% (1)
Web Application Notes Unit-4
4 pages
CS Prctical File Class XI
PDF
100% (2)
CS Prctical File Class XI
31 pages
IP Grade 11 Practical
PDF
No ratings yet
IP Grade 11 Practical
16 pages
Societal Impacts Class 12 - Aashi Nagiya
PDF
100% (1)
Societal Impacts Class 12 - Aashi Nagiya
17 pages
Exception Handing
PDF
No ratings yet
Exception Handing
5 pages
Green Skills MCQ and Qa Class Xii
PDF
No ratings yet
Green Skills MCQ and Qa Class Xii
11 pages
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
083 - CS - With - Python - Class 12 - Sample Paper 1 - Solved
PDF
No ratings yet
083 - CS - With - Python - Class 12 - Sample Paper 1 - Solved
18 pages
Class Xii Computer Science Mock Test Paper 01 Ms
PDF
No ratings yet
Class Xii Computer Science Mock Test Paper 01 Ms
17 pages
CSV FILE BOOK SHOP - Khushi S Tiwari
PDF
No ratings yet
CSV FILE BOOK SHOP - Khushi S Tiwari
24 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
Coimbatore Sahodaya 23-24 QP Set B
PDF
No ratings yet
Coimbatore Sahodaya 23-24 QP Set B
10 pages
Project 2023-24
PDF
No ratings yet
Project 2023-24
18 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
CLASS 12 - Computer Nerworks - Problems
PDF
No ratings yet
CLASS 12 - Computer Nerworks - Problems
13 pages
CBSE Class 12 Computer Science Compartment Answer Key
PDF
No ratings yet
CBSE Class 12 Computer Science Compartment Answer Key
24 pages
Sample Paper - 1
PDF
No ratings yet
Sample Paper - 1
18 pages
BCA 301 Solutions
PDF
No ratings yet
BCA 301 Solutions
12 pages
List and Tuple Worksheet Solution
PDF
100% (1)
List and Tuple Worksheet Solution
8 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
One Columns Css File
PDF
No ratings yet
One Columns Css File
29 pages
Preeti Arora Dictionary Questions
PDF
33% (3)
Preeti Arora Dictionary Questions
6 pages
Excel Notes
PDF
No ratings yet
Excel Notes
22 pages
Notice Writing 2023 Class XII
PDF
100% (1)
Notice Writing 2023 Class XII
18 pages
Blueprint of Computer Science Class XII
PDF
No ratings yet
Blueprint of Computer Science Class XII
21 pages
Informatics Practice-Xii - Practice Paper
PDF
No ratings yet
Informatics Practice-Xii - Practice Paper
7 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
© 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
(Informatics Assistant) : Study Material
PDF
No ratings yet
(Informatics Assistant) : Study Material
18 pages
CSV - Practice Paper
PDF
No ratings yet
CSV - Practice Paper
7 pages
Question Bank Class Xi Ip To Be Uploaded
PDF
No ratings yet
Question Bank Class Xi Ip To Be Uploaded
19 pages
Employablity Skills - MCQ - Sample Question Paper With Marking Scheme
PDF
No ratings yet
Employablity Skills - MCQ - Sample Question Paper With Marking Scheme
10 pages
Joining Notes New
PDF
No ratings yet
Joining Notes New
8 pages
XIth IP Python
PDF
No ratings yet
XIth IP Python
17 pages
Practical - With Solution - XII - IP
PDF
No ratings yet
Practical - With Solution - XII - IP
13 pages
MBA IT 108 Solutions
PDF
No ratings yet
MBA IT 108 Solutions
10 pages
CH-15 More On SQL - Grouping Records and Table Joins PDF
PDF
No ratings yet
CH-15 More On SQL - Grouping Records and Table Joins PDF
6 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
Ip Exam 2
PDF
No ratings yet
Ip Exam 2
2 pages
We Can Create Dictionary With Following Four Methods
PDF
No ratings yet
We Can Create Dictionary With Following Four Methods
4 pages
Task 1 5 Marks: Speaker 1
PDF
No ratings yet
Task 1 5 Marks: Speaker 1
10 pages
Web Technology Brochure
PDF
No ratings yet
Web Technology Brochure
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
Aissce Practical Examination 2021 Solution
PDF
No ratings yet
Aissce Practical Examination 2021 Solution
5 pages
A 6 R 4
PDF
No ratings yet
A 6 R 4
2 pages
Solution Worksheet SQL
PDF
No ratings yet
Solution Worksheet SQL
14 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
Cbse Ip More On SQL Grouping Records and Table Joins
PDF
0% (1)
Cbse Ip More On SQL Grouping Records and Table Joins
2 pages
Mysql Assignment - 2: Where Quality Matters
PDF
No ratings yet
Mysql Assignment - 2: Where Quality Matters
1 page
PHP Basic String Functions
PDF
No ratings yet
PHP Basic String Functions
1 page
Payment Status: Thank You Your Payment Is Successful
PDF
No ratings yet
Payment Status: Thank You Your Payment Is Successful
1 page
View / Download Account Statement: Savings Account No.: 50100021996040, CYBERCITY
PDF
No ratings yet
View / Download Account Statement: Savings Account No.: 50100021996040, CYBERCITY
2 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
MYSQL Assignments Final PDF
PDF
No ratings yet
MYSQL Assignments Final PDF
1 page