You are on page 1of 22
y ho Beginner problem solving with Adare oom cere ce Raa CC aN Sanket Singh « Lesson 6 + Jan 20, 2021 Introduction to List With Sanket Singh J Let's crack Competitive Programming together! / Sanket Singh ‘Software Development Engineer @ Linkedin Former Software Developer @ Interviewbit/Scaler Former Product Engineer @ Coding Blocks Cracked Google Summer Of Code 2019 under Harvard University Offers From Linkedin, Sprinkr, Dunzo, Works Application(Singapore), Interviewbit, Grofers, Splash Learn No.1 Educator in Unacademy Competitive Programming Track Former Research Intern @ ISRO (Indian Space Research Organisation) Taught 7500+ programmers in Data Structures, Algorithms and Fundamentals of Computer Science Got Rank Lin Codechef Long Challenges ‘Won Infosys Digital Make-a-thon lone nsP- . Which of the following True for list in python? . Lists are immutable . Size of lists are fixed before initialization . Elements in lists are stored in contiguous memory location. . siz(lis) command is used to find length of list 1. Which of the is ai R om alan uileava MRS Muncy 7 B. Size of lists are fixed before initialization @Elements in lists are stored in contiguous memory location. \ ~ D. siz(lis) command is used to find length of list . Can we store data of different type into list? Ex- lis = ["sanket’, “people”, 1, 3, [2, 3] mas] . No 2. Can we store data of different type into list? Ex- lis = [“sanket’, “people”, 1, 3, [2, 3] LNs We can store different type of / B. No cota in same ist 3. lis = [1, 2, 3, 4], what is the value of lis[-1]? A. 4 B. 1 on D. Syntax Error ) sm IS) SI; aCe PAV a-la MUM Noni eae oa el C. 2 D. Syntax Error Sue uk Eel) Cie) eee. Te ears Ce eet Roles . What will be printed by the following code? 1 = [0]*10 print (len(1)) 0 7 10 . Syntax Error 4. What will be printed by the following code? een) Se Lae (1) I becomes [0, 0, 0, 0, 0, 0, 0, 0, 0,0] 0 Since it just return the same thing 1 PM sea oN ee omeaKe Ex-1=[1, 2]'2=[1, 2, 1, 2] be! Syntax Error 5. Which of the following list is not length of 5? ana i oie B. lis = [0]*5 C. lis = [0, 1, 2, 4, 5] nea Goes 5. Which of the following list is not length of 5? ll = []*5 . lis = [0]*5 . lis =[0, 1, 2, 4, 5] lis = [1]*5 enn ena 6. Lis =[1, 2, 3, 4], What is the output of the print(Lis)? A. 1,2, 3,4 B. [1234] C. 1234 ~ D. [1,2,3,4).~ 6. Lis =[1, 2, 3, 4], What is the output of the print(Lis)? A. 1,2,3,4 aR oma oe iekeksip ESI lis .remove (2) print (lis) Output of the following program? 0 IZ ‘ly Bh he GH 5 (Ay Ip By Uy G5 Shes ec) a [Uy & Th 4] (fils = (@, 1, 3, B, a, Ai lis.remove (2) print (lis) Output of the following program? A. [2, 1, 3, 1, 4] B. [2, 1, 2, 1, 4] eatin iu, G1 2 Al, ri Seana Toccete D. [1, 3, 1, 4] Rohe” reir) lis.insert(5, 6) print (lis) Output of the following programm? OS on) ENE NEE omer] Ro2 2) 8. lis = [2, 3, 4] lis.insert(5, 6) print (lis) Output of the following programm? To aay Pee aon ea) See a as Pest eae Mea eS OS Coma Uns Pere aun ag Canc inserted at last position. mn if coer} Cor) IS WwW Ww NEN NES © Oi ep Sy 9. Output of the following program? Iie = [fiil, Mp, Si, (4, S, Gly (nr Bp EBB print (len (lis) ) NDowrh A ey C. D. Syntax Error 9. Output of the following program? ite) ]] = print (len (lis) ) se C. [D), ow Syntax Error lis = [[1], [2, 3], [4, 5, 6], [7, 8, Actually len return number of Cee CCC a Tee cuca in lis since inner list is count as single element for outer Se 9. Output of the following program? Iie = [fiil, Mp, Si, (4, S, Gly (nr Bp EBB print (len (lis) ) NDowrh A ey C. D. Syntax Error

You might also like