
Python Programming Quiz

Quiz
•
Engineering
•
University
•
Medium
Sankarsan Sahoo
Used 3+ times
FREE Resource
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the primary purpose of the decimal module in Python?
To perform faster arithmetic operations than standard floats.
To handle financial calculations and ensure exact decimal representations.
To convert numbers between different bases (binary, octal, hexadecimal).
To provide advanced mathematical functions like trigonometry and logarithms.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following Python code? from decimal import Decimal print(Decimal('0.3') + Decimal('0.2') == Decimal('0.6'))
True
False
Error
Machine dependent
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
To represent the fraction 3/4 accurately in Python, which of the following is the most appropriate?
0.75
3 / 4
fractions.Fraction(3, 4)
decimal.Decimal('0.75')
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the result of fractions.Fraction(1, 3) + fractions.Fraction(1, 6)?
fractions.Fraction(1, 2)
fractions.Fraction(2, 9)
0.5
fractions.Fraction(3, 18)
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is an incorrect way to create a Decimal object from a floating-point number in a way that might introduce precision issues?
Decimal(0.1)
Decimal('0.1')
Decimal(str(0.1))
None of these
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the result of Decimal('1.200').normalize()?
Decimal('1.200')
Decimal('1.2')
Decimal('1.20')
Decimal('1.2e+0')
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is a valid way to create a Money object?
my_money = Money(10, "USD")
my_money = Money("10", "USD")
my_money = Money(10 USD)
my_money = Money(amount=10, currency="USD")
Create a free account and access millions of resources
Similar Resources on Wayground
15 questions
RoboRover

Quiz
•
University
11 questions
Conceptos de Orientación a Objetos en Python

Quiz
•
University
10 questions
engineers day

Quiz
•
University
15 questions
BugBlitz

Quiz
•
University
15 questions
Digital Electronics Quiz -U1-U2

Quiz
•
University
10 questions
Quiz 2

Quiz
•
University
15 questions
Number Systems and Boolean Algebra

Quiz
•
University
20 questions
Code Sprint '25

Quiz
•
University
Popular Resources on Wayground
55 questions
CHS Student Handbook 25-26

Quiz
•
9th Grade
10 questions
Afterschool Activities & Sports

Quiz
•
6th - 8th Grade
15 questions
PRIDE

Quiz
•
6th - 8th Grade
15 questions
Cool Tool:Chromebook

Quiz
•
6th - 8th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
20 questions
Bullying

Quiz
•
7th Grade
18 questions
7SS - 30a - Budgeting

Quiz
•
6th - 8th Grade
Discover more resources for Engineering
36 questions
USCB Policies and Procedures

Quiz
•
University
4 questions
Benefits of Saving

Quiz
•
5th Grade - University
20 questions
Disney Trivia

Quiz
•
University
2 questions
Pronouncing Names Correctly

Quiz
•
University
15 questions
Parts of Speech

Quiz
•
1st Grade - University
1 questions
Savings Questionnaire

Quiz
•
6th Grade - Professio...
26 questions
Parent Functions

Quiz
•
9th Grade - University
18 questions
Parent Functions

Quiz
•
9th Grade - University