Lists

Class 11 · Computer Science · 16 Questions

1intermediate🔧 Apply4 marksShort Answer

What will be the output of the following statements?

2intermediate🔧 Apply2 marksShort Answer

Consider the following list myList. What will be the elements of myList after the following two operations: myList = [10,20,30,40]

3intermediate🔧 Apply2 marksShort Answer

What will be the output of the following code segment: myList = [1,2,3,4,5,6,7,8,9,10] for i in range(0,len(myList)): if i%2 == 0: print(myList[i])

4intermediate🔧 Apply3 marksShort Answer

What will be the output of the following code segment:

5beginner💡 Understand2 marksShort Answer

Differentiate between append() and extend() functions of list.

6intermediate🔍 Analyze3 marksShort Answer

Consider a list: list1 = [6,7,8,9] What is the difference between the following operations on list1:

7intermediate🔧 Apply5 marksShort Answer

The record of a student (Name, Roll No., Marks in five subjects and percentage of marks) is stored in the following list: stRecord = ['Raman','A-36',[56,98,99,72,69], 78.8] Write Python statements to retrieve the following information from the list stRecord.

1beginner🔧 Apply3 marksLong Answer

Write a program to find the number of times an element occurs in the list.

2intermediate🔧 Apply4 marksLong Answer

Write a program to read a list of n integers (positive as well as negative). Create two new lists, one having all positive numbers and the other having all negative numbers from the given list. Print all three lists.

3beginner🔧 Apply3 marksLong Answer

Write a function that returns the largest element of the list passed as parameter.

4intermediate🔧 Apply4 marksLong Answer

Write a function to return the second largest number from a list of numbers.

5intermediate🔧 Apply4 marksLong Answer

Write a program to read a list of n integers and find their median. Note: The median value of a list of values is the middle one when they are arranged in order. If there are two middle values then take their average. Hint: You can use an built-in function to sort the list

6intermediate🔧 Apply4 marksLong Answer

Write a program to read a list of elements. Modify this list so that it does not contain any duplicate elements, i.e., all elements occurring multiple times in the list should appear only once.

7intermediate🔧 Apply4 marksLong Answer

Write a program to read a list of elements. Input an element from the user that has to be inserted in the list. Also input the position at which it is to be inserted. Write a user defined function to insert the element at the desired position in the list.

8intermediate🔧 Apply5 marksLong Answer

Write a program to read elements of a list.

9intermediate🔧 Apply3 marksLong Answer

Read a list of n elements. Pass this list to a function which reverses this list in-place without creating a new list.