Foundations of Programming (Python) - E010 JIV1 온라인 연습
최종 업데이트 시간: 2026년05월15일
당신은 온라인 연습 문제를 통해 WGU Foundations of Programming Python 시험지식에 대해 자신이 어떻게 알고 있는지 파악한 후 시험 참가 신청 여부를 결정할 수 있다.
시험을 100% 합격하고 시험 준비 시간을 35% 절약하기를 바라며 Foundations of Programming Python 덤프 (최신 실제 시험 문제)를 사용 선택하여 현재 최신 60개의 시험 문제와 답을 포함하십시오.
정답:
Explanation:
In Python, a single-line comment begins with the # symbol.
Example:
# This is a comment print("Hello")
Python ignores the comment when the program runs. The Python documentation identifies # as the symbol used for comments.
Therefore, the correct answer is B. # pound symbol.
정답:
Explanation:
In Python, iterating directly over a dictionary gives itskeys. In this dictionary, the keys are:
'apple'
'banana'
'orange'
To update each price, the program can loop through each key and use that key to access and change the corresponding value.
Correct code:
prices = {'apple': 1.50, 'banana': 0.75, 'orange': 2.00}
for item in prices:
prices[item] = prices[item] + 0.25
print(prices)
Output:
{'apple': 1.75, 'banana': 1.0, 'orange': 2.25}
Option B is incorrect because value actually receives each dictionary key, not each dictionary value.
Also, assigning to value would not update the dictionary.
Option C is incorrect because item is not defined, and the loop structure is invalid for this task.
정답:
Explanation:
To update the actual values inside a list, the program must update each value by itsindex.
The correct code is:
for i in range(len(numbers)):
numbers[i] = numbers[i] + 5
Here, range(len(numbers)) produces valid index positions for the list. The variable i is used to access and update each list element.
Example:
numbers = [10, 20, 30]
for i in range(len(numbers)):
numbers[i] = numbers[i] + 5
print(numbers)
Output:
[15, 25, 35]
Option A does not correctly update the original list:
for number in numbers:
number = number + 5
This changes only the temporary loop variable number, not the actual elements stored inside the list.
Therefore, the correct answer is B.
정답:
Explanation:
The loop condition is:
while count > 0:
At the start, count is 5, so the condition is true. The program prints the value of count.
However, inside the loop, the value of count is never changed. That means count always stays 5, so the condition count > 0 is always true. As a result, the loop runs forever.
A corrected version would be:
count = 5
while count > 0:
print(count)
count = count - 1
This decreases count by 1 during each loop iteration. Eventually, count becomes 0, and the condition count > 0 becomes false.
Therefore, the correct answer is B. It runs infinitely because count is never modified.
정답:
Explanation:
Python strings are sequences, and sequence values can be accessed using indexing and slicing.
The first character in a Python string has index 0. To extract the first four characters from 'computer', the slice should start at index 0 and stop at index 4.
Example:
'computer'[0:4]
Result:
'comp'
In Python slicing, the start index is included, but the stop index is excluded. So [0:4] includes characters at indexes 0, 1, 2, and 3.
The official Python documentation explains that slicing with a[start:stop] selects items from the start index up to, but not including, the stop index.
Therefore, the correct answer is A. 'computer'[0:4].
정답:
Explanation:
The string method join() combines the strings in an iterable using the string before .join() as the separator.
In this question, the separator is an empty string:
''.join(['Hello', 'World'])
Because the separator is empty, Python joins 'Hello' and 'World' directly together with no space or comma between them.
Result:
'HelloWorld'
The official Python documentation defines str.join() as returning a string made by joining the strings in the given iterable.
Therefore, the correct answer is B. 'HelloWorld'.
정답:
Explanation:
To run a Python script from a text editor using the terminal on Windows, the file should first be saved with the .py extension. Then, the terminal is opened, and the script is executed using the Python command followed by the filename.
Example:
python filename.py
The official Python documentation explains that when the interpreter is called with a filename argument, it reads and executes the script from that file. On Windows, the python command can be used from a terminal after Python is installed and configured correctly.
Therefore, the correct answer is A. Save file > open terminal > type python filename.py.
정답:
Explanation:
When the command python is entered in a terminal without a filename, Python starts aninteractive Python session, also called interactive mode.
In interactive mode, Python displays the primary prompt:
>>>
The user can then type Python statements directly, such as:
>>> 2 + 3
5
The official Python documentation explains that when commands are read from a terminal, the interpreter is in interactive mode and prompts for the next command.
Python does not automatically run the most recent file, open a file browser, or necessarily display an error when started this way.
Therefore, the correct answer is C. An interactive Python session starts.
정답:
Explanation:
In a Python development environment, clicking theRunbutton generally executes the currently open Python script or selected code.
For example, if the current script contains:
print("Hello, Python!")
clickingRunexecutes the script and displays the output:
Hello, Python!
In Python’s IDLE environment, theRun Modulecommand runs the current module. The Python documentation describes IDLE as Python’s editor and shell and includes a Run menu for running Python code.
The Run button does not simply open a file browser, save the file without execution, or convert Python code into another programming language.
Therefore, the correct answer is B. The currently open Python script is executed.
정답:
Explanation:
Jupyter Notebook works as acell-based interactive coding platform. A notebook is made up of cells, and code can be written and executed inside those cells.
For example, a code cell may contain:
x = 10
print(x)
When the cell is run, the output appears directly below the cell.
The Jupyter Notebook documentation explains that notebooks consist of a sequence of cells, and the contents of a cell can be executed using keyboard shortcuts or the toolbar button.
Jupyter Notebook is not simply a command-line terminal replacement, not limited to static text
editing, and not mainly a framework for compiling Python into standalone applications.
Therefore, the correct answer is B. Cell-based interactive coding platform.
정답:
Explanation:
A terminal-based Python environment uses atext-based command line interface. In this environment, the user types commands directly into a terminal or command prompt.
For example, a user may start Python by typing:
python
When Python is started from a terminal, the interpreter can run in interactive mode, where it displays prompts such as >>> and waits for the user to enter Python commands. The official Python documentation explains that when commands are read from a terminal, the interpreter is in interactive mode.
A terminal-based environment is not mainly identified by graphical user interface elements, internet connectivity, or automatic file saving.
Therefore, the correct answer is C. Text-based command line interface.
정답:
Explanation:
A set is a Python data structure that stores only unique elements. This means duplicate values are automatically removed.
Example:
numbers = {1, 2, 2, 3}
print(numbers)
Output:
{1, 2, 3}
The duplicate value 2 appears only once in the set.
Sets are also unordered, so they do not support indexing like lists or tuples do. For example, numbers[0] would cause an error because sets are not accessed by position.
The official Python documentation describes sets as unordered collections with no duplicate elements.
Therefore, the correct answer is D. Set.
정답:
Explanation:
A list is a Python data structure that can store multiple values. Lists can contain duplicate values, and they support methods such as append() and remove().
Example:
fruits = ["apple", "banana", "apple"]
fruits.append("orange")
fruits.remove("banana")
print(fruits)
Output:
['apple', 'apple', 'orange']
The value "apple" appears more than once, showing that lists allow duplicates.
The official Python documentation lists list.append() as a method that adds an item to the end of a list and list.remove() as a method that removes the first matching value from a list.
Therefore, the correct answer is C. List.
정답:
Explanation:
In Python, an if statement line must end with a colon.
Example:
age = 18
if age >= 18:
print("Adult")
The colon : tells Python that an indented block of code follows. That indented block contains the statements that should run when the condition is true.
A semicolon, period, or comma is not used to begin the body of an if statement in Python.
Therefore, the correct answer is B. : colon.
정답:
Explanation:
The Python keyword continue is used inside a loop to skip the rest of the current iteration and move immediately to the next iteration.
Example:
for number in range(5):
if number == 2:
continue
print(number)
Output:
0
1
3
4
When number is 2, the continue statement skips print(number) for that iteration and moves to the next loop cycle.
The official Python documentation states that the continue statement continues with the next iteration of the loop.
Therefore, the correct answer is C. continue.