Docsity

WGU E010 Foundations of Programming (Python) Practice Assessment | Objective Assessment |, Exams of Java Programming

Toggle sidebar
bg1
A+
WGU E010 Foundations of Programming (Python) Practice
Assessment | Objective Assessment | Questions and Verified
Solutions | Latest Update
Question: Answer:
WGU E010 Foundations of Programming (Python) Practice
Assessment
29 studiers today Leave the first rating
Play your way to mastery with fun games
Students also studied
Terms in this set (30)
Western Governors University D 413
Match Blocks Charms NEW
Flashcard sets Study guides
WGU E010 Foundations of Program...
Teacher 30 terms
Kiliih_Senior
Preview
Python for IT Automation - D522 PA ...
39 terms
reedvahle
E010 Python questions
95 terms
networkbret
Preview
WGU -
161 terms
Chr
Which symbol begins a single-line comment in Python?
// (double forward slash)
# (pound symbol)
* (asterisk)
% (percent symbol)
# (pound symbol)
Which data type is the value 3.14 in Python?
Integer
Float
String
Boolean
Float
10/6/26, 2:41 PM
WGU E010 Foundations of Programming (Python) Practice Assessment Flashcards | Quizlet
https://quizlet.com/1168128748/wgu-e010-foundations-of-programming-python-practice-assessment-flash-cards/
1/7
Question: Answer:
WGU E010 Foundations of Programming (Python) Practice
Assessment
29 studiers today Leave the first rating
Play your way to mastery with fun games
Students also studied
Terms in this set (30)
Western Governors University D 413
Match Blocks Charms NEW
Flashcard sets Study guides
WGU E010 Foundations of Program...
Teacher 30 terms
Kiliih_Senior
Preview
Python for IT Automation - D522 PA ...
39 terms
reedvahle
E010 Python questions
95 terms
networkbret
Preview
WGU -
161 terms
Chr
Which symbol begins a single-line comment in Python?
// (double forward slash)
# (pound symbol)
* (asterisk)
% (percent symbol)
# (pound symbol)
Which data type is the value 3.14 in Python?
Integer
Float
String
Boolean
Float
10/6/26, 2:41 PM
WGU E010 Foundations of Programming (Python) Practice Assessment Flashcards | Quizlet
https://quizlet.com/1168128748/wgu-e010-foundations-of-programming-python-practice-assessment-flash-cards/
1/7
Question: Answer:
In Python, what must follow the in keyword in a for loop?
A condition
An iterable object
A number
A variable name
An iterable object
Which type of loop is designed for iterating a specific
number of times?
while loop
for loop
infinite loop
do-while loop
for loop
Which components are required in every Python while
loop?
A condition and an indented code block
A variable and a return statement
A counter and a break statement
An iterator and a list
A condition and an indented code block
Which keyword is used to exit a loop prematurely in
Python?
return
break
stop
end
break
In the code for item in my_list:, what does item represent?
The index of the current element
The current element being processed
The length of the list
The entire list
The current element being processed
Which Python data structure automatically prevents
duplicate values from being stored?
List
Tuple
Dictionary
Set
Set
10/6/26, 2:41 PM
WGU E010 Foundations of Programming (Python) Practice Assessment Flashcards | Quizlet
https://quizlet.com/1168128748/wgu-e010-foundations-of-programming-python-practice-assessment-flash-cards/
2/7
Question: Answer:
In Python, what must follow the in keyword in a for loop?
A condition
An iterable object
A number
A variable name
An iterable object
Which type of loop is designed for iterating a specific
number of times?
while loop
for loop
infinite loop
do-while loop
for loop
Which components are required in every Python while
loop?
A condition and an indented code block
A variable and a return statement
A counter and a break statement
An iterator and a list
A condition and an indented code block
Which keyword is used to exit a loop prematurely in
Python?
return
break
stop
end
break
In the code for item in my_list:, what does item represent?
The index of the current element
The current element being processed
The length of the list
The entire list
The current element being processed
Which Python data structure automatically prevents
duplicate values from being stored?
List
Tuple
Dictionary
Set
Set
10/6/26, 2:41 PM
WGU E010 Foundations of Programming (Python) Practice Assessment Flashcards | Quizlet
https://quizlet.com/1168128748/wgu-e010-foundations-of-programming-python-practice-assessment-flash-cards/
2/7
pf3
pf4
pf5
pf8

Partial preview of the text

Download WGU E010 Foundations of Programming (Python) Practice Assessment | Objective Assessment | and more Exams Java Programming in PDF only on Docsity!

A+

WGU E010 Foundations of Programming (Python) Practice

Assessment | Objective Assessment | Questions and Verified

Solutions | Latest Update

Question: Answer:

Terms in this set (30)

Flashcard sets Study guides

WGU E010 Foundations of Program... Teacher 30 terms

Kiliih_Senior (^) Preview

Python for IT Automation - D522 PA ... 39 terms

reedvahle (^) Preview

E010 Python questions 95 terms

networkbret (^) Preview

WGU -

161 terms

Chr

Which symbol begins a single-line comment in Python? // (double forward slash)

(pound symbol)

  • (asterisk) % (percent symbol)

(pound symbol)

Which data type is the value 3.14 in Python? Integer Float String Boolean

Float

https://quizlet.com/1168128748/wgu-e010-foundations-of-programming-python-practice-assessment-flash-cards/ 1/

Question: Answer:

Students also studied

Terms in this set (30)

Flashcard sets Study guides

WGU E010 Foundations of Program... Teacher 30 terms

Kiliih_Senior (^) Preview

Python for IT Automation - D522 PA ... 39 terms

reedvahle (^) Preview

E010 Python questions 95 terms

networkbret (^) Preview

WGU -

161 terms

Chr

Which symbol begins a single-line comment in Python? // (double forward slash)

(pound symbol)

  • (asterisk) % (percent symbol)

(pound symbol)

Which data type is the value 3.14 in Python? Integer Float String Boolean

Float

https://quizlet.com/1168128748/wgu-e010-foundations-of-programming-python-practice-assessment-flash-cards/ 1/

Question: Answer:

In Python, what must follow the in keyword in a for loop? A condition An iterable object A number A variable name

An iterable object

Which type of loop is designed for iterating a specific number of times? while loop for loop infinite loop do-while loop

for loop

Which components are required in every Python while loop? A condition and an indented code block A variable and a return statement A counter and a break statement

A condition and an indented code block

10/6/26, 2:41 PM WGU E010 Foundations of Programming (Python) Practice Assessment Flashcards | Quizlet

Question: Answer:

In Python, what must follow the in keyword in a for loop? A condition An iterable object A number A variable name

An iterable object

Which type of loop is designed for iterating a specific number of times? while loop for loop infinite loop do-while loop

for loop

Which components are required in every Python while loop? A condition and an indented code block A variable and a return statement A counter and a break statement An iterator and a list

A condition and an indented code block

Which keyword is used to exit a loop prematurely in Python? return break stop

break

10/6/26, 2:41 PM WGU E010 Foundations of Programming (Python) Practice Assessment Flashcards | Quizlet

Question: Answer:

number of times? while loop for loop infinite loop do-while loop

Which components are required in every Python while loop? A condition and an indented code block A variable and a return statement A counter and a break statement An iterator and a list

A condition and an indented code block

Which keyword is used to exit a loop prematurely in Python? return break stop end

break

In the code for item in my_list:, what does item represent? The index of the current element The current element being processed The length of the list The entire list

The current element being processed

Which Python data structure automatically prevents duplicate values from being stored? List Tuple Dictionary Set

Set

https://quizlet.com/1168128748/wgu-e010-foundations-of-programming-python-practice-assessment-flash-cards/ 2/

Question: Answer:

Which type of loop is designed for iterating a specific number of times? while loop for loop infinite loop do-while loop

for loop

Which components are required in every Python while loop? A condition and an indented code block A variable and a return statement A counter and a break statement An iterator and a list

A condition and an indented code block

Which keyword is used to exit a loop prematurely in Python? return break stop end

break

In the code for item in my_list:, what does item represent? The index of the current element The current element being processed The length of the list The entire list

The current element being processed

Which Python data structure automatically prevents duplicate values from being stored? List Tuple Dictionary Set

Set

https://quizlet.com/1168128748/wgu-e010-foundations-of-programming-python-practice-assessment-flash-cards/ 2/

Question: Answer:

Which type of loop is designed for iterating a specific number of times? while loop for loop infinite loop do-while loop

for loop

Which components are required in every Python while loop? A condition and an indented code block A variable and a return statement A counter and a break statement An iterator and a list

A condition and an indented code block

Which keyword is used to exit a loop prematurely in Python? return break stop end

break

In the code for item in my_list:, what does item represent? The index of the current element The current element being processed The length of the list The entire list

The current element being processed

Which Python data structure automatically prevents duplicate values from being stored? List Tuple Dictionary Set

Set

https://quizlet.com/1168128748/wgu-e010-foundations-of-programming-python-practice-assessment-flash-cards/ 2/

Question: Answer:

Which type of loop is designed for iterating a specific number of times? while loop for loop infinite loop do-while loop

for loop

Which components are required in every Python while loop? A condition and an indented code block A variable and a return statement A counter and a break statement An iterator and a list

A condition and an indented code block

Which keyword is used to exit a loop prematurely in Python? return break stop end

break

In the code for item in my_list:, what does item represent? The index of the current element The current element being processed The length of the list The entire list

The current element being processed

Which Python data structure automatically prevents duplicate values from being stored? List Tuple Dictionary Set

Set

https://quizlet.com/1168128748/wgu-e010-foundations-of-programming-python-practice-assessment-flash-cards/ 2/

Question: Answer:

Which Python data structure cannot be modified after creation? List Dictionary Tuple Set

Tuple

What must a developer do to run Python code written in a text editor? Save the file and use a Python interpreter. Press a run button within the editor. Upload the code to a web server. Convert the code to machine language first.

Save the file and use a Python interpreter.

What advantage does an integrated terminal provide compared to using a separate terminal application? Faster code execution speed Access to additional Python libraries

Eliminates need to switch between applications

10/6/26, 2:41 PM WGU E010 Foundations of Programming (Python) Practice Assessment Flashcards | Quizlet

Question: Answer:

A program processes file names and extracts the last 3 characters representing the file extension. For example, files 'document.pdf' and 'image.png' would return 'pdf' and 'png', respectively. Which slicing approach would work for either of the provided files? filename[:9] filename[9:] filename[-3:] filename[:-3]

filename[-3:]

Which index position is returned when the string method .find('python') is applied to the string 'learning python programming'? 8 9 1 2

Complete the function add_item(numeric_list, new_number) that takes a list of numbers and a new number, and returns a new list that appends the new number to the end of the list. For example, add_item([1, 2, 3], 4) should return [1, 2, 3, 4].

def add_item(numeric_list, new_number):

TODO: Add new_number to the end of the list and

return the list

Example: add_item([1, 2, 3], 4) should return [1, 2, 3, 4]

pass

def add_item(numeric_list, new_number): numeric_list.append(new_number) return numeric_list

Complete the function update_grade(grades, student, new_grade) that takes a grades dictionary, a student name, and a new grade, then updates that student's grade and returns the dictionary.

For example, update_grade({"Alice": 85, "Bob": 90}, "Alice",

  1. should return {"Alice": 95, "Bob": 90}.

def update_grade(grades, student, new_grade):

TODO: Update the student's grade and return the

dictionary

Example: update_grade({"Alice": 85, "Bob": 90}, "Alice",

should return {"Alice": 95, "Bob": 90}

pass

def update_grade(grades, student, new_grade): grades[student] = new_grade return grades

Which for loop correctly iterates through a list of student names?

for name in ['Alice', 'Bob', 'Carol']: for name with ['Alice', 'Bob', 'Carol']: for name from ['Alice', 'Bob', 'Carol']: for name = ['Alice', 'Bob', 'Carol']

for name in ['Alice', 'Bob', 'Carol']:

10/6/26, 2:41 PM WGU E010 Foundations of Programming (Python) Practice Assessment Flashcards | Quizlet

Question: Answer:

A program processes file names and extracts the last 3 characters representing the file extension. For example, files 'document.pdf' and 'image.png' would return 'pdf' and 'png', respectively. Which slicing approach would work for either of the provided files? filename[:9] filename[9:] filename[-3:] filename[:-3]

filename[-3:]

Which index position is returned when the string method .find('python') is applied to the string 'learning python programming'? 8 9 1 2

Complete the function add_item(numeric_list, new_number) that takes a list of numbers and a new number, and returns a new list that appends the new number to the end of the list. For example, add_item([1, 2, 3], 4) should return [1, 2, 3, 4].

def add_item(numeric_list, new_number):

TODO: Add new_number to the end of the list and

return the list

Example: add_item([1, 2, 3], 4) should return [1, 2, 3, 4]

pass

def add_item(numeric_list, new_number): numeric_list.append(new_number) return numeric_list

Complete the function update_grade(grades, student, new_grade) that takes a grades dictionary, a student name, and a new grade, then updates that student's grade and returns the dictionary.

For example, update_grade({"Alice": 85, "Bob": 90}, "Alice",

  1. should return {"Alice": 95, "Bob": 90}.

def update_grade(grades, student, new_grade):

TODO: Update the student's grade and return the

dictionary

Example: update_grade({"Alice": 85, "Bob": 90}, "Alice",

should return {"Alice": 95, "Bob": 90}

pass

def update_grade(grades, student, new_grade): grades[student] = new_grade return grades

Which for loop correctly iterates through a list of student names?

for name in ['Alice', 'Bob', 'Carol']:

for name in ['Alice', 'Bob', 'Carol']:

10/6/26, 2:41 PM WGU E010 Foundations of Programming (Python) Practice Assessment Flashcards | Quizlet

Question: Answer:

A program processes file names and extracts the last 3 characters representing the file extension. For example, files 'document.pdf' and 'image.png' would return 'pdf' and 'png', respectively. Which slicing approach would work for either of the provided files? filename[:9] filename[9:] filename[-3:] filename[:-3]

filename[-3:]

Which index position is returned when the string method .find('python') is applied to the string 'learning python programming'? 8 9 1 2

Complete the function add_item(numeric_list, new_number) that takes a list of numbers and a new number, and returns a new list that appends the new number to the end of the list. For example, add_item([1, 2, 3], 4) should return [1, 2, 3, 4].

def add_item(numeric_list, new_number):

TODO: Add new_number to the end of the list and

return the list

Example: add_item([1, 2, 3], 4) should return [1, 2, 3, 4]

pass

def add_item(numeric_list, new_number): numeric_list.append(new_number) return numeric_list

Complete the function update_grade(grades, student, new_grade) that takes a grades dictionary, a student name, and a new grade, then updates that student's grade and returns the dictionary.

For example, update_grade({"Alice": 85, "Bob": 90}, "Alice",

  1. should return {"Alice": 95, "Bob": 90}.

def update_grade(grades, student, new_grade):

TODO: Update the student's grade and return the

dictionary

Example: update_grade({"Alice": 85, "Bob": 90}, "Alice",

should return {"Alice": 95, "Bob": 90}

pass

def update_grade(grades, student, new_grade): grades[student] = new_grade return grades

Which for loop correctly iterates through a list of student names?

for name in ['Alice', 'Bob', 'Carol']:

10/6/26, 2:41 PM WGU E010 Foundations of Programming (Python) Practice Assessment Flashcards | Quizlet

Question: Answer:

def add_item(numeric_list, new_number):

TODO: Add new_number to the end of the list and

return the list

Example: add_item([1, 2, 3], 4) should return [1, 2, 3, 4]

pass

Complete the function update_grade(grades, student, new_grade) that takes a grades dictionary, a student name, and a new grade, then updates that student's grade and returns the dictionary.

For example, update_grade({"Alice": 85, "Bob": 90}, "Alice",

  1. should return {"Alice": 95, "Bob": 90}.

def update_grade(grades, student, new_grade):

TODO: Update the student's grade and return the

dictionary

Example: update_grade({"Alice": 85, "Bob": 90}, "Alice",

should return {"Alice": 95, "Bob": 90}

pass

def update_grade(grades, student, new_grade): grades[student] = new_grade return grades

Which for loop correctly iterates through a list of student names?

for name in ['Alice', 'Bob', 'Carol']: for name with ['Alice', 'Bob', 'Carol']: for name from ['Alice', 'Bob', 'Carol']: for name = ['Alice', 'Bob', 'Carol']

for name in ['Alice', 'Bob', 'Carol']:

https://quizlet.com/1168128748/wgu-e010-foundations-of-programming-python-practice-assessment-flash-cards/ 4/

Question: Answer:

For example, add_item([1, 2, 3], 4) should return [1, 2, 3, 4].

def add_item(numeric_list, new_number):

TODO: Add new_number to the end of the list and

return the list

Example: add_item([1, 2, 3], 4) should return [1, 2, 3, 4]

pass

Complete the function update_grade(grades, student, new_grade) that takes a grades dictionary, a student name, and a new grade, then updates that student's grade and returns the dictionary.

For example, update_grade({"Alice": 85, "Bob": 90}, "Alice",

  1. should return {"Alice": 95, "Bob": 90}.

def update_grade(grades, student, new_grade):

TODO: Update the student's grade and return the

dictionary

Example: update_grade({"Alice": 85, "Bob": 90}, "Alice",

should return {"Alice": 95, "Bob": 90}

pass

def update_grade(grades, student, new_grade): grades[student] = new_grade return grades

Which for loop correctly iterates through a list of student names?

for name in ['Alice', 'Bob', 'Carol']: for name with ['Alice', 'Bob', 'Carol']: for name from ['Alice', 'Bob', 'Carol']: for name = ['Alice', 'Bob', 'Carol']

for name in ['Alice', 'Bob', 'Carol']:

https://quizlet.com/1168128748/wgu-e010-foundations-of-programming-python-practice-assessment-flash-cards/ Question: Answer: 4/

Which loop structure processes every individual item in a list called grades?

while len(grades) > 0: for grade in grades: for i in range(grades): while grades[0]

for grade in grades:

A program needs to display only positive, non-zero numbers from a list containing a mixture of integer and decimal values.

Which conditional statement should be placed inside the loop?

if number > 0: if number != 0: if number < 0: if number >= 1

if number > 0:

10/6/26, 2:41 PM WGU E010 Foundations of Programming (Python) Practice Assessment Flashcards | Quizlet

Question: Answer:

Which loop structure processes every individual item in a list called grades?

while len(grades) > 0: for grade in grades: for i in range(grades): while grades[0]

for grade in grades:

A program needs to display only positive, non-zero numbers from a list containing a mixture of integer and decimal values.

Which conditional statement should be placed inside the loop?

if number > 0: if number != 0: if number < 0: if number >= 1

if number > 0:

10/6/26, 2:41 PM WGU E010 Foundations of Programming (Python) Practice Assessment Flashcards | Quizlet

Question: Answer:

def calculate_discount(price, discount_percent):

TODO: Calculate and return the final price after

discount pass

Write a complete function password_strength(password) that returns "Strong" if the password is at least 8 characters long and contains both letters and numbers, "Weak" otherwise.

For example, password_strength("abc123def") should return "Strong".

def password_strength(password):

TODO: Return "Strong" or "Weak" based on password

criteria if len(password) < 8: return "Weak"

has_letter = False has_number = False

for char in password: if char.isalpha(): has_letter = True elif char.isdigit(): has_number = True

TODO: Add your return logic here based on has_letter

and has_number pass

def password_strength(password): if len(password) < 8: return "Weak"

has_letter = False has_number = False

for char in password: if char.isalpha(): has_letter = True elif char.isdigit(): has_number = True

if has_letter and has_number: return "Strong" else: return "Weak"

https://quizlet.com/1168128748/wgu-e010-foundations-of-programming-python-practice-assessment-flash-cards/ 6/

Question: Answer:

Write a complete function convert_temperature(celsius) that converts Celsius to Fahrenheit using the formula: F = C * 9/5 + 32.

For example, convert_temperature(0) should return 32.0.

def convert_temperature(celsius):

TODO: Convert Celsius to Fahrenheit using F = C * 9/5 +

32 pass

def convert_temperature(celsius): return celsius * 9 / 5 + 32

Fix the indexing error in this function that should return the last character of a string.

def get_last_character(text): return text[len(text)]

def get_last_character(text): return text[-1]

Fix the missing return statement in this function that should return whether a number is even.

def is_even(number): if number % 2 == 0: True else: False

def is_even(number): if number % 2 == 0: return True else: return False

10/6/26, 2:41 PM WGU E010 Foundations of Programming (Python) Practice Assessment Flashcards | Quizlet

Question: Answer:

Write a complete function convert_temperature(celsius) that converts Celsius to Fahrenheit using the formula: F = C * 9/5 + 32.

For example, convert_temperature(0) should return 32.0.

def convert_temperature(celsius):

TODO: Convert Celsius to Fahrenheit using F = C * 9/5 +

32 pass

def convert_temperature(celsius): return celsius * 9 / 5 + 32

Fix the indexing error in this function that should return the last character of a string.

def get_last_character(text): return text[len(text)]

def get_last_character(text): return text[-1]

Fix the missing return statement in this function that should return whether a number is even.

def is_even(number): if number % 2 == 0: True

def is_even(number): if number % 2 == 0: return True else: return False

10/6/26, 2:41 PM WGU E010 Foundations of Programming (Python) Practice Assessment Flashcards | Quizlet

Question: Answer:

Fix the indexing error in this function that should return the last character of a string.

def get_last_character(text): return text[len(text)]

def get_last_character(text): return text[-1]

Fix the missing return statement in this function that should return whether a number is even.

def is_even(number): if number % 2 == 0: True else: False

def is_even(number): if number % 2 == 0: return True else: return False

Fix the logic error in this function that should return the larger of two numbers.

def find_maximum(a, b): if a < b: return a else: return b

def find_maximum(a, b): if a < b: return b else: return a

Tip: Correctly returning the larger of two numbers using if-else

You can use either approach:

1️⃣ Using a < b: if a < b: return b else: return a

2️⃣ Using a > b: if a > b: return a else: return b

✅ Key point: The if condition and the corresponding return statements must align so the larger number is returned. Swapping the comparison requires swapping the return values accordingly.

https://quizlet.com/1168128748/wgu-e010-foundations-of-programming-python-practice-assessment-flash-cards/ 7/

Question: Answer:

Fix the indexing error in this function that should return the last character of a string.

def get_last_character(text): return text[len(text)]

def get_last_character(text): return text[-1]

Fix the missing return statement in this function that should return whether a number is even.

def is_even(number): if number % 2 == 0: True else: False

def is_even(number): if number % 2 == 0: return True else: return False

Fix the logic error in this function that should return the larger of two numbers.

def find_maximum(a, b): if a < b: return a else: return b

def find_maximum(a, b): if a < b: return b else: return a

Tip: Correctly returning the larger of two numbers using if-else

You can use either approach:

1️⃣ Using a < b: if a < b: return b else: return a

2️⃣ Using a > b: if a > b: return a else: return b

✅ Key point: The if condition and the corresponding return statements must align so the larger number is returned. Swapping the comparison requires swapping the return values accordingly.

https://quizlet.com/1168128748/wgu-e010-foundations-of-programming-python-practice-assessment-flash-cards/ 7/