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

WGU D335 Introduction to Programming in Python – Comprehensive Objective Assessment | Practice Questions & Answers | Study Guide & Exam Review | 2026/2027

Document preview thumbnail
Preview 4 out of 35 pages

WGU D335 Introduction to Programming in Python – Comprehensive Objective Assessment | Practice Questions & Answers | Study Guide & Exam Review | 2026/2027

Content preview

WGU D335 |1




WGU D335 Introduction to Programming in Python –
Comprehensive Objective Assessment | Practice Questions
& Answers | Study Guide & Exam Review | 2026/2027


Table of Contents
1. Python Fundamentals and Syntax
2. Data Types and Structures
3. Control Flow and Loops
4. Functions and Modules
5. File I/O and Exception Handling
6. Problem Solving and Algorithms
7. String Manipulation and Formatting
8. Lists, Tuples, Dictionaries, and Sets
9. Comprehensions and Generators
10. Object-Oriented Programming Basics
11. Debugging and Error Types
12. Code Reading and Output Prediction

, WGU D335 |2

Question 1: A program consists of which three basic instruction types?
A. Read, Write, Execute
B. Input, Process, Output
C. Compile, Link, Run
D. Define, Call, Return

Correct Answer: B. Input, Process, Output
Every program follows the IPO model: it takes input (from keyboard, file, etc.), processes that
data (computations, logic), and produces output (to screen, file, etc.). This model is
fundamental to understanding how programs work.

Question 2: What is a variable in Python?
A. A fixed value that cannot change
B. A named reference to a value stored in memory
C. A type of loop structure
D. A function that prints output

Correct Answer: B. A named reference to a value stored in memory
A variable is a named item used to hold a value. It acts as a reference or label that points to
an object in memory. Variables can be reassigned to different values during program
execution.

Question 3: What is an algorithm?
A. A type of Python data structure
B. A sequence of instructions that solves a problem
C. A built-in Python function
D. An error in program execution

Correct Answer: B. A sequence of instructions that solves a problem
An algorithm is a step-by-step sequence of instructions designed to solve a specific problem
or accomplish a task. Algorithms are language-independent and form the foundation of all
computer programs.

Question 4: What does the assignment operator = do in Python?
A. Compares two values for equality
B. Assigns a value to a variable

, WGU D335 |3

C. Adds two values together
D. Checks if a variable exists

Correct Answer: B. Assigns a value to a variable
The = operator assigns the value on the right to the variable on the left. The comparison
operator for equality is ==. Confusing the two is a common beginner mistake.

Question 5: What is the output of print(type(3.14))?
A. <class 'int'>
B. <class 'float'>
C. float
D. 3.14

Correct Answer: B. <class 'float'>
The type() function returns the data type of its argument. Since 3.14 is a floating-point
number, its type is <class 'float'>. The output includes the angle brackets and the word
"class".

Question 6: Which operator returns the remainder of division?
A. /
B. //
C. %
D. **

Correct Answer: C. %
The modulo operator % returns the remainder after division. For example, 10 % 3 returns 1.
The / operator is true division, // is floor division, and ** is exponentiation.

Question 7: Evaluate: 17 // 5
A. 3.4
B. 3
C. 4
D. 2

Correct Answer: B. 3
The // operator is floor division (integer division). It returns the quotient without the
remainder. 17 divided by 5 is 3.4, which floors to 3. The fractional part is discarded.

, WGU D335 |4

Question 8: What is the value of 2 ** 4?
A. 6
B. 8
C. 16
D. 32

Correct Answer: C. 16
The ** operator is exponentiation. 2 ** 4 means 2 raised to the power of 4, which equals 2 ×
2 × 2 × 2 = 16. This is different from 2 * 4, which equals 8.

Question 9: Which variable name is invalid in Python?
A. _myVar
B. myVar2
C. 2myVar
D. my_var

Correct Answer: C. 2myVar
Variable names cannot start with a digit. They can start with a letter or an underscore. The
other options are all valid variable names. This rule prevents ambiguity with numeric literals.

Question 10: What does len("Hello World") return?
A. 10
B. 11
C. 12
D. 9

Correct Answer: B. 11
The len() function returns the number of characters in a string, including spaces. "Hello
World" has 11 characters: H, e, l, l, o, space, W, o, r, l, d.

Question 11: Which function converts the string "123" to an integer?
A. str("123")
B. int("123")
C. float("123")
D. chr("123")

Correct Answer: B. int("123")
The int() function converts a string or number to an integer. The string must represent a valid

Document information

Uploaded on
September 12, 2026
Number of pages
35
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$14.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
highub
4.0
(1)
Sold
1
Followers
0
Items
510
Last sold
2 months 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