Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

WGU D522 – Python for IT Automation Actual Exam 2026/2027 –Verified Questions with Rationales

Beoordeling
-
Verkocht
-
Pagina's
34
Cijfer
A+
Geüpload op
16-04-2026
Geschreven in
2025/2026

WGU D522 – Python for IT Automation Actual Exam 2026/2027 –Verified Questions with Rationales

Instelling
WGU D522 – Python For IT Automation
Vak
WGU D522 – Python for IT Automation

Voorbeeld van de inhoud

WGU D522 – Python for IT Automation
Actual Exam 2026/2027 –Verified Questions
with Rationales

Q1: You’re writing a script to calculate server uptime percentages for your
infrastructure team. You assign total_hours = 8760 and downtime = 43.5.
What is the data type of the result when you calculate uptime_percentage =
((total_hours - downtime) / total_hours) * 100?
A. Integer (int)
B. Floating-point number (float) [CORRECT]
C. String (str)
D. Boolean (bool)
Correct Answer: B
Rationale:✓✓ Even though total_hours is an integer, the division operation in
Python 3 always produces a float to maintain decimal precision. The subsequent
multiplication keeps it as a float, which is exactly what you need for precise
percentage calculations.


Q2: A junior developer asks why their boolean variable is_connected =
"False" evaluates to True in their conditional check. What is the root cause of
this unexpected behavior?
A. The variable name contains underscores which Python interprets as True
B. “False” as a string is truthy because it’s a non-empty string [CORRECT]
C. Boolean variables must be declared using the bool() constructor exclusively
D. Python treats all quoted text as logical True by default
Correct Answer: B
Rationale:✓✓ In Python, any non-empty string—including the text "False"—
evaluates to True in a boolean context. The quotes make it a string literal, not the
boolean False value. The correct assignment would be is_connected = False
without any quotes.

,Q3: You need to convert user input from a text file—stored as the string
"4500"—to an integer for memory allocation calculations. Which code
accomplishes this conversion correctly?
A. memory = "4500".toInteger()
B. memory = integer("4500")
C. memory = int("4500") [CORRECT]
D. memory = str(4500)
Correct Answer: C
Rationale:✓✓ Python’s built-in int() constructor converts strings to integers.
The toInteger() method doesn’t exist in Python, integer() isn’t a built-in function
name, and str() would convert an integer to a string, which is the opposite of what
you need.


Q4: While reviewing a configuration script, you encounter this
line: port_number = 8080 # Default port for the web service. How would you
categorize this comment according to Python conventions?
A. Block comment
B. Inline comment [CORRECT]
C. Docstring
D. Multi-line comment
Correct Answer: B
Rationale:✓✓ Text following a hash symbol (#) on the same line as executable
code constitutes an inline comment. Block comments typically appear on their own
lines before code, docstrings use triple quotes to describe functions or modules,
and Python doesn’t have formal multi-line comment syntax (it uses triple-quoted
strings instead).


Q5: A script contains the mathematical expression result = 15 // 4. What
integer value does the variable result hold after execution?
A. 3.75
B. 3 [CORRECT]
C. 4
D. 0

,Correct Answer: B
Rationale:✓✓ The // operator performs floor division (integer division). 15
divided by 4 is 3.75, and floor division truncates the decimal part, returning the
integer 3. The result is an int, not a float.


Q6: Which of the following is a valid way to check if a variable status is exactly
the integer 0?
A. if status is 0:
B. if status == 0: [CORRECT]
C. if status = 0:
D. if status equals 0:
Correct Answer: B
Rationale:✓✓ The equality operator == compares values. is checks object identity,
which may work for small integers due to interning but is not reliable. = is
assignment, not comparison. equals is not a Python keyword.


Q7: You need to iterate over a list of IP addresses and print each one. Which
loop correctly accomplishes this?
A. for i in range(ip_list): print(ip_list[i])
B. for ip in ip_list: print(ip) [CORRECT]
C. while ip in ip_list: print(ip)
D. foreach ip in ip_list: print(ip)
Correct Answer: B
Rationale:✓✓ Python’s for loop directly iterates over the elements of a list. Option
B is the simplest and most readable. Option A would require range(len(ip_list)).
Option C uses while incorrectly. Option D uses foreach, which is not Python
syntax.


Q8: What is the output of the following code? print(type())
A. <class ‘int’>
B. <class ‘float’> [CORRECT]
C. <class ‘complex’>
D. <class ‘str’>

, Correct Answer: B
*Rationale:✓✓ In Python 3, the / operator always returns a float, even if the
division yields an integer result (10/2 = 5.0).*


Q9: Which method is used to read an entire file into a single string?
A. file.read_all()
B. file.read() [CORRECT]
C. file.readline()
D. file.readlines()
Correct Answer: B
Rationale:✓✓ file.read() without arguments reads the entire content as one
string. readline() reads one line, readlines() returns a list of lines,
and read_all() does not exist.


Q10: You have a list of server names: servers = [“web01”, “db01”, “cache01”].
Which code replaces “db01” with “db02”?
A. servers[1] = “db02” [CORRECT]
B. servers[2] = “db02”
C. servers.replace(“db01”, “db02”)
D. servers[“db01”] = “db02”
Correct Answer: A
Rationale:✓✓ Lists are zero-indexed; “db01” is at index 1. Assignment to an
index changes the element. replace is a string method, not a list method. Using a
string as an index is invalid.


Q11: Which statement correctly creates an empty dictionary?
A. dict = []
B. dict = {} [CORRECT]
C. dict = ()
D. dict = set()

Geschreven voor

Instelling
WGU D522 – Python for IT Automation
Vak
WGU D522 – Python for IT Automation

Documentinformatie

Geüpload op
16 april 2026
Aantal pagina's
34
Geschreven in
2025/2026
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

$23.99
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
Drlima Chamberlain College Nursing
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
25
Lid sinds
1 jaar
Aantal volgers
0
Documenten
1229
Laatst verkocht
2 weken geleden
Drlima

Hi! ,I'mDrlima , a certified TeachMe2 Totur with over 5 helping University and college students succeed. I am a Verified Nursing Tutor specializing in Ihuman Case Studies, Advanced pharmacology (NR565), HESI, TEAS 7, Pediatrics and More, creating HIGH QUALITY,EXAM FOCUSED STUDY GUIDES. Every document is crafted to be clear, accurate, and easy understanding saving you study time and improving your grades. Whatever you are preparing for Hesi A2, NCLEX or University coursework ,my notes are trusted by hundreds of students like you. ✅ Backed by toturing experience. ✅ Organized by topic and exam need. ✅ Instant access and affordable pricing. Let's help you pass smarter ,not harder. Browse my store now !

Lees meer Lees minder
1.3

3 beoordelingen

5
0
4
0
3
0
2
1
1
2

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen