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
Exam (elaborations)

WGU D335 Introduction to Programming in Python OBJECTIVE ASSESSMENT| GRADED A+

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

1. Which of the following code snippets correctly demonstrates the use of the decimal module to avoid floating-point precision errors when adding two decimal numbers? from decimal import Decimal num1 = Decimal('0.1') num2 = Decimal('0.2') result = num1 + num2 print(result) num1 = 0.1 num2 = 0.2 result = num1 + num2 print(f'Sum: {result}') from decimal import Decimal num1 = 0.1 num2 = 0.2 result = Decimal(num1) + Decimal(num2) print(f'Sum: {result}') from decimal import Decimal num1 = Decimal('0.1') num2 = Decimal('0.2') result = num1 * num2 print(f'Accurate product using decimal: {result}') 2. The arithmetic operators used in mathematical expressions are as follows: _____. addition uses &, subtraction uses $, multiplication uses #, division uses /, and modulo division uses ! addition uses @, subtraction uses -, multiplication uses *, division uses , and modulo division uses % addition uses +, subtraction uses -, multiplication uses *, division uses /, and modulo division uses % addition uses &, subtraction uses -, multiplication uses #, division uses /, and modulo division uses 3. What does "slicing" mean in Python? Extracting a portion of a list, tuple, or string Removing the first element of a list Sorting a list in reverse order Combining two lists into one 4. Which of the following lines of code will print the elements at indices 2, 3, and 4 from the my_list list? print (my_list[2:3] ) print (my_list(2:5) ) print (my_list[2:5] ) print (my_(2, 3) ) 5. What is the primary purpose of the pickle module in Python? To convert Python objects into a byte stream for storage or transmission To perform mathematical operations on data To manage file input and output operations To create graphical user interfaces 6. One of the ways to deal with the inaccuracies that may result from floating- point arithmetic operations is to use the decimal() method of the decimal module to round the results do the math with Decimal objects instead of floating-point numbers use the format() method of the decimal module to round the results convert the floating-point results to Decimal objects 7. Which of the following statements a), b), or c) is false? The Python Standard Library's pickle module can serialize objects into the data formats of many popular programming languages. Pickle has potential security issues. If you write your own pickling and de-pickling code, pickling can be secure. All of the above statements are true. 8. Which of the following statements is False about the Python module? Consider a module to be the same as a code library. A file containing a set of functions you want to include in your application. You can import and use built-in modules except for user-defined modules 9. What is the primary purpose of the pickle module in Python? To read and write CSV files To serialize and deserialize Python objects To perform mathematical operations To manage file input and output 10. Which of the following Python code snippets correctly prompts the user for two numbers, multiplies them, and displays the product? def multiply_numbers(): num1 = float(input('Enter the first number: ')) num2 = float(input('Enter the second number: ')) product = num1 * num2 print(f'The product of {num1} and {num2} is {product}') multiply_numbers() def multiply_numbers(): num1 = input('Enter the first number: ') num2 = input('Enter the second number: ') product = num1 + num2 print(f'The product of {num1} and {num2} is {product}') multiply_numbers() def multiply_numbers(): num1 = int(input('Enter the first number: ')) num2 = int(input('Enter the second number: ')) product = num1 - num2 print(f'The product of {num1} and {num2} is {product}') multiply_numbers() def multiply_numbers(): num1 = float(input('Enter the first number: ')) num2 = float(input('Enter the second number: ')) product = num1 / num2 print(f'The product of {num1} and {num2} is {product}') multiply_numbers() 11. What is the purpose of the 'with' statement in the following code snippet? with open('', 'r') as file: content = () print(content) To ensure the file is properly closed after its suite finishes, even if an error is raised. To create a new file if it does not exist. To read the file line by line instead of all at once. To open the file in write mode instead of read mode. 12. It is good programming practice to plan for possible exceptions and provide code t

Show more Read less
Institution
Course

Content preview

29/11/2025, 07:06 Introduction to Python Programming - results




WGU D335 Introduction to Programming in
Python OBJECTIVE
ASSESSMENT|2025\2026
Score 76/ 76



100%
1. Which of the following code snippets correctly demonstrates the use of the
decimal module to avoid floating-point precision errors when adding two
decimal numbers?

from decimal import Decimal
num1 = Decimal('0.1')
num2 = Decimal('0.2')
result = num1 + num2
print(result)

num1 = 0.1
num2 = 0.2
result = num1 + num2
print(f'Sum: {result}')

from decimal import Decimal
num1 = 0.1
num2 = 0.2
result = Decimal(num1) + Decimal(num2)
print(f'Sum: {result}')

from decimal import Decimal
num1 = Decimal('0.1')
num2 = Decimal('0.2')
1/23

,29/11/2025, 07:06 Introduction to Python Programming - results

result = num1 * num2
print(f'Accurate product using decimal: {result}')

2. The arithmetic operators used in mathematical expressions are as follows:
_____.

addition uses &, subtraction uses $, multiplication uses #, division uses
/, and modulo division uses !




2/23

, 29/11/2025, 07:06 Introduction to Python Programming - results

addition uses @, subtraction uses -, multiplication uses *, division uses
\, and modulo division uses %

addition uses +, subtraction uses -, multiplication uses *, division
uses /, and modulo division uses %

addition uses &, subtraction uses -, multiplication uses #, division uses
/, and modulo division uses \

3. What does "slicing" mean in Python?

Extracting a portion of a list, tuple, or string

Removing the first element of a list

Sorting a list in reverse order

Combining two lists into one

4. Which of the following lines of code will print the elements at indices 2, 3,
and 4 from the my_list list?

print (my_list[2:3] )

print (my_list(2:5) )

print (my_list[2:5] )

print (my_list.slice(2, 3) )

5. What is the primary purpose of the pickle module in Python?

To convert Python objects into a byte stream for storage or
transmission

To perform mathematical operations on data

To manage file input and output operations

To create graphical user interfaces
3/23

Written for

Course

Document information

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

Subjects

$11.99
Get access to the full document:

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

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.
GRADEGURU Western Governers University
Follow You need to be logged in order to follow users or courses
Sold
246
Member since
5 year
Number of followers
219
Documents
233
Last sold
3 months ago
GRADEGURU CREW

GIVE 5 STAR REVIEWS TO DOCUMENTS FOR CHEAPER PRICES ,BEST QUALITY.WE ARE A CREW OF EXPERTS IN ALL GENRES AND OFFER THEM HERE FOR SUCCESS.always leave a REVIEW TO GIVE US MORALE TO HELP YOU EVEN MORE .WISH Y'ALL THE BEST

3.4

45 reviews

5
13
4
11
3
8
2
5
1
8

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

Working on your references?

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

Working on your references?

Frequently asked questions