Python Programming Module: MCQs on Python Modules

Python Programming Module. MCQs on Python Programming Module.

 

Python Programming Module

 

 

What will be the output if the code runs on Windows operating system ??

import sys
if sys.platform[:2]== ‘wi’:
print(“Hello”)

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

 

The number of lines drawn in each case assuming that the turtle module has been imported ??

Case 1:
for i in range(0,10):
turtle.forward(100)
turtle.left(90)

Case 2:
for i in range(1,10):
turtle.forward(100)
turtle.left(90)

a) 10, 9
b) 9, 10
c) 9, 9
d) 10, 10

 

What does os.fchmod(fd, mode) do ??

a) change permission bits of the file
b) change permission bits of the directory
c) change permission bits of either the file or the directory
d) none of the mentioned

 

The output of the functions len(“abc”) and sys.getsizeof(“abc”) will be the same ??

a) True
b) False

 

Python Programming Module

 

What will be the output shape of the following Python code ??

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

a) square
b) rectangle
c) triangle
d) kite

 

What does os.close(f) do ??

a) terminate the process f
b) terminate the process f if f is not responding
c) close the file descriptor f
d) return an integer telling how close the file pointer is to the end of file

 

What will be the output of ??

import turtle
t=turtle.Pen()
t.forward(100)
t.left(90)
t.clear()
t.position()

a) 0.00, 90.00
b) 0.00, 0.00
c) 100.00, 90.00
d) 100.00, 100.00

 

Which of the following functions is not defined under the sys module ??

a) sys.platform
b) sys.path
c) sys.readline
d) sys.argv

 

Python Programming Module

 

What will be the output of the following ??

import turtle
t=turtle.Pen()
t.clear()
t.isvisible()

a) Yes
b) True
c) No
d) False

 

What does os.getlogin() return ??

a) name of the current user logged in
b) name of the superuser
c) gets a form to login as a different user
d) all of the mentioned

 

What will be the output of the following code ??

import turtle
t=turtle.Pen()
t.right(90)
t.forward(100)
t.heading()

a) 0.0
b) 90.0
c) 270.0
d) 360.0

 

Which of the following functions can help us to find the version of python that we are currently working on ??

a) sys.version
b) sys.version()
c) sys.version(0)
d) sys.version(1)

 

Python Programming Module

 

What does print(os.geteuid()) print ??

a) the group id of the current process
b) the user id of the current process
c) both the group id and the user of the current process
d) none of the mentioned

 

Which of the following functions returns a value in degrees, counterclockwise from the horizontal right ??

a) heading()
b) degrees()
c) position()
d) window_height()

 

What does os.name contain ??

a) the name of the operating system dependent module imported
b) the address of the module os
c) error, it should’ve been os.name()
d) none of the mentioned

Leave a Comment

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

error: Content is protected !!