100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

WGU D335 PRACTICE TEST 2 (PRACTICE QUESTIONS WITH ANSWERS FOR PA) EXAM QUESTIONS AND CORRECT ANSWERS PLUS RATIONALES | GRADED A+ | VERIFIED ANSWERS | BRAND NEW VERSION!

Rating
-
Sold
-
Pages
29
Grade
A+
Uploaded on
07-11-2025
Written in
2025/2026

WGU D335 PRACTICE TEST 2 (PRACTICE QUESTIONS WITH ANSWERS FOR PA) EXAM QUESTIONS AND CORRECT ANSWERS PLUS RATIONALES | GRADED A+ | VERIFIED ANSWERS | BRAND NEW VERSION!

Institution
WGU D335
Course
WGU D335










Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
WGU D335
Course
WGU D335

Document information

Uploaded on
November 7, 2025
Number of pages
29
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

WGU D335 PRACTICE TEST 2 (PRACTICE QUESTIONS WITH ANSWERS
FOR PA) EXAM QUESTIONS AND CORRECT ANSWERS PLUS
RATIONALES | GRADED A+ | VERIFIED ANSWERS | BRAND NEW
VERSION!
Question 1
Create a solution that accepts three integer inputs representing the number of times an
employee travels to a job site. Output the total distance traveled to two decimal places given
the following miles per employee commute to the job site:

• Employee A: 15.62 miles

• Employee B: 41.85 miles

• Employee C: 32.67 miles

times_traveledA = int(input())

times_traveledB = int(input())

times_traveledC = int(input())




# Calculate total distance and format the output

# Your code here# Calculate total distance and format the output

# Your code here

Which code snippet correctly completes the solution?
A)

codePython

total_miles_traveled = (times_traveledA * 15.62) + (times_traveledB * 41.85) +
(times_traveledC * 32.67)

print(f'Distance: {total_miles_traveled} miles')

B)

,codePython

total_miles_traveled = (times_traveledA * 15.62) + (times_traveledB * 41.85) +
(times_traveledC * 32.67)

print('Distance: {:.2f} miles'.format(total_miles_traveled))

C)

codePython

total_miles_traveled = (times_traveledA + 15.62) + (times_traveledB + 41.85) +
(times_traveledC + 32.67)

print('Distance: {:.2f} miles'.format(total_miles_traveled))

```D)

```python

total_miles_traveled = int(times_traveledA * 15.62) + int(times_traveledB * 41.85) +
int(times_traveledC * 32.67)

print('Distance: {:.2f} miles'.format(total_miles_traveled))

Correct Answer: B)
Rationale: This option correctly multiplies the number of trips for each employee by their
respective commute distance and then sums the results. It also correctly uses
the .format() method with the :.2f specifier to format the final output to exactly two decimal
places as required.




Question 2
Create a solution that accepts an input identifying the name of a text file. Each text file
contains three rows with one word per row. Using file handling methods, write a new
sentence string composed of the three existing words to the end of the file contents on a new
line. Output the new file contents.

, codePython

file_name = input()



# Your code here to read the words, append the sentence, and print the new content

```**Which code snippet correctly completes the solution?**

A)

```python

with open(file_name, 'r') as f:

words = f.read().splitlines()

sentence = ' '.join(words)

with open(file_name, 'a') as f:

f.write('\n' + sentence)

with open(file_name, 'r') as f:

print(f.read())

B)

codePython

with open(file_name, 'w') as f:

words = f.readlines()

f.write(' '.join(words))

print(open(file_name, 'r').read())

C)

codePython

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
DoctorGriffin Maryland University
View profile
Follow You need to be logged in order to follow users or courses
Sold
2723
Member since
4 months
Number of followers
17
Documents
1078
Last sold
14 hours ago

4.9

177 reviews

5
164
4
12
3
0
2
0
1
1

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions