My Report

Python Modules Test – 4


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement

1. What will be the output of the following Python code?

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)

2. The command which helps us to reset the pen (turtle):

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

4. 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)

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

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

6. 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)

7. What will be the output of the following Python functions?

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

8. What will be the output of the following Python code?

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

9. What will be the output of the following Python code?

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

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

 

Start practicing “1000 MCQs on Python”, and once you are ready, you can take tests on all topics by attempting our “Python Test Series”.

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.