WGU D522 Python for IT Automation OBJECTIVE ASSESSMENT 2026 || Python for IT Automation (WGU D522) with 100% correct answers + detailed rationales

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/60

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 9:29 AM on 6/2/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

61 Terms

1
New cards

What are the traits of Imperative/procedural programming?

Focuses on describing a sequence of steps to perform a task

2
New cards

What are the traits of Object-Oriented Programming (OOP)?

Organize code around objects, which encapsulate data and behavior.

3
New cards

What are the traits of Functional Programming?

emphasizes the use of functions and immutable data for computation.

4
New cards

What are the traits of Declarative Programming?

describes what the program should accomplish without specifying how to achieve it.

5
New cards

What are the traits of Event-Driven Programming?

Reacts to events and user actions, triggering corresponding functions.

6
New cards

What are the traits of Logic Programming?

defines a set of logical conditions and lets the system deduce solutions.

7
New cards

What does Python syntax refer to?

The set of rules that dictate the combinations of symbols and keywords that form valid Python programs

8
New cards

What is the purpose of indentation in Python?

To define blocks of code

9
New cards

Why might a programmer use comments for 'Preventing Execution'?

To temporarily disable lines or blocks of code

10
New cards

What is the primary use of whitespace in Python?

To define the structure and hierarchy of the code

11
New cards

What does Python use to define the scope of control flow statements and structures like functions and classes?

Indentation

12
New cards

What is the purpose of the input() function in Python?

To capture user input and store it as a string

13
New cards

What does the format() method do in Python?

It enhances output formatting by embedding variables in strings. (although 'f' strings are easier to read)

14
New cards

What is the purpose of the Code Editor in a Python IDE?

To provide a text editor designed for Python, offering features like syntax highlighting, code completion, and indentation.

15
New cards

What does this built in Python function do?: print()

outputs text or variables to the console

16
New cards

What does this built in Python function do?: input()

reads user input from the console

17
New cards

What does this built in Python function do?: len()

determines the length of a sequence (string, list, tuple)

18
New cards

What does this built in Python function do?: type()

returns the type of an object

19
New cards

What does this built in Python function do?: int(), float(), str()

converts values to integers, floats, or strings; respectively

20
New cards

What does this built in Python function do?: max(), min()

returns the maximum or minimum value from a sequence

21
New cards

What does this built in Python function do?: sum()

calculates the sum of elements in a sequence

22
New cards

What does this built in Python function do?: abs()

returns the absolute value of a number

23
New cards

What does this built in Python function do?: range()

generates a sequence of numbers

24
New cards

What does this built in Python function do?: sorted()

returns a sorted list from an iterable

25
New cards

What does this built in Python function do?: any(), all()

checks if any or all elements in an iterable are true

26
New cards

What does this built in Python function do?: map(), filter()

applies a function to elements or filters elements based on a function

27
New cards

What does this built in Python function do?: open(), read(), write()

handles file I/O operations

28
New cards

What does this built in Python function do?: dir()

lists the names in the current scope or attributes of an object

29
New cards

What does this built in Python function do?: help()

provides help information about an object or Python

30
New cards

What is the primary characteristic of Python variables?

Variables are created as soon as a value is assigned to them.

31
New cards

What are the 5 Variable name rules in Python?

1. can only contain letters, numbers, or an underscore.

2. MUST start with either a letter or underscore

3. Cannot start with a number

4. Cannot contain special characters.

5. Cannot be a Python keyword (such as: and, as, def, else, etc)

32
New cards

What are the 3 common naming conventions used in Python, and what is their format?

Camel case: each word, except for the first word, starts with a capital letter

Pascal case: each word starts with a capital letter

Snake case: each word in the variable is separated by an underscore.

33
New cards

What happens if the number of variables is not equal to the number of values in a Python assignment statement?

An error will occur

34
New cards

What does unpacking involve in Python?

Extracting elements from iterable objects and assigning them to individual variables

35
New cards

What is the result of using the '+' operator to output multiple Python variables of different types?

A Python error occurs. (must use variables of the same type)

36
New cards

How can multiple Python variables of different types be output using the print() function?

By separating each variable with a comma

37
New cards

What is the scope of a variable that is defined inside a function in Python?

Local Scope

38
New cards

How can a global variable be created inside a function in Python?

By declaring the variable with the 'global' keyword

39
New cards

What is a characteristic of Python as a dynamically-typed language?

The interpreter determines the type of variable during runtime

40
New cards

Which Python data type represents an ordered, mutable sequence?

'list'

41
New cards

What are the 3 sequence types in Python? what do they represent/look like?

list: Ordered, mutable sequence; [1,23]

tuple: Ordered, immutable sequence; (1,2,3)

range: represents a range of values; e.g. range(5)

42
New cards

What are the characteristics of a set?

Unordered, mutable collection of unique elements. {1,2,3}

43
New cards

what is a dictionary mapping type?

an unordered collection of key-value pairs.

my_dict = {'key':'value', 'name':'John'}

44
New cards

What happens when an operation is performed that involves both an int and a float in Python?

the result is automatically promoted to a 'float'

45
New cards

What does the 'round(x, n) function do in Python?

it rounds 'x' to 'n' decimal places

46
New cards

What are the two main escape characters?

\n : new line

\t : for a tab

47
New cards

What are the 3 components of a string slice?

string [start:stop:step]

· Start: the index from which the slicing begins (inclusive)

· Stop: the index at which the slicing ends (exclusive)

· Step (optional): The step or stride between characters.

48
New cards

What does the string slicing operation 'text {::-1] do where text = "Hello, Python!"?

It reverses the string.

The 'step' portion of the slice is negative, indicating the stride between characters is reversed.

49
New cards

What does the 'strip()' method do in Python?

It removes leading and trailing whitespaces from a string

50
New cards

what does the += operator do in Python string manipulation?

It is used as a shorthand for concatenation and assignment

51
New cards

What are truthy and falsy values in Python?

Truthy values are non-zero numbers and non-empty strings.

Falsy values are zero, None, and empty strings

52
New cards

What is the purpose of the // operator in Python?

It performs floor division operation;

performs division and rounds down to the nearest whole number and discards the decimal part

53
New cards

What is the purpose of the modulus operation '%' in Python?

It returns the remainder of the division of two numbers.

54
New cards

What does the arithmatic operator **= do?

It take the exponent of the value applied to it.

55
New cards

Consider the following Python code:

colors = ['red', 'blue', 'green'] colors.insert(1, 'yellow')

What will be the value of colors after executing this code?

['red', 'yellow', 'blue', 'green']

when using the .insert(), it doesn't replace the value in that position, it inserts into that place.

56
New cards

When would I use extend() vs append()?

extend() is used for adding multiple values from an iterable

append() is used for adding a single element to the end (even if it's a list)

my_list = [1, 2, 3] my_list.append([4, 5]) # Appending a list as a single element

print(my_list) # Output: [1, 2, 3, [4, 5]]

57
New cards

What does the pop() method do?

It removes an item at the specified index position.

example:

devices = ['router1', 'switch2', 'firewall3']

removed_device = devices.pop(1)

This removes 'switch2' from devices since it is in index 1 position, and now it added to "removed_device.

58
New cards

What is a 'shallow copy' of a list in Python?

A copy of the list where changes to the copied list do not affect the original list.

59
New cards

What is the difference between using the '+' operator and the 'extend()' method to concatenate lists in Python?

The '+' operator creates a new list, while the 'extend()' method adds elements to the end of the original list.

60
New cards

What is a significant advantage of using tuples in Python for storing information about network devices?

tuples can be used as keys in dictionaries due to their immutability.

61
New cards

How are items in a tuple accessed?

By placing the index of the item inside square brackets [] after the tuple name