• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 4 out of 88 pages
Exam (elaborations)

WGU D335 — INTRODUCTION TO PROGRAMMING IN PYTHON: OBJECTIVE ASSESSMENT EXAM COMPREHENSIVE QUESTIONS AND CORRECT ANSWERS LATEST EDITION 2026

Document preview thumbnail
Preview 4 out of 88 pages

WGU D335 — INTRODUCTION TO PROGRAMMING IN PYTHON: OBJECTIVE ASSESSMENT EXAM COMPREHENSIVE QUESTIONS AND CORRECT ANSWERS LATEST EDITION 2026

Content preview

Page 1 of 88


WGU D335 — INTRODUCTION TO PROGRAMMING IN PYTHON:
OBJECTIVE ASSESSMENT EXAM COMPREHENSIVE QUESTIONS AND
CORRECT ANSWERS LATEST EDITION 2026




WGU D335 — Introduction to Programming in Python: Objective Assessment — Questions
with Rationales



Summarized 10-Point Exam Coverage
Based on the official WGU D335 (NKO2) Objective Assessment weighting:
1. Python Fundamentals & Syntax (25%) — variables, data types, operators, input/output,
type conversion, comments, and basic program structure (IPO model).
2. Data Types & Structures (25%) — lists, tuples, dictionaries, sets, strings, indexing,
slicing, mutability, and built-in methods.
3. Control Flow & Loops (20%) — if/elif/else, for loops, while loops, range(), break,
continue, nested loops, and logical operators.
4. Functions & Modules (15%) — def, parameters, default arguments, return values, scope,
lambda, import, and recursion.
5. File I/O & Exception Handling (10%) — open(), read(), write(), with statement,
try/except/finally, and common exception types.
6. Problem Solving & Algorithms (5%) — IPO thinking, tracing code, debugging logic
errors, and algorithmic sequencing.




1|Page

,Page 2 of 88




SECTION 1: PYTHON FUNDAMENTALS & SYNTAX (Questions 1–60)

Q1. What is the correct way to output "Hello World" to the console in Python?

A. console.log("Hello World")
B. printf("Hello World")
C. print("Hello World")
D. echo "Hello World"

Correct Answer: C
Rationale: The built-in print() function is used to output text to the console in Python.
console.log() is JavaScript, printf() is C, and echo is PHP/Shell.



Q2. 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
Rationale: Every program follows the IPO model: it takes input, processes that data, and
produces output.




Q3. 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


2|Page

,Page 3 of 88


Correct Answer: B
Rationale: 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.




Q4. 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
Rationale: An algorithm is a step-by-step sequence of instructions designed to solve a specific
problem or accomplish a task.



Q5. What does the print() function do in Python?

A. Reads input from the user
B. Displays output to the screen and starts a new line
C. Opens a file for reading
D. Converts a value to a string

Correct Answer: B
Rationale: The print() function outputs text or variable values to the console. By default, it adds
a newline character at the end.




Q6. How do you denote a comment in Python?

A. // comment
B. /* comment */


3|Page

, Page 4 of 88


C. # comment or """multi-line comment"""
D. <!-- comment -->

Correct Answer: C
Rationale: Single-line comments begin with #. Multi-line comments can be enclosed in triple
quotes. Comments are ignored by the interpreter.




Q7. What is the purpose of the input() function?

A. To display output to the screen
B. To get text input from the user
C. To convert data types
D. To open a file

Correct Answer: B
Rationale: The input() function reads a line of text from the user and returns it as a string. It can
optionally display a prompt string.



Q8. What does the type() function return?

A. The size of a variable in memory
B. The data type of a variable or value
C. The value of a variable
D. The memory address of a variable

Correct Answer: B
Rationale: The type() function returns the data type of a variable or value. For example,
type(3.14) returns <class 'float'>.



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


4|Page

Document information

Uploaded on
September 19, 2026
Number of pages
88
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$24.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

Sold
1
Followers
0
Items
163
Last sold
3 days 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