Skip to content
Pass Any WGU OA Exam Now & Pay After You Pass. Contact Us!
  1. Home
  2. WGU Exams
  3. WGU D335
  4. Set 2
WGU D335 · Introduction to Programming in Python

WGU D335 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 of the following is a valid way to create a list in Python?

Question 2 of 50

What does the pop() method do in Python?

Question 3 of 50

Which of the following statements about dictionaries in Python is true?

Question 4 of 50

What is the output of len([1, 2, 3, 4]) ?

Question 5 of 50

What is a tuple in Python?

Question 6 of 50

How can you check if a key exists in a dictionary?

Question 7 of 50

What is the result of 5 % 3 ?

Question 8 of 50

How do you create an empty dictionary in Python?

Question 9 of 50

What will be the result of print(3 * ‘abc’) ?

Question 10 of 50

What is the correct syntax for defining a set in Python?

Question 11 of 50

What is the purpose of the is operator in Python?

Question 12 of 50

How can you remove an element from a set in Python?

Question 13 of 50

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

Question 14 of 50

Which of the following can be used to generate a random number in Python?

Question 15 of 50

How do you access the value associated with a key in a dictionary?

Question 16 of 50

Which of the following methods can be used to split a string into a list?

Question 17 of 50

Which function converts a string to a floating-point number in Python?

Question 18 of 50

What is the default return value of a function that has no return statement?

Question 19 of 50

How can you check if a list is empty in Python?

Question 20 of 50

What is the difference between a list and a tuple in Python?

Question 21 of 50

How do you iterate over the keys in a dictionary in Python?

Question 22 of 50

What is the result of 5 == ‘5’ in Python?

Question 23 of 50

Which method can be used to add an element to a set?

Question 24 of 50

What is the result of 4 ** 2 in Python?

Question 25 of 50

How do you remove whitespace from both ends of a string in Python?

Question 26 of 50

What does the max() function return?

Question 27 of 50

How can you convert a list into a string in Python?

Question 28 of 50

Which of the following is a valid Python dictionary?

Question 29 of 50

What is the output of print(2 + 3 * 4) ?

Question 30 of 50

What is the correct syntax for defining a function in Python?

Question 31 of 50

What will be the output of print(bool(0)) in Python?

Question 32 of 50

What does the lower() method do in Python?

Question 33 of 50

How do you check if a list contains an element in Python?

Question 34 of 50

What is the result of len(‘hello’) ?

Question 35 of 50

What is the purpose of the elif statement in Python?

Question 36 of 50

How do you define a class in Python?

Question 37 of 50

Which method can be used to find the position of an element in a list?

Question 38 of 50

What will be the result of 2 + 2 == 4 in Python?

Question 39 of 50

What is the purpose of the for loop in Python?

Question 40 of 50

Which function converts a string to an integer in Python?

Question 41 of 50

What will be the output of print(‘hello’.upper()) ?

Question 42 of 50

What does the pass statement do in Python?

Question 43 of 50

What is the result of print(7 // 3) ?

Question 44 of 50

Which method is used to reverse a list in Python?

Question 45 of 50

How do you delete an element from a dictionary in Python?

Question 46 of 50

What will be the result of print(10 % 3) ?

Question 47 of 50

Which operator is used to check if two values are not equal in Python?

Question 48 of 50

How do you create a multi-line comment in Python?

Question 49 of 50

What is the purpose of the break statement in a loop?

Question 50 of 50

What is the result of 5 + 3 * 2 in Python?

Set 2 complete

You scored 0%

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

Next: Set 3

Struggling with WGU D335?

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