Skip to main content

Foundations-of-Programming-Python Foundations of Programming (Python) - E010 JIV1

  • WGU
  • 5 free sample questions

About this exam

Foundations-of-Programming-Python is the WGU exam Foundations of Programming (Python) - E010 JIV1. Paid practice material for this exam is not available yet, but you can try its free sample questions.

Exam code
Foundations-of-Programming-Python
Vendor
WGU
Practice questions
Not available yet
Free sample questions
5
Question bank last updated
Not available yet

Try 2 sample questions

Taken from the free sample set for Foundations-of-Programming-Python.

Question 1

Which components are required in every Python for loop?

  1. Option A:
    A variable, an iterable, and an indented code block
  2. Option B:
    A condition, a counter, and a break statement
  3. Option C:
    A function call, a parameter, and a return value
  4. Option D:
    A list index, a range limit, and a step value 
Show answer and explanation

Correct answer: A

A Python for loop is used to iterate over an iterable object, such as a list, tuple, string, dictionary, set, or range() object. A basic for loop needs: A loop variable An iterable object An indented code block 
Example: for number in range(3): print(number) In this example: number is the loop variable. range(3) is the iterable. print(number) is the indented code block that runs during each loop iteration. According to the official Python documentation, the for statement is a construct that works with iterable objects. Therefore, the correct answer is A. A variable, an iterable, and an indented code block. 

Question 2

What determines which lines of code are executed when the condition is true in a Python if statement?

  1. Option A:
    Lines that are enclosed in parentheses
  2. Option B:
    Lines that share the same indentation level
  3. Option C:
    Lines that end with semicolons
  4. Option D:
    Lines that are enclosed in square brackets 
Show answer and explanation

Correct answer: B

In Python, indentation determines which statements belong to an if block. Example: temperature = 30 
if temperature > 25: print("It is warm.") print("Drink water.") Both print() statements are executed when the condition is true because they share the same indentation level under the if statement. Python does not use parentheses, semicolons, or square brackets to define the body of an if statement. It uses indentation. Therefore, the correct answer isB. Lines that share the same indentation level. 
See all 5 free sample questions