Python Multiple Choice Questions – Regular Expressions

This set of Python Multiple Choice Questions & Answers (MCQs) focuses on “Regular Expressions”. 1. Which module in Python supports regular expressions? a) re b) regex c) pyregex d) none of the mentioned 2. Which of the following creates a pattern object? a) re.create(str) b) re.regex(str) c) re.compile(str) d) re.assemble(str) 3. What does the function … Read more

advertisement

Python Questions and Answers – Pickle Module

This set of Python Multiple Choice Questions & Answers (MCQs) focuses on “Pickle Module”. 1. 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 … Read more

advertisement

Python Questions and Answers – Turtle Module – 3

This set of Python Multiple Choice Questions & Answers (MCQs) focuses on “Turtle Module – 3”. 1. Which of the following functions results in an error? a) turtle.shape(“turtle”) b) turtle.shape(“square”) c) turtle.shape(“triangle”) d) turtle.shape(“rectangle”) 2. What will be the output of the following Python code? import turtle t=turtle.Pen t.tilt(75) t.forward(100) a) A straight line of … Read more

advertisement

Python Questions and Answers – Turtle Module – 2

This set of Python Multiple Choice Questions & Answers (MCQs) focuses on “Turtle Module – 2”. 1. 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() a) Error b) A circle filled in with the colour red c) A circle filled in with the colour blue d) … Read more

advertisement

Python Multiple Choice Questions – Turtle Module

This set of Python Multiple Choice Questions & Answers (MCQs) focuses on “Turtle Module”. 1. 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 2. The number of lines drawn in each case, assuming that the … Read more

advertisement

Python Questions and Answers – Operating System

This set of Python Questions & Answers for Exams focuses on “Operating System”. 1. 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 2. What does print(os.geteuid()) print? a) the group id … Read more

advertisement

Python Question and Answers – Sys Module

This set of Python Multiple Choice Questions & Answers (MCQs) focuses on “Sys Module”. 1. 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) 2. Which of the following functions is not defined under the sys … Read more

advertisement

Python Questions and Answers – Random Module – 2

This set of Python Aptitude Test focuses on “Random module”. 1. What the does random.seed(3) return? a) True b) None c) 3 d) 1 2. Which of the following cannot be returned by random.randrange(4)? a) 0 b) 3 c) 2.3 d) none of the mentioned 3. Which of the following is equivalent to random.randrange(3)? a) … Read more

advertisement

Python Question and Answers – Random module – 1

This set of Python Multiple Choice Questions & Answers (MCQs) focuses on “Random module – 1”. 1. To include the use of functions which are present in the random library, we must use the option: a) import random b) random.h c) import.random d) random.random 2. The output of the following Python code is either 1 … Read more

advertisement

Python Question and Answers – Datetime Module – 2

This set of Python Multiple Choice Questions & Answers (MCQs) focuses on “Datetime Module – 2”. 1. The output of both of the print statements is the same. import datetime dt_1 = datetime.datetime.today() dt_2 = datetime.datetime.now() print(dt_1) print(dt_2) a) True b) False 2. Which of the following functions can be used to find the coordinated … Read more

advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
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.