WGU D416 DevNet Fundamentals —
Full Practice Exam (100 Questions)
with correct answers and
rationale graded A+ new!!
Domain 1: Software Development and Design
(Questions 1–15)
1. A developer needs to convert a JSON-formatted string received from an API
into a Python dictionary. Which method should be used?
A. json.dumps()
B. json.loads()
C. json.load()
D. json.dump()
Answer: B
json.loads() parses a JSON string into a Python object (dictionary or
list). json.dumps() converts Python objects to JSON strings. json.load() reads JSON from
a file object. json.dump() writes JSON to a file. -3-10
2. Which Git command displays commit history in a single-line-per-commit
format?
A. git status
B. git log --oneline
C. git diff
D. git show
Answer: B
git log --oneline condenses each commit into one line showing the abbreviated hash
and commit message. git status shows working tree status. git diff shows changes
between commits. git show displays a specific commit in detail. -3
,3. Which YAML syntax correctly defines a list of two items?
A. servers: server1 server2
B. servers: [server1, server2] (Python-style)
C. servers: {server1, server2} (JSON-style)
D.
text
Copy
Download
servers:
- server1
- server2
Answer: D
YAML lists use a dash followed by a space (- item) under a key. Option B uses Python
list syntax. Option C uses JSON-like set notation. Option A omits required list
indicators. -3
4. Which Python code correctly handles a missing file exception?
A. if file_exists('file.txt'): open('file.txt')
B. try: open('file.txt') except FileNotFoundError: print('File not found')
C. open('file.txt') || print('File not found')
D. with open('file.txt') as f: print(f.read())
Answer: B
Python uses try/except blocks for exception handling. FileNotFoundError is raised when
a file doesn't exist. Option A uses a non-existent function. Option C uses invalid
syntax. Option D doesn't handle the exception. -3
5. Which software development methodology emphasizes iterative
development in short cycles called sprints?
A. Waterfall
B. Agile
C. Spiral
D. V-Model
Answer: B
,Agile emphasizes iterative development, continuous feedback, and delivering
working software in short cycles (sprints). Waterfall is linear and sequential. Spiral
emphasizes risk analysis. V-Model emphasizes verification and validation. -3-4
6. Which Python library is commonly used to parse XML data?
A. json
B. xml.etree.ElementTree
C. yaml
D. csv
Answer: B
xml.etree.ElementTree is the standard Python library for parsing and creating XML
data. json handles JSON. yaml handles YAML. csv handles comma-separated values. -3
7. Which software design pattern separates an application into Model, View,
and Controller components?
A. Observer
B. MVC
C. Singleton
D. Factory
Answer: B
MVC (Model-View-Controller) separates data (Model), presentation (View), and logic
(Controller). The Observer pattern defines a one-to-many dependency between
objects. -4
8. In Python, which data structure is best for storing device attributes as key-
value pairs?
A. List
B. Dictionary
C. Set
D. Tuple
, Answer: B
Dictionaries store hierarchical data as key-value pairs, making it ideal for device
attributes like hostname, IP, and VLANs. Lists are ordered collections. Sets are
unordered unique items. Tuples are immutable. -10
9. Which Git operation creates a copy of a remote repository on a local
machine?
A. git push
B. git pull
C. git clone
D. git merge
Answer: C
git clone creates a local copy of a remote repository. git push sends local commits to
remote. git pull fetches and merges remote changes. git merge combines branches. -4
10. What is the primary purpose of a CI/CD pipeline?
A. To manually deploy code after each change
B. To automate building, testing, and deploying code changes
C. To replace version control systems
D. To provide network security only
Answer: B
CI/CD (Continuous Integration/Continuous Deployment) pipelines automate
building, testing, and deploying code changes to reduce manual errors and speed
delivery. -4
11. Which tool is used to enforce PEP 8 style compliance and detect Python
syntax errors in a CI pipeline?
A. Pytest
B. Flake8
Full Practice Exam (100 Questions)
with correct answers and
rationale graded A+ new!!
Domain 1: Software Development and Design
(Questions 1–15)
1. A developer needs to convert a JSON-formatted string received from an API
into a Python dictionary. Which method should be used?
A. json.dumps()
B. json.loads()
C. json.load()
D. json.dump()
Answer: B
json.loads() parses a JSON string into a Python object (dictionary or
list). json.dumps() converts Python objects to JSON strings. json.load() reads JSON from
a file object. json.dump() writes JSON to a file. -3-10
2. Which Git command displays commit history in a single-line-per-commit
format?
A. git status
B. git log --oneline
C. git diff
D. git show
Answer: B
git log --oneline condenses each commit into one line showing the abbreviated hash
and commit message. git status shows working tree status. git diff shows changes
between commits. git show displays a specific commit in detail. -3
,3. Which YAML syntax correctly defines a list of two items?
A. servers: server1 server2
B. servers: [server1, server2] (Python-style)
C. servers: {server1, server2} (JSON-style)
D.
text
Copy
Download
servers:
- server1
- server2
Answer: D
YAML lists use a dash followed by a space (- item) under a key. Option B uses Python
list syntax. Option C uses JSON-like set notation. Option A omits required list
indicators. -3
4. Which Python code correctly handles a missing file exception?
A. if file_exists('file.txt'): open('file.txt')
B. try: open('file.txt') except FileNotFoundError: print('File not found')
C. open('file.txt') || print('File not found')
D. with open('file.txt') as f: print(f.read())
Answer: B
Python uses try/except blocks for exception handling. FileNotFoundError is raised when
a file doesn't exist. Option A uses a non-existent function. Option C uses invalid
syntax. Option D doesn't handle the exception. -3
5. Which software development methodology emphasizes iterative
development in short cycles called sprints?
A. Waterfall
B. Agile
C. Spiral
D. V-Model
Answer: B
,Agile emphasizes iterative development, continuous feedback, and delivering
working software in short cycles (sprints). Waterfall is linear and sequential. Spiral
emphasizes risk analysis. V-Model emphasizes verification and validation. -3-4
6. Which Python library is commonly used to parse XML data?
A. json
B. xml.etree.ElementTree
C. yaml
D. csv
Answer: B
xml.etree.ElementTree is the standard Python library for parsing and creating XML
data. json handles JSON. yaml handles YAML. csv handles comma-separated values. -3
7. Which software design pattern separates an application into Model, View,
and Controller components?
A. Observer
B. MVC
C. Singleton
D. Factory
Answer: B
MVC (Model-View-Controller) separates data (Model), presentation (View), and logic
(Controller). The Observer pattern defines a one-to-many dependency between
objects. -4
8. In Python, which data structure is best for storing device attributes as key-
value pairs?
A. List
B. Dictionary
C. Set
D. Tuple
, Answer: B
Dictionaries store hierarchical data as key-value pairs, making it ideal for device
attributes like hostname, IP, and VLANs. Lists are ordered collections. Sets are
unordered unique items. Tuples are immutable. -10
9. Which Git operation creates a copy of a remote repository on a local
machine?
A. git push
B. git pull
C. git clone
D. git merge
Answer: C
git clone creates a local copy of a remote repository. git push sends local commits to
remote. git pull fetches and merges remote changes. git merge combines branches. -4
10. What is the primary purpose of a CI/CD pipeline?
A. To manually deploy code after each change
B. To automate building, testing, and deploying code changes
C. To replace version control systems
D. To provide network security only
Answer: B
CI/CD (Continuous Integration/Continuous Deployment) pipelines automate
building, testing, and deploying code changes to reduce manual errors and speed
delivery. -4
11. Which tool is used to enforce PEP 8 style compliance and detect Python
syntax errors in a CI pipeline?
A. Pytest
B. Flake8