Sail E0 Webinar

MCQs

Total Questions : 54 | Page 3 of 6 pages
Question 21. Suppose list1 is [3, 4, 5, 20, 5], what is list1.index(5) return in Python?
  1.    2
  2.    1
  3.    4
  4.    0
 Discuss Question
Answer: Option A. -> 2
Question 22. Which are the advantages of functions in python?
  1.    Improving clarity of the code
  2.    Reducing duplication of code
  3.    All of the mentioned
  4.    Decomposing complex problems into simpler pieces
 Discuss Question
Answer: Option C. -> All of the mentioned
Question 23. Which of these about a dictionary is false?
  1.    The values of a dictionary can be accessed using keys
  2.    Dictionaries aren’t ordered
  3.    The keys of a dictionary can be accessed using values
  4.    Dictionaries are mutable
 Discuss Question
Answer: Option C. -> The keys of a dictionary can be accessed using values
Question 24. What type of data is: a=[(1,1),(2,4),(3,9)]?
  1.    List of tuples
  2.    Tuples of lists
  3.    Invalid type
  4.    Array of tuples
 Discuss Question
Answer: Option A. -> List of tuples
Question 25. Which Python keyword is used for function?
  1.    Define
  2.    Def
  3.    Fun
  4.    Function
 Discuss Question
Answer: Option B. -> Def
Question 26. Which of the following is not a standard exception in Python?
  1.    ValueError
  2.    NameError
  3.    AssignmentError
  4.    IOError
 Discuss Question
Answer: Option C. -> AssignmentError
Question 27. How many except statements can a try-except block have?
  1.    more than one
  2.    one
  3.    more than zero
  4.    zero
 Discuss Question
Answer: Option C. -> more than zero
Question 28. When is the finally block executed?
  1.    only if some condition that has been specified is satisfied
  2.    when there is no exception
  3.    when there is an exception
  4.    always
 Discuss Question
Answer: Option D. -> always
Question 29. When will the else part of try-except-else be executed?
  1.    when no exception occurs
  2.    when an exception occurs
  3.    Always
  4.    when an exception occurs in to except block
 Discuss Question
Answer: Option A. -> when no exception occurs
Question 30. Which of the following is the use of id() function in python?
  1.    All of the mentioned
  2.    None of the mentioned
  3.    Every object doesn’t have a unique id
  4.    id returns the identity of the object
 Discuss Question
Answer: Option D. -> id returns the identity of the object

Latest Videos

Latest Test Papers