Problem Solving And Python Programming Set 18
On This Page
This set of Problem Solving and Python Programming Multiple Choice Questions & Answers (MCQs) focuses on Problem Solving And Python Programming Set 18
Q1 | Which of the following is not an exception handling keyword in Python?
- try
- except
- accept
- finally
Q2 | )) type(g)
- class <’loop’>
- class <‘iteration’>
- class <’range’>
- class <’generator’>
Q3 | ]
- nameerror
- valueerror
- indexerror
- typeerror
Q4 | ]
- indexerror
- nameerror
- typeerror
- valeerror
Q5 | + '3'
- nameerror
- indexerror
- valueerror
- typeerror
Q6 | 43')
- importerror
- valueerror
- typeerror
- nameerror
Q7 | )
- valueerror
- invalid
- 6
- valueerror(“invalid”)
Q8 | 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
Q9 | Which of the following is not a standard exception in Python?
- nameerror
- ioerror
- assignmenterror
- valueerror
Q10 | Syntax errors are also known as parsing errors.
- true
- false
Q11 | An exception is
- an object
- a special function
- a standard module
- a module
Q12 | exceptions are raised as a result of an error in opening a particular file.
- valueerror
- typeerror
- importerror
- ioerror
Q13 | Which of the following blocks will be executed whether an exception is thrown or not?
- except
- else
- finally
- assert
Q14 | 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
Q15 | 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
Q16 | Program code making use of a given module is called a of the module.
- client
- docstring
- interface
- modularity
Q17 | is a string literal denoted by triple quotes for providing the specifications of certain program elements.
- interface
- modularity
- client
- docstring
Q18 | 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
Q19 | In top-down design every module is broken into same number of submodules.
- true
- false
Q20 | All modular designs are because of a top- down design process.
- true
- false
Q21 | Which of the following is not a valid namespace?
- global namespace
- public namespace
- built-in namespace
- local namespace
Q22 | 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
Q23 | 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
Q24 | 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
Q25 | ))
- 120
- nothing is printed
- error, method factorial doesn’t exist in math module
- error, the statement should be: print(factorial(5))