No Result
View All Result
Sunday, September 24, 2023
  • Login
Getting Placed
  • Home
  • Jobs
  • Exam
  • Admit Card
  • Result
  • Internship
  • Home
  • Jobs
  • Exam
  • Admit Card
  • Result
  • Internship
No Result
View All Result
Getting Placed
No Result
View All Result

Python MCQ’s on Modules: SET 15

Abhishek by Abhishek
March 13, 2021
in Python
0
python

141. The output of the following Python code will result in a shape similar to the alphabet ___________

import turtle

t=turtle.Turtle()

t1=turtle.Turtle()

t.left(45)

t1.left(135)

t.forward(100)

t1.forward(100)

a) V

b) Inverted V

c) X

d) T

Check Answer

Answer: a
In the code shown above, two pens have been used to create a shape similar to the alphabet ‘V’. The angle between the two straight lines is 90 degrees.

142. The output of the following Python code is similar to the alphabet _______________

import turtle

t=turtle.Pen()

t1=turtle.Pen()

t2=turtle.Pen()

t.forward(100)

t1.forward(100)

t2.forward(100)

t1.left(90)

t1.forward(75)

t2.right(90)

t2.forward(75)

a) X

b) N

c) T

d) M

Check Answer

Answer: c
In the above code, three pens have been used to create a shape similar to the letter ‘T’. All the three straight lines are mutually perpendicular.

143. The following Python code will result in an error.

import turtle

t=turtle.Pen()

t.speed(-45)

t.circle(30)

a) True

b) False

Check Answer

Answer: b
Although a negative speed is not possible, the code shown above does not result in an error. Hence, the answer is False.

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

import turtle()

t=turtle.Pen()

t.goto(50,60)

t1=t.clone()

t1.ycor()

a) 0.0

b) 50.0

c) 60.0

d) Error

Check Answer

Answer: c
The function clone() is used to create a clone of the turtle, having the same properties such as position, coordinates etc. Hence, the properties of the t and t1 are the same in the code shown above. The function ycor() returns the y-coordinate of the turtle. Hence the output of the code is 60.0.

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

import turtle

t=turtle.Pen()

for i in range(0,6):

t.forward(100)

t.left(60)

a) Hexagon

b) Octagon

c) Pentagon

d) Heptagon

Check Answer

Answer: a
The code shown above creates a six-sided polygon. The output shape of the code shown above is will be a hexagon.

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

import turtle

t=turtle.Pen()

t.resizemode(“sanfoundry”)

t.resizemode()

a) user

b) auto

c) nonresize

d) error

Check Answer

Answer: c
When not explicitly specified as auto or user, no adaption of the turtle’s appearance takes place and the mode is ‘noresize’. Hence the output of the code is: noresize.

147. The process of pickling in Python includes:

a) conversion of a list into a datatable

b) conversion of a byte stream into Python object hierarchy

c) conversion of a Python object hierarchy into byte stream

d) conversion of a datatable into a list

Check Answer

Answer: c
Pickling is the process of sterilizing a Python object, that is, conversion of a byte stream into Python object hierarchy. The reverse of this process is known as unpickling.

148. To sterilize an object hierarchy, the _____________ function must be called. To desterilize a data stream, the ______________ function must be called.

a) dumps(), undumps()

b) loads(), unloads()

c) loads(), dumps()

d) dumps(), loads()

Check Answer

Answer: d
To sterilize an object hierarchy, the dumps() function must be called. To desterilize a data stream, the loads function must be called.

149. Pick the correct statement regarding pickle and marshal modules.

a) The pickle module supports primarily .pyc files whereas marshal module is used to sterilize Python objects

b) The pickle module keeps track of the objects that have already been sterilized whereas the marshal module does not do this

c) The pickle module cannot be used to sterilize user defined classes and their instances whereas marshal module can be used to perform this task

d) The format of sterilization of the pickle module is not guaranteed to be supported across all versions of Python. The marshal module sterilization is compatible across all the versions of Python

Check Answer

Answer: b
The correct statement from among the above options is that the python module keeps track of the objects that have already been sterilized whereas the marshal module does not do this. The rest of the statements are incorrect.

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

pickle.HIGHEST_PROTOCOL

a) 4

b) 5

c) 3

d) 6

Check Answer

Answer: a
There are five protocol versions available of the pickle module, namely, 0, 1, 2, 3 and 4. In the code shown above, the highest protocol version is returned, that is, 4.

Page  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15      16 

Previous Post

Python MCQ’s on Modules: SET 14

Next Post

Python MCQ’s on Modules: SET 5

Abhishek

Abhishek

Next Post
python

Python MCQ's on Modules: SET 5

Leave a Reply Cancel reply

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

Follow Us on Google News
No Result
View All Result

Recent Posts

  • Mustard Oil Price: सस्ता हुआ सरसों का तेल, खरीदने वालों की लगी भीड़
  • Bhojpuri Video: पवन सिंह ने रात के अंधेरे में मोनालिसा के बदन पर फेरा हाथ, मच गया बवाल
  • Gori Nagori ने उछल-उछल कर तोड़ दिया स्टेज, लगाए ताबड़तोड़ ठुमके
  • Haryanvi Dance: भरी जवानी में Gori Nagori के लगाए लटके-झटकें, देख बूढ़ों में आया जोश
  • Gori Nagori ने स्टेज पर उछल उछल कर लगाए जोरदार ठुमके, वायरल हुआ वीडियो

Recent Comments

  • Abhishek on Win 11 Download Links

Archives

  • September 2023
  • June 2023
  • May 2023
  • April 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • August 2022
  • July 2022
  • October 2021
  • July 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • April 2020
  • February 2020

Categories

  • Admit Card
  • Algorithm and Programs
  • Exam
  • Internship
  • Java
  • Jobs
  • latest
  • politics and entertainment
  • Python
  • Result
  • Trademark
  • Uncategorized

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
  • Privacy Policy
  • DMCA
  • Terms of Use
  • Sitemap

© 2020 Getting Placed

No Result
View All Result
  • Home
  • Jobs
  • Exam
  • Admit Card
  • Result
  • Internship

© 2020 Getting Placed

Welcome Back!

Login to your account below

Forgotten Password?

Create New Account!

Fill the forms below to register

All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In