Call
whatsapp
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
Cisco Training in Trivandrum, Trinity Technologies

No.1 Training Institute in Kerala

PYTHON QUESTIONS : PART 9

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

SHOW ANSWER

Which of the following is not an advantage of using modules?

Provides a means of reuse of program code

Provides a means of diving up tasks

Provides a means of reducing the size of the program

Provides a means of testing individual parts of the program

SHOW ANSWER

Program code making use of a given module is called a ----------- of the module.

Client

Docstring

Interface

Modularity

SHOW ANSWER

Which module in the python standard library parses options received from the command line?

getopt

os

getarg

main

SHOW ANSWER

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

SHOW ANSWER

What is the output of the following piece of code?

from math import factorial

print(math.factorial(5))

120

Nothing is printed

Error, method factorial doesn't exist in math module

Error, the statement should be:print(factorial(5))

SHOW ANSWER

Which of the following is not a valid namespace?

Global namespace

Public namespace

Built-in namespace

Local namespace

SHOW ANSWER

pip is a recursive acronym that can stand for --------------

Pip Installs Packages

Pip Installs Python

Python installs packages

All the above

SHOW ANSWER

Which statement is used to install package using PIP?

Pip install flask

Install pip flask

Flask pip install

None of the above

SHOW ANSWER

------------- represents an entity in the real world with its identity and behaviour.

A method

An object

A class

An operator

SHOW ANSWER

What is the output of the following code?

class test:

    def __init__(self,a='Hello World'):

        self.a=a

    def display(self):

        print(self.a)

obj=test()

obj.display()

The program has an error because constructor can't have default arguments

Nothing is displayed

"Hello World" is displayed .

The program has an error display function doesn't have parameters

SHOW ANSWER

What is setattr() used for?

To access the attribute of the object

To set an attribute

To check if an attribute exists or not

To delete an attribute

SHOW ANSWER

What is instantiation in terms of OOP terminology?

Deleting an instance of class

Modifying an instance of class

Copying an instance of class

Creating an instance of class

SHOW ANSWER
BACK | NEXT
TRINITY SOFTWARE SOLUTIONS,IInd floor, Radheyam Towers, Gandhari Amman Kovil Road, Pulimood, Trivandrum - 1
0471-2334855 | 2335855 | 9447387064 | 9847003556 info@trinitytechnology.in