Garantie de satisfaction à 100% Disponible immédiatement après paiement En ligne et en PDF Tu n'es attaché à rien 4.2 TrustPilot
logo-home
Examen

WGU D522 Objective Assessment | Python for IT Automation | ACTUAL EXAM | Questions & Verified Answers | Latest 2025 / 2026 Update – Western Governors University

Note
-
Vendu
-
Pages
47
Grade
A+
Publié le
10-12-2025
Écrit en
2025/2026

WGU D522 Objective Assessment | Python for IT Automation | ACTUAL EXAM | Questions & Verified Answers | Latest 2025 / 2026 Update – Western Governors University

Établissement
WGU D522
Cours
WGU D522











Oups ! Impossible de charger votre document. Réessayez ou contactez le support.

École, étude et sujet

Établissement
WGU D522
Cours
WGU D522

Infos sur le Document

Publié le
10 décembre 2025
Nombre de pages
47
Écrit en
2025/2026
Type
Examen
Contient
Questions et réponses

Sujets

Aperçu du contenu

WGU D522 Objective Assessment | Python for IT
Automation | ACTUAL EXAM | Questions & Verified
Answers | Latest Update – Western
Governors University

1.​ Which Python data type is best suited for storing a fixed collection of unique IP-address

strings that must remain immutable throughout the script?


A. list


B. set


C. tuple


D. dict


Correct Answer: C


Rationale: A tuple (C) is immutable and can hold unique strings; using it prevents accidental
mutation and conveys intent that the collection should not change. A list (A) is mutable and
allows duplicates. A set (B) is mutable and unordered, making it unsuitable when order must be
preserved. A dict (D) is mutable and keyed, which is unnecessary for a simple collection.


2.​ What is the output of the following snippet?​

print(type(lambda x: x * 2))

,A. <class 'function'>


B. <class 'lambda'>


C. <class 'method'>


D. <class 'int'>


Correct Answer: A


Rationale: In Python a lambda expression creates an anonymous function object whose runtime
type is function (A). There is no separate lambda type (B). It is neither a bound method (C) nor
an integer (D).


3.​ Which statement accurately describes the difference between a Python module and a

package?


A. A module is a single .py file; a package is a directory containing an init.py file and possibly
sub-modules.


B. A module can contain multiple packages; a package cannot contain modules.


C. There is no difference; the terms are interchangeable.


D. A package must be compiled before use, whereas a module is interpreted.


Correct Answer: A

,Rationale: A module is indeed a single file (A), while a package is a directory with an init.py
marker that can contain sub-modules or sub-packages. Option B reverses the relationship. Option
C is false. Option D confuses packages with compiled extensions.


4.​ Which exception will be raised if subprocess.run(['ping', '-c', '1',

'192.168.1.1'], check=True) receives no reply from the target?


A. ConnectionError


B. subprocess.CalledProcessError


C. TimeoutError


D. OSError


Correct Answer: B


Rationale: When check=True the shell return-code becomes an exception; ping returns

non-zero on no reply, raising CalledProcessError (B). ConnectionError (A) is for

sockets. TimeoutError (C) requires a timeout parameter. OSError (D) is too generic and

not triggered here.


5.​ Which re pattern correctly matches an IPv4 dotted-quad address in a log line?



A. r'\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}'


B. r'[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}'

, C. r'\d+.\d+.\d+.\d+'


D. r'(\d{1,3}.){3}\d{1,3}'


Correct Answer: D


Rationale: Pattern D groups three repetitions of digits followed by a dot and then a final digit
group, efficiently matching dotted quads. A and B are verbose but correct; D is more compact. C
is too greedy and could match invalid lengths.


6.​ Which pathlib method returns a new Path object with the file suffix changed?



A. with_suffix()


B. suffix()


C. rename()


D. replace_suffix()


Correct Answer: A


Rationale: Path.with_suffix('.new') (A) returns a new Path object with the extension

altered without renaming the file itself. suffix (B) is a read-only property. rename() (C)

moves/renames the actual file. There is no replace_suffix() (D).



7.​ What is the purpose of if __name__ == '__main__': in a Python automation

script?
€12,72
Accéder à l'intégralité du document:

Garantie de satisfaction à 100%
Disponible immédiatement après paiement
En ligne et en PDF
Tu n'es attaché à rien

Faites connaissance avec le vendeur
Seller avatar
TommyRicks

Faites connaissance avec le vendeur

Seller avatar
TommyRicks Chamberlain College Of Nursing
S'abonner Vous devez être connecté afin de suivre les étudiants ou les cours
Vendu
Nouveau sur Stuvia
Membre depuis
3 semaines
Nombre de followers
0
Documents
280
Dernière vente
-
TommyRicks

One stop shop for all all study materials, Study guides,Exams and all assignments and homeworks.

0,0

0 revues

5
0
4
0
3
0
2
0
1
0

Récemment consulté par vous

Pourquoi les étudiants choisissent Stuvia

Créé par d'autres étudiants, vérifié par les avis

Une qualité sur laquelle compter : rédigé par des étudiants qui ont réussi et évalué par d'autres qui ont utilisé ce document.

Le document ne convient pas ? Choisis un autre document

Aucun souci ! Tu peux sélectionner directement un autre document qui correspond mieux à ce que tu cherches.

Paye comme tu veux, apprends aussitôt

Aucun abonnement, aucun engagement. Paye selon tes habitudes par carte de crédit et télécharge ton document PDF instantanément.

Student with book image

“Acheté, téléchargé et réussi. C'est aussi simple que ça.”

Alisha Student

Foire aux questions