Skip to content
Pass Any WGU OA Exam Now & Pay After You Pass. Contact Us!
  1. Home
  2. WGU Exams
  3. WGU D522
  4. Set 2
WGU D522 · Python for IT Automation

WGU D522 Practice Questions – Set 2

50 multiple-choice questions with answers and detailed explanations. Untimed — choose an answer to check it instantly.

Question 1 of 50

Which Python function can be used to return the absolute value of a number?

Question 2 of 50

What will be the result of the following code snippet?

x = 10

y = 5

print(x // y)

Question 3 of 50

What is the output of the following Python code?

print(“Hello”[1])

Question 4 of 50

What will be the output of this code?

print(2 ** 3)

Question 5 of 50

Which Python function is used to read input from the user?

Question 6 of 50

What is the result of this expression?

result = “Python” + “3”

print(result)

Question 7 of 50

What does the following Python code return?

len([1, 2, 3, 4, 5])

Question 8 of 50

What does the following code return?

name = “Alice”

print(name.upper())

Question 9 of 50

What does this code do?

numbers = [1, 2, 3]

numbers.append(4)

print(numbers)

Question 10 of 50

What will be the result of this Python code?

x = 5

y = 10

x, y = y, x

print(x, y)

Question 11 of 50

What does this code return?

print(10 % 3)

Question 12 of 50

What is the correct way to define a function in Python?

Question 13 of 50

What does this code output?

print(type(5.0))

Question 14 of 50

What will this code return?

list1 = [1, 2, 3]

list2 = list1

list2.append(4)

print(list1)

Question 15 of 50

What is the output of this code?

print(bool(0))

Question 16 of 50

What is the result of this Python code?

print(2 * 3 ** 2)

Question 17 of 50

Which of the following is the correct syntax for a comment in Python?

Question 18 of 50

What will this code output?

name = “Bob”

print(name * 3)

Question 19 of 50

What will the following Python code return?

print(bool(“False”))

Question 20 of 50

Which of the following data types is immutable in Python?

Question 21 of 50

What will be the output of this code?

numbers = [1, 2, 3, 4, 5]

print(numbers[-1])

Question 22 of 50

What is the output of the following Python code?

x = [1, 2, 3]

y = [1, 2, 3]

print(x is y)

Question 23 of 50

What does the following code return?

print(2 in [1, 2, 3])

Question 24 of 50

What will this Python code output?

x = “Python”

print(x[2:])

Question 25 of 50

What will this code output?

print(type([1, 2, 3]))

Question 26 of 50

Which of the following is a valid Python variable name?

Question 27 of 50

What does this Python code do?

my_dict = {“name”: “Alice”, “age”: 25}

print(my_dict[“name”])

Question 28 of 50

What is the result of this Python code?

print(“Hello”.lower())

Question 29 of 50

What will the following code output?

print(3 * ‘A’)

Question 30 of 50

What does the following code return?

print(type((1, 2, 3)))

Question 31 of 50

What will be the output of this code?

print(“Python”[::-1])

Question 32 of 50

What will this Python code output?

for i in range(3):

print(i, end=”, “)

Question 33 of 50

What does this Python code do?

x = [1, 2, 3]

y = x.copy()

y.append(4)

print(x)

Question 34 of 50

Which operator is used to concatenate strings in Python?

Question 35 of 50

What will be the output of this code?

print(10 / 4)

Question 36 of 50

What will this Python code return?

fruits = [“apple”, “banana”, “cherry”]

fruits.insert(1, “orange”)

print(fruits)

Question 37 of 50

What will be the result of this Python code?

x = [1, 2, 3]

x.remove(2)

print(x)

Question 38 of 50

What does this Python code return?

print(type({1, 2, 3}))

Question 39 of 50

What is the result of this Python expression?

x = “123”

print(x.isdigit())

Question 40 of 50

What will this Python code return?

print([1, 2, 3] + [4, 5, 6])

Question 41 of 50

What does this Python code output?

print(“Hello”.replace(“l”, “r”))

Question 42 of 50

What is the result of this code?

print([1, 2, 3] * 2)

Question 43 of 50

What will be the result of this Python code?

numbers = [1, 2, 3, 4, 5]

print(numbers[1:3])

Question 44 of 50

What will this Python code return?

x = [“apple”, “banana”, “cherry”]

x.pop(1)

print(x)

Question 45 of 50

What does the following Python code output?

for i in range(1, 6):

if i == 3:

continue

print(i, end=” “)

Question 46 of 50

What does this code return?

print([i**2 for i in range(3)])

Question 47 of 50

What does this Python code return?

print(5 == 5.0)

Question 48 of 50

What does the following Python code return?

print(“,”.join([“a”, “b”, “c”]))

Question 49 of 50

What will this code output?

print({1, 2, 3}.union({3, 4}))

Question 50 of 50

What will the following Python code output?

print(type(range(5)))

Set 2 complete

You scored 0%

0 correct out of 0 answered (50 questions in this set).

Next: Set 3

Struggling with WGU D522?

If this exam is giving you a hard time, let us be your helping hand. Contact us, and we'll provide the assistance you need to pass and move forward.

Chat Now