Modules In Python: Modules Multiple Choice Questions

Modules In Python. MCQs related to Modules In Python Programming Language. This set has 15 Multiple Choice Questions on Python Modules. For more MCQs see

 

Modules In Python

 

 

What will be the output of code ??

import turtle
t=turtle.Pen()
t.goto(300,9)
t.position()

a) 300.00, 9.00
b) 9, 300
c) 300, 9
d) 9.00, 300.00

 

To obtain a list of all the functions defined under sys module, which of the following functions can be used ??

a) print(sys)
b) print(dir.sys)
c) print(dir[sys])
d) print(dir(sys))

 

Which of the following functions does not accept any arguments ??

a) position
b) fillcolor
c) goto
d) setheading()

 

What will be the output of the following ??

import sys
sys.argv

a) ‘ ‘
b) [ ]
c) [‘ ‘]
d) Error

 

Modules In Python

 

What will be the output of the following ??

import turtle
t=turtle.Pen()
for i in range(0,4):
t.forward(100)
t.left(90)
t.penup()
t.left(90)
t.forward(200)
for i in range(0,4):
t.forward(100)
t.left(90)

a) Error
b) 1 square
c) 2 squares, at a separation of100 units, joined by a straight line
d) 2 squares, at a separation of 100 units, without a line joining them

 

What does os.link() do ??

a) create a symbolic link
b) create a hard link
c) create a soft link
d) none of the mentioned

 

What will be the output of following ??

import sys
sys.stderr.write(“hello”)

a) ‘hello’
b) ‘hello\n’
c) hello
d) hello5

 

What is the output ??

import turtle
t=turtle.Pen()
for i in range(1,4):
t.forward(60)
t.left(90)

a) Rectangle
b) Trapezium
c) Triangle
d) Square

 

Modules In Python

 

What will be the output of this code ??

import sys
sys.argv[0]

a) Junk value
b) ‘ ‘
c) No output
d) Error

 

Which of the following returns a string that represents the present working directory ??

a) os.getcwd()
b) os.cwd()
c) os.getpwd()
d) os.pwd()

 

What is the output of following ??

import sys
eval(sys.stdin.readline())
Computer

a) Error
b) ‘Computer\n’
c) Computer8
d) Computer

 

Fill in the blank such that the following Python code results in the formation of an inverted, equilateral triangle ??

import turtle
t=turtle.Pen()
for i in range(0,3):
t.forward(150)
t.right(_____)

a) -60
b) 120
c) -120
d) 60

 

Which of the following functions can be used to read data from a file using a file descriptor ??

a) os.reader()
b) os.read()
c) os.quick_read()
d) os.scan()

 

What will be the output of ??

import sys
eval(sys.stdin.readline())
“India”

a) India5
b) India
c) ‘India\n’
d) ‘India’

 

The command which helps us to reset the pen (turtle) ??

a) turtle.reset
b) turtle.penreset
c) turtle.penreset()
d) turtle.reset()

Leave a Comment

Your email address will not be published. Required fields are marked *

error: Content is protected !!