MCQs For NCERT Class 11 Computer Science Chapter 2 Python Fundamentals

MCQs Class 11

Please refer to the MCQ Questions for Class 11 Computer Science Chapter 2 Python Fundamentals with Answers. The following Python Fundamentals Class 11 Computer Science MCQ Questions have been designed based on the latest syllabus and examination pattern for Class 11. Our experts have designed MCQ Questions for Class 11 Computer Science with Answers for all chapters in your NCERT Class 11 Computer Science book.

Python Fundamentals Class 11 MCQ Questions with Answers

See below Python Fundamentals Class 11 Computer Science MCQ Questions, solve the questions and compare your answers with the solutions provided below.

Question. Which of the following is invalid statement in Python
(a) _hello_=25
(b) __he_123=25
(c) _m=25
(d) None of the mentioned

Answer

D

Question. What is the output of the following code snippet :
dict={“A”:1 ,”B” : 2 , “C”:3}
print(dict.get(“B”,6))
(a) 2
(b) 6
(c) B
(d) Error

Answer

A

Question. What is the output of the following code segment :
fruits={}
dresses={}
toys={}
fruits[1]=”mango”
fruits[2]=”papaya”
dresses[3]=”frock”
toys[‘Fruits’]=fruits
toys[‘Dresses’]=dresses
print(toys)
(a) Error
(b) {‘Fruits’: {1: ‘mango’, 2: ‘papaya’}, ‘Dresses’: {3: ‘frock’}}
(c) {‘Fruits’: {1: ‘mango’, 2: ‘papaya’}}
(d) {‘Fruits’: {1: ‘mango’}, ‘Dresses’: {3: ‘frock’}}

Answer

B

Question. Evaluate the following expression :
3+4*2%8+12//6-2%9**2**1
(a) 11
(b) 3
(c) 17
(d) 1

Answer

B

Question. Consider the following string :
str=”Welcome_to_Computer_Science”
str1=str[-15:15]
print(str1**2)
(a) omp
(b) ompomp
(c) omp2
(d) Error

Answer

D

Question. What is the output of the following code snippet :
dict={“A”:1 ,”B” : 2 , “C”:3}
dict1=dict.copy()
dict1[“B”]=”C”
print(dict)
(a) {“A”:1,”B”:”C”,”C”:3}
(b) {“A”:1 ,”B” : 2 , “C”:3}
(c) {“A”:1 ,”B” : 2 , “B” :”C” , “C”:3}
(d) Error

Answer

B

Question. Assertion : pop() is used to remove an element from list but not the tuple
Reason : List and tuples support two way indexing
(a) Both the assertion and reason is true and reason is the correct explanation for assertion
(b) Assertion is true and reason is true and reason is not the correct explanation for assertion
(c) Assertion is false but the reason is true and reason is the correct explanation for assertion
(d) Both the assertion and reason are false

Answer

B

Question. Which of the following is a valid membership operator in Python
(a) and
(b) or
(c) in
(d) like

Answer

C

Question. Which of the following is an invalid keyword in Python
(a) eval
(b) assert
(c) nonlocal
(d) import

Answer

A

Question. Which of the following is false in Python
(a) append() creates a new list rather than modifying the list on which it is operated
(b) Lists and strings in Python support two way indexing
(c) Lists , tuples and dictionaries can be nested
(d) Keys in dictionary must be immutable type

Answer

A

Question. Write the output of the following code segment :
for i in range(-1,-6,-5):
print(i*i)
(a) 1
(b) 1 36
(c) Error
(d) Infinite loop

Answer

A

Question. Which of the following is an invalid identifier in Python
(a) H_e_wel_123
(b) Assert
(c) _
(d) in

Answer

D

Question. Assertion : We can use a list as a key in a dictionary
Reason : List is a mutable type and keys of dictionary must be an immutable type
(a) Both the assertion and reason is true and reason is the correct explanation for assertion
(b) Assertion is true and reason is false and reason is the correct explanation for assertion
(c) Assertion is false but the reason is true and reason is the correct explanation for assertion
(d) Both the assertion and reason are false

Answer

C

Question. Which of the following is false about dictionary
(a) More than one key is not allowed
(b) Keys must be immutable
(c) Keys must be strings
(d) In case of duplicate keys last assignment wins

Answer

C

Question. Find the odd one out in the listed operations :
(a) /=
(b) **==
(c) >=
(d) //==

Answer

C

Question. Suppose a tuple is declared as follows :
tup =(1,2,3,4,5)
Guess the minimum value for K so that the code prints “index out of range error”
for i in range(K)
print(tup[i])
(a) 4
(b) 5
(c) 6
(d) 3

Answer

B

Question. Find the output of the following code segment :
dict={“A”:”Toy”,”B”:”Fruit”,”C”:”Dress”}
for i in dict:
print(i)
(a) “A” “B” “C”
(b) “Toy” “Fruit” “Dress”
(c) “A” “B” “C” “Toy” “Fruit” “Dress”
(d) Error

Answer

A

Question. Suppose list L is declared as L = [0.2 * i for i in range (0,5)], list L is
(a) [0,0.2,0.4,0.6,0.8,1.0]
(b) [0,1,2,3,4]
(c) [0,0.2,0.4,0.6,0.8]
(d) [0,1,2,3,4,5]

Answer

C

Question. Suppose a tuple is declared as follows:
tup=((1,2,3,(“A”,”B”,”C”),(“cat”, ”dog”)))
print(len(tup))
What is the output of the statement
(a) 1
(b) 3
(c) 9
(d) 5

Answer

D

Case Based Questions :

Amit is planning to give a birthday party for his father’s 50 birthday . For arranging the birthday party , he needs to have a list of items from the nearby grocery store , suppose he has created a following list of items to be purchased
Items=[“cake”, ”balloons” ,”pizza”, ”burger”]

Question. Now Amit has the two list :
Items=[“cake”,”balloons”,”pizza”,”burger”]
vegetable=[“tomato”, ”onion”]
Now Amit wants to delete the last element of list items
Help him to do so
(a) del Items[3]
(b) pop(3)
(c) pop()
(d) Any of he above

Answer

D

Question. Suppose If before going to the store his mother gives him another list , vegetable=[“tomato”, ”onion”]Amit writes the following code separately :
# CODE 1
list=items. extend (vegetable)
print(len(list))
# CODE 2
list1=items. append (vegetable)
print(len(list1))
What will be the outputs of the following
(a) Code 1 : 5 Code 2 : 6
(b) Code 1 : 6 Code 2: 5
(c) Code 1: 5 Code 2: 5
(d) Code1: 6 Code 2: 6

Answer

B

Question. Help Amit to add “icecream” as second element in list Items Items=[“cake”,”balloons”,”pizza”,”burger”]
(a) Items.insert (1, ”icecream”)
(b) Items.insert(2, ”icecream”)
(c) Items.insert(“icecream”)
(d) Items.insert(4,”icecream”)

Answer

A

Question. Suppose Amit wants to create a list items in alphabetical order , tell him the best suitable statement to do so
(a) Items. sort(reverse=”True”) print(Items)
(b) print(Items. sort())
(c) print(Items. sort(reverse=”True”))
(d) Items. sort() print(Items)

Answer

D

Question. Suppose If before going to the store his mother gives him another list , vegetable=[“tomato”, ”onion”] Amit writes the following code:
List=items. extend (vegetable)
Print(list)
Tell him the output of the following :
(a) [[“cake” , ”balloons”, ”pizza”, ”burger”],[“tomato”, ”onion”]]
(b) [“cake”, ”balloons”, ”pizza”, ”burger”,[“tomato”, ”onion”]]
(c) [“cake”, ”balloons”, ”pizza”, ”burger”, “tomato”, ”onion”]
(d) None of the above

Answer

C