Sail E0 Webinar

MCQs

Total Questions : 54 | Page 4 of 6 pages
Question 31. Which of the following blocks will be executed whether an exception is thrown or not?
  1.    finally
  2.    Else
  3.    except
  4.    Assert
 Discuss Question
Answer: Option A. -> finally
Question 32. An exception is ____________
  1.    a module
  2.    a standard module
  3.    a special function
  4.    an object
 Discuss Question
Answer: Option D. -> an object
Question 33. Which of the following statements is true?
  1.    If any exception is thrown in try block, else block is executed
  2.    All raised standard exceptions must be handled in Python
  3.    The standard exceptions are automatically imported into Python programs
  4.    When there is a deviation from the rules of a programming language, a semantic error is thrown
 Discuss Question
Answer: Option C. -> The standard exceptions are automatically imported into Python programs
Question 34. Which module in Python supports regular expressions?
  1.    none of the mentioned
  2.    regex
  3.    pyregex
  4.    re
 Discuss Question
Answer: Option D. -> re
Question 35. Which of the following creates a pattern object?
  1.    re.regex(str)
  2.    re.create(str)
  3.    re.compile(str)
  4.    re.assemble(str)
 Discuss Question
Answer: Option C. -> re.compile(str)
Question 36. What does the function re.match do?
  1.    such a function does not exist
  2.    matches a pattern at the start of the string
  3.    none of the mentioned
  4.    matches a pattern at any position in the string
 Discuss Question
Answer: Option B. -> matches a pattern at the start of the string
Question 37. What does the function re.search do?
  1.    matches a pattern at the start of the string
  2.    matches a pattern at any position in the string
  3.    such a function does not exist
  4.    none of the mentioned
 Discuss Question
Answer: Option B. -> matches a pattern at any position in the string
Question 38. The expression a{5} will match _____________ characters with the previous regular expression.
  1.    5 or more
  2.    exactly 4
  3.    5 or less
  4.    exactly 5
 Discuss Question
Answer: Option D. -> exactly 5
Question 39. The character Dot (that is, ‘.’) in the default mode, matches any character other than _____________
  1.    percentage symbol (%)
  2.    newline
  3.    ampersand (&)
  4.    caret (^)
 Discuss Question
Answer: Option B. -> newline
Question 40. Which of the following functions results in case insensitive matching?
  1.    re.U
  2.    re.X
  3.    re.A
  4.    re.I
 Discuss Question
Answer: Option D. -> re.I

Latest Videos

Latest Test Papers