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 103 pages
Exam (elaborations)

WGU D335 OA: INTRODUCTION TO PROGRAMMING IN PYTHON 2026 | PRACTICE QUESTIONS, VERIFIED ANSWERS & DETAILED RATIONALES

Document preview thumbnail
Preview 4 out of 103 pages

Comprehensive WGU D335 study resource covering core Python programming concepts and Objective Assessment preparation. Reviews Python syntax, variables, data types, operators, input/output, expressions, and fundamental programming structures. Covers conditional statements, loops, functions, lists, dictionaries, sets, strings, and other essential Python data structures. Reinforces exception handling, file operations, modules, packages, libraries, and practical problem-solving skills. Includes practice-style questions with verified answers and detailed explanations to strengthen coding knowledge and assessment readiness. WGU describes D335 as focused on basic Python scripting, control flow with functions and loops, and implementing code with packages, modules, and libraries. Updated for 2026 study needs and designed as an independent preparation resource; avoid relying on claims of “actual exam” questions or guaranteed passing results.

Content preview

WGU D335 OA: INTRODUCTION TO
PROGRAMMING IN PYTHON 2026 |
PRACTICE QUESTIONS, VERIFIED ANSWERS
& DETAILED RATIONALES
WGU D335 OA: INTRODUCTION TO PROGRAMMING IN PYTHON 2026 PRACTICE
QUESTIONS, VERIFIED ANSWERS & DETAILED RATIONALES

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

DOCUMENT OVERVIEW

• This comprehensive practice exam contains 200 verified questions with detailed
rationales to help you master Python fundamentals across all core exam topics,
from basic syntax to object-oriented programming concepts.

• Study this material by working through questions systematically, reviewing each
rationale carefully to reinforce understanding—focus on areas where you struggle
most, and revisit those sections before attempting the actual assessment.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

SECTION 1: BASIC SYNTAX AND DATA TYPES (QUESTIONS 1-30)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Question 1: Which of the following is a valid Python variable name?

A) 2var_name

B) var-name

C) var_name

D) var name

E) @var_name

CORRECT ANSWER: C) var_name

Rationale: Python variable names must start with a letter (a-z, A-Z) or an underscore
(_), followed by letters, digits, or underscores. Option C follows this rule exactly.

,Option A is invalid because variable names cannot start with a digit. Option B is
invalid because hyphens are not allowed in variable names. Option D is invalid
because spaces are not permitted. Option E is invalid because special characters
like @ are not allowed.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Question 2: What will be the output of the following code? x = 10; y = 3; print(x
% y)

A) 3

B) 3.33

C) 1

D) 13

E) 0

CORRECT ANSWER: C) 1

Rationale: The modulo operator (%) returns the remainder after division. When 10
is divided by 3, the quotient is 3 with a remainder of 1. Therefore, 10 % 3 equals 1.
This operator is useful for determining if numbers are even or odd, or for cycling
through values.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Question 3: Which data type is used to store a single character or string of
characters?

A) int

B) float

C) str

D) bool

E) char

,CORRECT ANSWER: C) str

Rationale: In Python, the str (string) data type is used to store text data, including
single characters, words, sentences, or any sequence of characters. Python does
not have a separate 'char' data type like some other languages. The int type stores
integers, float stores decimal numbers, and bool stores True/False values.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Question 4: What is the result of the expression: 2 ** 3 + 5?

A) 11

B) 13

C) 40

D) 21

E) 8

CORRECT ANSWER: B) 13

Rationale: The exponentiation operator (**) has higher precedence than addition.
First, 2 ** 3 is calculated, which equals 8 (2 multiplied by itself 3 times). Then, 8 + 5 =
13. Understanding operator precedence is crucial for writing correct expressions in
Python.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Question 5: Which of the following correctly describes the purpose of the
input() function?

A) It prints output to the console

B) It reads a line of text from the user and returns it as a string

C) It creates a new variable

D) It calculates mathematical expressions

E) It terminates the program

, CORRECT ANSWER: B) It reads a line of text from the user and returns it as a
string

Rationale: The input() function is used to receive input from the user through the
keyboard. It always returns the input as a string data type, even if the user enters
numbers. If numeric input is needed, the result must be explicitly converted using
int() or float(). The print() function is used for output, not input.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Question 6: What will be printed by the following code? print(type(5.0))

A) <class 'int'>

B) <class 'float'>

C) <class 'str'>

D) <class 'number'>

E) float

CORRECT ANSWER: B) <class 'float'>

Rationale: The type() function returns the data type of an object. The value 5.0 is a
floating-point number (contains a decimal point), so type(5.0) returns <class 'float'>.
Note that 5 (without decimal) would return <class 'int'>, and the decimal point is
what distinguishes float from int in Python.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Question 7: What is the output of: print("Hello" + " " + "World")?

A) Hello World

B) "Hello World"

C) Hello + World

D) HelloWorld

E) Error: cannot concatenate

Document information

Uploaded on
September 8, 2026
Number of pages
103
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$13.99

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.
PROFESSORKENNY
3.9
(60)
Sold
1311
Followers
21
Items
5022
Last sold
6 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