Zed-King Institute
    All Notes

    O Level · Chapterwise MCQ

    Chapter 8: Scope and Modules — MCQ

    Zed-King Study app · Free

    O Level students across India practise here, free

    Daily M1–M4 quizFull 100-question mocksAll-India rank
    Open the free app

    Google login · no Play Store needed

    🏆 Free All-India Sunday Mock · Sun, 29 Nov, 11 AM · CCC + O LevelRegister

    About this PDF

    Chapter 8 — questions on local and global scope, modules, packages and importing code into an application.

    This is part of the free O Level M3-R5.1 study material in the Zed-King Study Zone. You can read every page above in your browser, or download the file and study offline. Zed-King Group of Institute is a NIELIT Study Centre in Kaithal, Haryana, and all of this material follows the current NIELIT syllabus.

    Course
    O Level — NIELIT Foundation Diploma
    Module
    M3 — M3-R5.1: Programming and Problem Solving through Python
    Section
    Chapterwise MCQ
    Format
    PDF — read online or download
    Price
    Free, no sign-up required

    Text from this PDF

    The opening pages as plain text — open the reader above for tables, diagrams and the full file.

    (A) 5 characters (B) 5 words (C) 5 lines (D) None

    Chapter:8 Scopes And Modules

    Q1. Which is a set of functions you want to include in your application. · Ans. Module

    Q2. A package is a folder containing one or more python modules.One of the modules in a package must be called · Ans. _init_.py

    Q3. Which defines the accessibility and the lifetime of a variable. · Ans. Scope

    Q4. This imports * statement import all names in the modules except those beginning with · Ans. Underscore(_)

    Q5. To use a module in another module ,you must import it using an statement. · Ans. Import

    Q6.In each module should also be divided into sub modules according to software engineering and programming style. · Ans. Top down method

    Q7. What will be output of the following python code.

    >>>from math import factorial >>>print(factorial(6))

    Ans. 720

    Q8. What will be output of the following python code. From math import * Print(floor(11.7) · Ans. 11

    Q9. A variable defined outside a function referred to as · Ans. global statement

    Q10. statement is correct to import modules from the package. · Ans. from package import *

    Q11. Which of the following statement is correct about getcwd(). · (a) Method displays the directory of a process. · (b) Method displays the current working directory of a process. · (c) Method create file of a process · (d) None of these

    Q12. will return the mathematical number pi from the module. · (a) Math.pi (b) circle() · (c) pandas (d) None

    Q13.which module is to be imported for using randint() function? · (a) Random (b) randrange · (c) randomrange (d) rand

    Q14. Which of the following is not a valid namespace? · (a) Global namespace (b) local namespace · (c)public namespace (d) built-in namespace

    Q15 which of these is the definition for packages in python? · (a) A set of main modules · (b) A folder of python modules · (c) (c ) A number of files containing python definitons and statements (e) A set of programs making use of python modules

    Q16. Which of these functions can not be defined under the sys module? · (a) Sys.argv (b) sys.readline · (c) sys.path (d) sys.platform

    Q17. PyPI stans for · (a) Python package index · (b) python package installer (c ) both a and b · (d) none of the above

    Q18.which operator is used in python to import modules from packages?

    Q19.which module in the python standard library parses options received from the command line? · (a) getopt (b) getarg · (c) os (d) main

    Q20 which of these definitions correctly describing a module? · (a) Denoted by triple quotes for providing the specification of certain program elements · (b) Design and implementation of specific functionality to be incorporated into a program · (c) Defines the specification of how it is to be used. · (d) Any program that reuses code.

    Q21. Which of the following isn’t true about main modules? · (a) When a python file is directly executed, it is considered main module of a program. · (b) Main module may import any number of modules. · (c) Special name given to main modules is:_main_ · (d) Other main modules can import main modules.

    Q22. Which of the following is not an advantage of using modules? · (a) Provides a means of reuse of program code. · (b) Provides a means of dividing up tasks. · (c) Provides a means of reducing the size of the program. · (d) Provides a means of testing individual parts of the program

    Q23.which of the following functions converts date of corresponding time in python? · (a) Strftime() (b) strptime() · (c) both a and b (d) None

    Q24. A python module is a file with the file extension that contains valid python cod · (a) .pym (b) .pymodule · (c) .module (d) .py

    Q25. What will be the output of the following python code? From math import pow Print(math.pow(2,3)) · (a) Nothing is printed (c ) Error,metod pow doesn’t exist in math module (d )Error, the statement should be:print(pow(2,3))

    Q26. What will be the output of the following python code?

    def change():

    More chapterwise mcq for M3-R5.1

    Run these Python programs yourself — free

    Reading code is not the same as writing it. Type any program from these notes into our free online Python compiler (real Python 3 with NumPy, input() works), or study one of the explained programs with its output.

    Prepare for O Level with expert guidance

    Classroom training, practical labs and exam registration at Zed-King Institute, Kaithal.

    Drag me!