Vidyalelo
Python · all questions

Module in Python
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

189

Questions

9/10

Page

Pick an option on a question to see the right answer and solution.

What will be the output of the following Python code?
#mod1
def change(a):
    b=[x*2 for x in a]
    print(b)
#mod2
def change(a):
    b=[x*x for x in a]
    print(b)
from mod1 import change
from mod2 import change
#main
s=[1,2,3]
change(s)

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

What will be the output of the following Python code?
import sys
sys.stdin.readline()
Examveda

Select an option to see the answer and solution.

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(_____)

Select an option to see the answer and solution.

What will be the output of the following Python code if the system date is 18th June, 2017 (Sunday)?
import turtle
t=turtle.Pen()
t.goto(100,0)
t.towards(0,0)

Select an option to see the answer and solution.

The function random.randint(4) can return only one of the following values. Which?

Select an option to see the answer and solution.

What will be the output of print(math.factorial(4.5))?

Select an option to see the answer and solution.

What will be the output of the following Python code if the system date is 18th August, 2016?
tday=datetime.date.today()
print(tday.month())

Select an option to see the answer and solution.

What will be the output of the following Python code?
import turtle
t=turtle.Pen()
t.color(0,0,1)
t.begin_fill()
t.circle(15)
t.end_fill()

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

Point out the error (if any) in the code shown below if the system date is 18th June, 2017?
tday=datetime.date.today()
bday=datetime.date(2017,9,18)
till_bday=bday-tday
print(till_bday)

Select an option to see the answer and solution.

What will be the output of the following Python code?
import time
time.time()

Select an option to see the answer and solution.

What will be the output of the following Python code?
import turtle
t=turtle.Pen()
t.backward(100)
t.penup()
t.right(45)
t.isdown()

Select an option to see the answer and solution.

The copy module uses the . . . . . . . . protocol for shallow and deep copy.

Select an option to see the answer and solution.

Which of the following is true about top-down design process?

Select an option to see the answer and solution.

What is the result of math.trunc(3.1)?

Select an option to see the answer and solution.

What will be the output of the following Python code?
import sys
sys.stderr.write(“hello”)

Select an option to see the answer and solution.

What will be the output of the following Python code, if the code is run on Windows operating system?
import sys
if sys.platform[:2]== 'wi':
	print("Hello")

Select an option to see the answer and solution.

The sleep function (under the time module) is used to . . . . . . . .

Select an option to see the answer and solution.

What will be the output of the following Python code?
from math import factorial
print(math.factorial(5))

Select an option to see the answer and solution.