Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 4 out of 231 pages
Exam (elaborations)

Python Programming Practice Question Bank: 295+ Questions with Verified Answers & Detailed Rationales

Document preview thumbnail
Preview 4 out of 231 pages

Master Python programming with this comprehensive practice question bank featuring 295+ multiple-choice questions with verified answers and detailed rationales. This complete study resource covers all essential Python topics from fundamentals to advanced concepts, perfect for exam preparation, interview practice, and skill assessment. Key Features: 295+ exam-style questions with correct answers Detailed rationales explaining the "why" behind each answer Organized into 11 comprehensive sections 231 pages of in-depth content Covers beginner to intermediate level concepts Perfect for Python certification preparation What's Included: Python Fundamentals & Syntax (print, comments, data types) Variables, Data Types & Type Conversion (int, float, str, bool) Operators & Expressions (arithmetic, comparison, logical) Strings & String Methods (slicing, formatting, manipulation) Control Flow: Conditionals (if/elif/else) Loops & Iteration (for, while, range, enumerate) Functions & Scope (parameters, return, global, lambda) Data Structures (lists, tuples, dictionaries, sets) File Input/Output (open, read, write, with statement) Exception Handling & Debugging (try/except/finally) Comprehensive Mixed Topics Perfect for: Python beginners and intermediate learners Exam preparation (PCEP, PCAP certification) Coding interview preparation University programming courses Self-paced learning and skill assessment Build your Python programming confidence with this complete practice question bank covering syntax, data structures, control flow, functions, file I/O, and exception handling. Pass your exams with confidence!

Content preview

Page 1 of 231



WGU E010 FOUNDATIONS OF
PROGRAMMING (PYTHON)
OBJECTIVE ASSESSMENT (OA)
PRACTICE QUESTION BANK
250+ MULTIPLE-CHOICE QUESTIONS
WITH VERIFIED ANSWERS AND
DETAILED RATIONALES **ACADEMIC
YEAR:** 2026–2027

# TABLE OF CONTENTS


| Section | Topic | Questions |

|---------|-------|-----------|

| **Section 1** | Python Fundamentals & Syntax | 1–25 |

| **Section 2** | Variables, Data Types, and Type Conversion | 26–55 |

| **Section 3** | Operators and Expressions | 56–80 |

| **Section 4** | Strings and String Manipulation | 81–105 |

| **Section 5** | Control Flow: Conditionals (if/elif/else) | 106–130 |

| **Section 6** | Loops and Iteration (for/while) | 131–160 |

| **Section 7** | Functions and Scope | 161–190 |

| **Section 8** | Data Structures: Lists, Tuples, Dictionaries, Sets | 191–225 |

| **Section 9** | File Input/Output | 226–240 |

| **Section 10** | Exception Handling and Debugging | 241–255 |

| **Section 11** | Comprehensive/Mixed Topics | 256–260+ |

,Page 2 of 231

# SECTION 1: PYTHON FUNDAMENTALS & SYNTAX



### Question 1

**What is the output of the following Python code?**
```python

print("Hello, World!")

```



A) `Hello, World!`

B) `"Hello, World!"`

C) `print("Hello, World!")`

D) An error occurs


---



**Correct Answer: A**



**Rationale:** The `print()` function outputs the string literal to the console without the
quotation marks. The quotes are used only to denote the string in the code; they are not part of
the output. Python executes the `print()` function, which displays the string content to standard
output.



---



### Question 2

**Which of the following is a valid variable name in Python?**


A) `2ndName`

,Page 3 of 231

B) `my-name`

C) `_myVariable`

D) `my variable`


---



**Correct Answer: C**



**Rationale:** Python variable names can start with a letter (A–Z, a–z) or an underscore (`_`).
They cannot start with a digit (eliminating A), cannot contain hyphens (eliminating B), and
cannot contain spaces (eliminating D). Underscores are allowed and commonly used for variable
names.


---



### Question 3

**Which symbol is used for single-line comments in Python?**



A) `//`
B) `#`

C) `/*`

D) `<!--`



---



**Correct Answer: B**

, Page 4 of 231

**Rationale:** The hash character `#` indicates a single-line comment in Python. Everything
after it on the same line is ignored by the Python interpreter. `//` is used for comments in
languages like C++ and Java, `/* */` is used for multi-line comments in C-style languages, and
`<!-- -->` is used for HTML comments.


---



### Question 4

**What is the output of `print(type())`?**



A) `<class 'int'>`

B) `<class 'float'>`
C) `<class 'double'>`

D) `<class 'str'>`



---



**Correct Answer: B**


**Rationale:** In Python 3, the `/` operator performs floating-point division, always returning a
float. Even when dividing two integers that result in a whole number, the result is a float.
Therefore, `` evaluates to `5.0`, and `type(5.0)` returns `<class 'float'>`.



---


### Question 5

**What is the output of `print(10 // 3)`?**


A) `3.33`

Document information

Uploaded on
August 17, 2026
Number of pages
231
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$29.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
ITSJEREGUIDES
5.0
(1)
Sold
22
Followers
1
Items
1938
Last sold
5 hours ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions