IP Class 11 List and Dictionaries MCQ Chapter-4

  1. Which type of error following code will produce?
    L = [3,6,87,12,6]
    L.remove()

    a. Index error
    b. Value error
    c. Logical error
    d. Runtime error

Show Answer

b. Value error

  1. If no argument is passed to pop(), it removes
    a. First element of list
    b. Last element of list
    c. Produce error
    d. No element is removed

Show Answer

a. First element of list

  1. To sort a list ‘exp’ in decreasing order we can write
    a. exp.sort()
    b. exp.sort(reverse = True)
    c. exp.sort(reverse  = False)
    d. exp.sort(asc = True)

Show Answer

b. exp.sort(reverse = True)

  1. The sale of techtipnow for this week is stored in a list1 as [25,45,23,52,61,40,36]. Manager of techtipnow want to find the average sale of week. Help him to write code for so.
    a. sum(list1)/count(list1)
    b. avg(list1)
    c. sum(list1)/len(list1)
    d. total(list1)/count(list1)

Show Answer

c. sum(list1)/len(list1)

  1. predict the output for following code:
    list1 = [‘mango’,’orange’,’grapes’,’banana’,’guava’]
    print(min(list1))

    a. banana
    b. grapes
    c. guava
    d. orange

Show Answer

a. banana

  1. select the command to insert a number 12 at 4th position of list named list1.
    a. list1.insert(4,12)
    b. list1.insert(3,12)
    c. list1.insert(12,4)
    d. list1.insert(12,3)

Show Answer

b. list1.insert(3,12)

  1. what will be correct output when given code will be executed?
    a1 = [2,3]
    a2 = [3,5,7]
    a2.append(a1)
    print(a1 in a2)

    a. True
    b. False
    c. Error
    d. [2,3]

Show Answer

a. True

  1. Find the output:
    exp = [2,3,4,5,6,4,8,2,4,10]
    exp.remove(4)
    c = exp.count(4)
    print(c)

    a. error
    b. 1
    c. 2
    d. 9

Show Answer

a. error

  1. To check whether an item is present in list or not, we can use
    a. not
    b.is
    c. in
    d. or

Show Answer

c. in

  1. to get the index value of an item of list1, we can write
    a. list1.index(value)
    b. index(list1, value)
    c. index(value, list1)
    d. list1[value].index

Show Answer

a. list1.index(value)

  1. for a given list L1 as [[2,3,[4,5],6,7]], if you execute following command
    print(sum(L1))
    will produce

    a. 27
    b. No output
    c. Error
    d. 0

Show Answer

c. Error

  1. Surekha stored attendance of her class for this week in list ‘atd’ as given below:
    atd = [32,37,23,28,30,40,31]
    principal ask her to find the median of given nos. what code she write in python to get this?

    a. print(sum(atd)/len(atd))
    b. print(sum(atd)/count(atd))
    c. std.sort()
    print(atd[len(atd)//2])
    d. std.sort()
    print(atd[(len(atd)//2)+1]

Show Answer

c. std.sort()
print(atd[len(atd)//2])

  1. Jayesh created a list ‘L1’ with duplicate items. Ishaan suggested him to modify this list so it does not contains any duplicate element i.e. all elements occurring multiple times in the list should appear only once. Helm him to do so.

    a. R=[]
    for i in range(L1):
    if i not in R:
    R.append(i)

    b. R = list(set(L1))
    c. Both
    d. None

Show Answer

c. Both

  1. Predict the output of given code:
    L = [1,2,3]
    print(L + L*L)

    a. [1,2,3,1,4,9]
    b. [1,6,12]
    c. [1,2,3,1,2,3,1,2,3]
    d. Error

Show Answer

c. [1,2,3,1,2,3,1,2,3]

  1. Rajesh wrote following code to find the length of a list:

    m = [12, ‘techtipnow’,[10,11],12.08,’x’,True, 30]
    print(len(m))

    what output you can predict for this code?

    a. Error
    b. 17
    c. 8
    d. 7

Show Answer

d. 7

  1. Creating new list by extracting items from existing list is called
    a. Traversing
    b. Copying
    c. Slicing
    d. Extending

Show Answer

c. Slicing

  1. To display all items of list1 in reverse order we can write
    a. List[::-1]
    b. List1.reverse()
    c. Both
    d. None

Show Answer

c. Both

  1. To display first 3 items for given list
    K = [3,4,6,7,2,1,8,9,4,6]
    we can write

    a. K[:3]
    b. K[:-7]
    c. K[-10:3]
    d. All of the above

Show Answer

d. All of the above

  1. For given list
    L=[4,5,6,7,2,3,1,5,3,6]
    if we try to slice L[6:13], than what will be the output?

    a. [1, 5, 3, 6]
    b. [1, 5, 3, 6,0,0,0]
    c. Index Error
    d. [ ] (No Output)

Show Answer

a. [1, 5, 3, 6]

  1. Suppose list1 is [‘a’,’e’,’i’,’o’,’u’], than what will be list1[:-1]?
    a. [‘a’,’e’,’i’,’o’,’u’]
    b. [‘a’,’e’,’i’,’o’]
    c. [‘u’,’o’,’i’,’e’,’a’]
    d. [ ]

Show Answer

b. [‘a’,’e’,’i’,’o’]

  1. Select the correct statement:
    i. Slicing cannot be done on a variable
    ii. We cannot use slices to modify one or more list items with one or more other items.

    a. i true, ii false
    b. I false, ii true
    c. Both true
    d. Both false

Show Answer

a. i true, ii false

  1. Predict the output of given code
    K = [3,4,6,7,2,1,8,9,4,6]
    print(K[3:-3])

    a. [7,2,1,8]
    b. [7,2,1,8,9]
    c. [8,1,2,7]
    d. [7]

Show Answer

a. [7,2,1,8]

  1. For a given list1[3,4,6,7,2,1,8,9,4,6], what code we can write to display its alternate items from beginning?
    a. List1[:2]
    b. List1[::2]
    c. List1[0:len(List1):2]
    d. All of the above

Show Answer

b. List1[::2]
c. List1[0:len(List1):2]

  1. Rajneesh Sir has made following list:
    L1 = [74, 33, 22, 19, 41, 65]
    He asked his student to write code to delete last element of list L1. Help them to select correct code.

    a. L1.pop(len(L1)-1)
    b. L1.pop(-1)
    c. del L1[-1]
    d. All are correct

Show Answer

d. All are correct

  1. Continue to the previous question 49, Sir wanted to add a new number 66 before 19 in list L1. He asked Raheem to identify the position of 19 and insert that. What code Raheem should tell him?
    a. L1.append(L1.index(19), 66)
    b. L1.insert(L1.index(19), 66)
    c. L1.append(66, L1.index(19))
    d. L1.insert(66, L1.index(19))

Show Answer

b. L1.insert(L1.index(19), 66)

2 thoughts on “IP Class 11 List and Dictionaries MCQ Chapter-4”

Leave a Comment

Your email address will not be published. Required fields are marked *

error: Content is protected !!