Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

250 Python Multiple-Choice Questions for Practice, Quizzes of Computer Programming

This book contains a compilation of 250 thought-provoking Python quizzes that are certain to challenge and enrich your understanding of this versatile programming language. Unlike generic internet questions, each quiz on these pages reflects our commitment to offering you a unique and enlightening learning experience. You can use this to practice questions for your exams, interviews or just to recall all the important concepts. Table of Contents Introduction to Python The Print Function Variables and Keywords - 01 Variables and Keywords - 02 Data Types - 01 Data Types - 02 Operators and Expressions Decision-Making Statements Looping Statements Strings - 01 Strings - 02 Strings - 03 Lists - 01 Lists - 02 Lists - 03 Tuples Sets Dictionaries User Defined Functions Errors and Exceptions Built-in Functions - 01 Built-in Functions - 02 Modules and Packages Object Oriented Programming File Handling Correct Answers

Typology: Quizzes

2022/2023

Available from 08/28/2023

chip-sized
chip-sized 🇮🇳

1 document

1 / 100

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
250


d
C H I P S I Z E D ' S
MULTIPLE CHOICES
ANSWERS INCLUDED
ALL IMPORTANT TOPICS COVERED
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Partial preview of the text

Download 250 Python Multiple-Choice Questions for Practice and more Quizzes Computer Programming in PDF only on Docsity!

a

b

c

d

C H I P S I Z E D ' S

MULTIPLE CHOICES

ANSWERS INCLUDED ALL IMPORTANT TOPICS COVERED

Preface 250 Python Quizzes

Kindly Read This !!! Thanks a lot for purchasing our book. We are thrilled to present this compilation of 250 engaging and thought-provoking Python quizzes that are certain to challenge and enrich your understanding of this versatile programming language. As full-time freelancers and ardent Python enthusiasts, we were clear on meticulously crafting the quizzes from scratch. Unlike generic internet questions , each quiz on these pages reflects our commitment to offering you a unique and enlightening learning experience. Countless hours were invested in researching, designing, and refining each question to ensure that they test your knowledge and inspire a deeper exploration of Python's concepts. We wanted to provide a resource that caters to both beginners seeking to solidify their basics and seasoned developers aiming to challenge their expertise. Your support gives us a lot of confidence. As freelancers, we've poured our passion into this book, and your appreciation fuels our drive to create more valuable content. If you find this book beneficial and wish to extend your support, we kindly invite you to consider supporting this project financially through our Buy Me A Coffee page. Every contribution, no matter how small, goes a long way in helping us continue our mission of spreading knowledge. For any doubts and clarifications, we encourage you to connect with us on LinkedIn. We create content on different platforms like Medium , Gumroad , and LinkedIn. You can follow us through these links to consume more Python content. You can get my free Python Handwritten Notes from Gumroad as well which has over 2900 sales. Get to know all our work through our LinkTree account. We believe that learning should be an immersive and enjoyable experience, and we hope that this philosophy shines through in every quiz we've crafted. Happy Coding !!! Thanks and Regards Chip Sized

Introduction to Python 250 Python Quizzes

Introduction to Python

  1. Who is the founder of Python? A) Dennis Ritchie B) Bjarne Stroustrup C) Guido van Rossum D) James Gosling
  2. Which of the following extensions is used in a Python file? A) .pyth B) .p C) .python D) .py
  3. In which year was Python initially released? A) 1989 B) 1991 C) 1987 D) 1994
  4. Is Python compiled or interpreted? A) Interpreted B) Compiled C) Both Compiled and Interpreted D) None of the Above

Introduction to Python 250 Python Quizzes

  1. There are ____ keywords in Python 3.11 (currently the latest version). A) 33 B) 35 C) 30 D) 38
  2. Which among the following is the full form of PIP? A) Python Index Packaging B) Preferred Installer Program C) Python Installer Program D) PIP Installs Python
  3. Which symbol is used to write a single-line comment in Python? A) # B)! C) * D) /
  4. Which of the following is not a built-in function in Python? A) print() B) sqrt() C) ascii() D) sorted()
  5. Which of the following is an application of Python? A) Machine Learning B) Data Science C) Web Development D) All of the Above

The Print Function 250 Python Quizzes

The Print Function

  1. What is the output of the following code? print('pyt.', 'hon') A) python B) pyt. hon C) pyt hon D) pyt.hon
  2. What is the output of the following code? print('10' + '20') A) 10 20 B) 1020 C) 30 D) 10 + 20
  3. Choose the correct code that would display the following output. ABBBC A) print('A' + 'B' + 'C', sep='B') B) print('ABB', 'BC') C) print('A', 'B', 'C', sep='B') D) print('A' + 'C', sep='BBB')

The Print Function 250 Python Quizzes

  1. What is the default value of the 'end' argument used in the print( ) function? A) end=' ' B) end='\n' C) end=',' D) end='\t'
  2. What is the output of the following code? print("Hello World", sep='%') A) Hello World B) Hello World% C) Hello%World D) Error
  3. What is the output of the following code? print('code", 'blocks', sep='', end='') A) codeblocks B) codeblocks C) code blocks D) Error
  4. Choose the correct code that would display the following output. lemon+cake+ A) print('lemon' + 'cake', sep='+', end='+') B) print('lemon' + 'cake', end='+') C) print('lemon', 'cake', sep='+', end='+') D) print('lemon+', 'cake', end='+')

Variables and Keywords - 01 250 Python Quizzes

Variables and Keywords - 01

  1. Which of the following is an invalid variable name in Python? A) yield B) true C) C D) a_b_c
  2. What is the correct Python syntax to store the value 347 in a variable named n? A) n == 347 B) 347 = n C) int n = 347 D) n = 347
  3. Which of the following is a valid variable name in Python? A) var% B) none C) pass D) 8num
  4. What is the output of the following code? a = 100 b = 200 b = a a = b print(b, a) A) 100 200 B) 200 100 C) 100 100 D) 200 200

Variables and Keywords - 01 250 Python Quizzes

  1. What is the output of the following code? p = q q = 'hello' print(p) A) hello B) q C) Blank Output D) Error
  2. Which of the following is not a keyword in Python? A) except B) final C) from D) global
  3. What is the output of the following code? r = 5 + 8 print('r') A) 5 + 8 B) r C) 13 D) Error
  4. How many keywords (as of Python 3.11) are not completely lowercase? A) 2 B) 5 C) 3 D) 4

Variables and Keywords - 02 250 Python Quizzes

Variables and Keywords - 02

  1. Which of the following keywords is not used as an operator? A) is B) in C) or D) as
  2. What is the syntax to assign the number 76 to variables r, s, and t using a single line? A) r + s + t = 76 B) r = s = t = 76 C) r, s, t = 76 D) r, s, t = 76 * 3
  3. What is the output of the following code? x, y, z = 'y', 'z', 'x' print(z, 'x', y) A) y z x B) x y z C) x x z D) y x z
  4. Which of the following is a keyword in Python? A) default B) del C) false D) local

Variables and Keywords - 02 250 Python Quizzes

  1. What is the output of the following code? a, b, c = 3, 8, 5 d = b - c b = d + a a = b - c print(d, a, b, c) A) 1 6 5 3 B) 3 1 6 5 C) 3 3 8 5 D) 3 1 8 5
  2. On executing the following code, how many objects has Python created? val = 'code' var = val A) 0 B) 3 C) 2 D) 1
  3. On executing the following code, how many references has Python created? val = 758 var = val A) 2 B) 0 C) 3 D) 1

Data Types - 01 250 Python Quizzes

Data Types - 01

  1. How is the dictionary data type represented in Python? A) dict B) dictionary C) dic D) dicts
  2. Which of the following values is not a tuple? A) ('A') B) 10, 20 C) ([10], [20]) D) (10,)
  3. Which of the following values displays an error if printed? A) {10, 20, 10} B) {1: 10, 2: 20, 1: 30} C) {6, [2, 3], 5} D) [1, ['Hello'], 1]
  4. What is the output of the following code? a = 00 print(list(str(a)) A) ['00'] B) ['0'] C) ['0', '0'] D) Error

Data Types - 01 250 Python Quizzes

  1. What is the output of the following code? d = {1: 'A', 2: 'B', 1: 'C'} print(d) A) {1: 'A', 2: 'B'} B) {1: 'A', 2: 'B', 1: 'C'} C) {1: 'C', 2: 'B'} D) Error
  2. What is the output of the following code? data = '20.0', Print(type(data)) A) <class 'int'> B) <class 'float'> C) <class 'str'> D) <class 'tuple'>
  3. Which of the following is a scientific notation of 0.095 in Python? A) 9.5e- B) 9.5e C) 95e- D) 0.95e-
  4. Which of the following is an example of an implicit type conversion? A) String to List B) Integer to Float C) Tuple to List D) Float to Integer

Data Types - 02 250 Python Quizzes

Data Types - 02

  1. Which of the following is a mutable data type in Python? A) Integer B) Dictionary C) Complex D) String
  2. Which of the following represents an empty set in Python? A) [] B) set() C) {} D) ()
  3. What is the output of the following code? a = '01.01' print(int(a)) A) 01 B) 1 C) 1. D) Error
  4. Which of the following data type conversion is not possible in Python? A) String to Integer B) List to Tuple C) List to Integer D) Complex to String

Data Types - 02 250 Python Quizzes

  1. What is the output of the following code? num = 6 print(complex(num)) A) 6. B) 6j C) 6+0j D) Error
  2. What is the output of the following code? s = '123' print(list(s)) A) [1, 2, 3] B) [123] C) ['1', '2', '3'] D) ['123']
  3. What is the output of the following code? var = '100' print(int(var, 2)) A) 100 B) 2 C) 4 D) Error