On This Page

This set of Problem Solving and Python Programming Multiple Choice Questions & Answers (MCQs) focuses on Problem Solving And Python Programming Set 36

Q1 | ]
  • indexerror
  • nameerror
  • typeerror
  • valeerror
Q2 | + '3'
  • nameerror
  • indexerror
  • valueerror
  • typeerror
Q3 | 43')
  • importerror
  • valueerror
  • typeerror
  • nameerror
Q4 | )
  • valueerror
  • invalid
  • 6
  • valueerror(“invalid”)
Q5 | Which of the following statements is true?
  • the standard exceptions are automatically imported into python programs
  • all raised standard exceptions must be handled in python
  • when there is a deviation from the rules of a programming language, a semantic error is thrown
  • if any exception is thrown in try block, else block is executed
Q6 | Which of the following is not a standard exception in Python?
  • nameerror
  • ioerror
  • assignmenterror
  • valueerror
Q7 | Syntax errors are also known as parsing errors.
  • true
  • false
Q8 | An exception is                          
  • an object
  • a special function
  • a standard module
  • a module
Q9 |                                                exceptions are raised as a result of an error in opening a particular file.
  • valueerror
  • typeerror
  • importerror
  • ioerror
Q10 | Which of the following blocks will be executed whether an exception is thrown or not?
  • except
  • else
  • finally
  • assert
Q11 | Which of these definitions correctly describes a module?
  • denoted by triple quotes for providing the specification of certain program elements
  • design and implementation of specific functionality to be incorporated into a program
  • defines the specification of how it is to be used
  • any program that reuses code
Q12 | Which of the following is not an advantage of using modules?
  • provides a means of reuse of program code
  • provides a means of dividing up tasks
  • provides a means of reducing the size of the program
  • provides a means of testing individual parts of the program
Q13 | Program code making use of a given module is called a              of the module.
  • client
  • docstring
  • interface
  • modularity
Q14 |              is a string literal denoted by triple quotes for providing the specifications of certain program elements.
  • interface
  • modularity
  • client
  • docstring
Q15 | Which of the following is true about top- down design process?
  • the details of a program design are addressed before the overall design
  • only the details of the program are addressed
  • the overall design of the program is addressed before the details
  • only the design of the program is addressed
Q16 | In top-down design every module is broken into same number of submodules.
  • true
  • false
Q17 | All modular designs are because of a top- down design process.
  • true
  • false
Q18 | Which of the following is not a valid namespace?
  • global namespace
  • public namespace
  • built-in namespace
  • local namespace
Q19 | Which of the following is false about “import modulename” form of import?
  • the namespace of imported module becomes part of importing module
  • this form of import prevents name clash
  • the namespace of imported module becomes available to importing module
  • the identifiers in module are accessed as: modulename.identifier
Q20 | Which of the following is false about “from-import” form of import?
  • the syntax is: from modulename import identifier
  • this form of import prevents name clash
  • the namespace of imported module becomes part of importing module
  • the identifiers in module are accessed directly as: identifier
Q21 | Which of the statements about modules is false?
  • in the “from-import” form of import, identifiers beginning with two underscores are private and aren’t imported
  • dir() built-in function monitors the items in the namespace of the main module
  • in the “from-import” form of import, all identifiers regardless of whether they are private or public are imported
  • when a module is loaded, a compiled version of the module with file extension .pyc is automatically produced
Q22 | What is the order of namespaces in which Python looks for an identifier?
  • python first searches the global namespace, then the local namespace and finally the built- in namespace
  • python first searches the local namespace, then the global namespace and finally the built-in namespace
  • python first searches the built-in namespace, then the global namespace and finally the local namespace
  • python first searches the built-in namespace, then the local namespace and finally the global namespace