Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 2 out of 7 pages
Exam (elaborations)

WGU D335 – Practice Test 2 – Practice Questions and Correct Answers with Detailed Rationales and Comprehensive Course Review

Document preview thumbnail
Preview 2 out of 7 pages

This document contains Practice Test 2 questions with correct answers and detailed rationales covering the core concepts of WGU D335. The material is designed to reinforce essential course topics through realistic practice questions, comprehensive answer explanations, and targeted review aligned with the course learning objectives. It serves as an effective study resource for preparing for the Objective Assessment by strengthening subject knowledge, identifying knowledge gaps, and improving exam readiness.

Content preview

WGU D335 Practice Test 2
WGU D335 Practice Test 2
Study online at https://quizlet.com/_eziszg

1. Create a solution that accepts three integer times_traveledA = int(input())
inputs representing the number of times an times_traveledB = int(input())
employee travels to a job site. Output the times_traveledC = int(input())
total distance traveled to two decimal places employeeA = 15.62 #miles
given the following miles per employee com- employeeB = 41.85 #miles
mute to the job site. Output the total distance employeeC = 32.67 #miles
traveled to two decimal places given the fol- distance_traveledA = times_traveledA *
lowing miles per employee commute to the employeeA
job site: distance_traveledB = times_traveledB *
Employee A: 15.62 miles employeeB
Employee B: 41.85 miles distance_traveledC = times_traveledC *
Employee C: 32.67 miles employeeC
total_miles_traveled = distance_travele-
dA + distance_traveledB + distance_trav-
eledC
print('Distance: {:.2f} miles'.format(to-
tal_miles_traveled))

2. Create a solution that accepts an input iden- file_name = input()
tifying the name of a text file, for example, with open(file_name, 'r') as f:
"WordTextFile1.txt". Each text file contains word1 = str(f.readline()).strip()
three rows with one word per row. Using the word2 = str(f.readline()).strip()
open() function and write() and read() meth- word3 = str(f.readline()).strip()
ods, interact with the input text file to write a
new sentence string composed of the three f = open(file_name, 'r')
existing words to the end of the file contents lines = f.read().splitlines()
on a new line. Output the new file contents. lines = ' '.join(lines)
f.close()
print(f'{word1}\n{word2}\n{word3}\n{lines}

3. Create a solution that accepts an integer ounces_per_pound = 16
input representing any number of ounces. pounds_per_ton = 2000
1/7

, WGU D335 Practice Test 2
WGU D335 Practice Test 2
Study online at https://quizlet.com/_eziszg

Output the converted total number of tons, number_ounces = int(input())
pounds, and remaining ounces based on the tons = number_ounces
input ounces value. There are 16 ounces in a // (ounces_per_pound *
pound and 2,000 pounds in a ton. pounds_per_ton)
remaining_ounces = num-
ber_ounces % (ounces_per_pound *
pounds_per_ton)
pounds = remaining_ounces //
ounces_per_pound
remaining_ounces = remaining_ounces
% ounces_per_pound
print('Tons: {}'.format(tons))
print('Pounds: {}'.format(pounds))
print('Ounces: {}'.format(remain-
ing_ounces))

4. Create a solution that accepts an input iden- import csv
tifying the name of a CSV file, for example, input1 = input()
"input1.csv". Each file contains two rows of with open(input1, "r") as f:
comma-separated values. Import the built-in data = [row for row in csv.reader(f)]
module csv and use its open() function and for row in data:
reader() method to create a dictionary of even = [row[i].strip() for i in range(0,
key:value pairs for each row of comma-sep- len(row), 2)]
arated values in the specified file. Output the odd = [row[i].strip() for i in range(1,
file contents as two dictionaries. len(row), 2)]
pair = dict(zip(even, odd))
print(pair)

5. Create a solution that accepts an integer in- index_value = int(input())
put representing the index value for any any name = various_data_types[index_val-
of the five elements in the following list: ue]
various_data_types = [516, 112.49, True, data_type = type(name).__name__
2/7

Document information

Uploaded on
August 3, 2026
Number of pages
7
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$10.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

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.
AnswersCOM
3.6
(232)
Sold
1400
Followers
355
Items
27149
Last sold
9 hours ago



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

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions