Skip to content

Microsoft 98-381

Introduction to Programming Using Python

Verified practice questions with detailed answers, clear explanations, and community discussion.

  • 40

    questions

  • 8 days ago

    last updated

  • 4.8/5

    overall rating

Question 1 of 40

The ABC company has hired you as an intern on the coding team that creates e-commerce applications.

You must write a script that asks the user for a value. The value must be used as a whole number in a calculation, even if the user enters a decimal value.

You need to write the code to meet the requirements.

Which code segment should you use?

Answer choices
Show answer

Correct answer: D

To meet the requirement where the user input must be treated as a whole number even if entered as a decimal, the appropriate approach is to convert the input to an integer. This can be done directly using the int() function on the input. The correct code segment here is totalItems = int(input('How many items would you like?')). This code will throw an error if a float value is entered, but the requirement specifies the use of the value as a whole number, which int() handles correctly for integer inputs.

Community votes

7 votes

DSuggested

86%

B

14%

Question 2 of 40

You are creating a function that manipulates a number. The function has the following requirements:

  • A float is passed into the function
  • The function must take the absolute value of the float
  • Any decimal points after the integer must be removed

Which two math functions should you use? Each correct answer is part of the solution. (Choose two.)

Answer choices
Show answer

Correct answers: C, E

To meet the requirements of the function, two math functions can be used: math.fabs() and math.floor(). The math.fabs() function returns the absolute value of a float, which means it removes any negative sign. The math.floor() function takes a float and returns the largest integer less than or equal to the float, effectively removing the decimal points while retaining the integer part. By using these two functions in combination, we can achieve the desired manipulations on the number.

Question 3 of 40

You are writing an application that uses the sqrt function. The program must reference the function using the name squareRoot.

You need to import the function.

Which code segment should you use?

Answer choices
Show answer

Correct answer: C

To reference the sqrt function from the math module using the name squareRoot, you should use the syntax 'from math import sqrt as squareRoot'. This imports the sqrt function from the math module and renames it to squareRoot in your program.

Question 4 of 40

You are writing code that generates a random integer with a minimum value of 5 and a maximum value of 11.

Which two functions should you use? Each correct answer presents a complete solution. (Choose two.)

Answer choices
Show answer

Correct answers: B, C

To generate a random integer with a minimum value of 5 and a maximum value of 11, you can use either random.randint(5, 11) or random.randrange(5, 12, 1). The random.randint function returns a random integer N such that 5 <= N <= 11, which includes both endpoints. The random.randrange function, with the parameters 5, 12, and 1, returns a random integer from the range [5, 12), meaning the upper limit is excluded, effectively generating numbers from 5 to 11.

Question 5 of 40

You develop a Python application for your school.

You need to read and write data to a text file. If the file does not exist, it must be created. If the file has content, the content must be removed.

Which code should you use?

Answer choices
Show answer

Correct answer: C

To read and write data to a text file, and to ensure that the file is created if it does not exist while also truncating its content if it does exist, the correct mode to use is 'w+'. This mode open the file for both reading and writing, and it creates the file if it does not exist. Additionally, it truncates (empties) the file if it already contains content.

Community votes

1 vote

CSuggested

100%

35 questions still locked

Your preview covered the first 5 questions. Unlock the rest to see every explanation and discussion thread, updated weekly

View plans

Choose your plan

Single payment · No subscription · No hidden fees

Standard

For a focused sprint before your exam date

$25USD

30 days of access, single payment

  • All 40 questions unlocked
  • Detailed answer explanations
  • Community discussions and votes
  • Weekly question updates
  • Printable PDF download
  • 100% refund if you do not pass

Premium

Extra runway, the PDF, and the refund guarantee

$35$60USD

90 days of access, single payment

Printable PDF download

Save every question as a PDF for offline study or printing.

  • All 40 questions unlocked
  • Detailed answer explanations
  • Community discussions and votes
  • Weekly question updates

Full refund if you do not pass

Send us your exam result and we refund the purchase.

Stories from the certified

Charles Sirois
Canada
As this was my first certification exam, I was understandably nervous about what to expect. These study materials made the preparation process much easier, and many of the questions closely reflected those on the actual exam.
Lance Chambers
United States
Wasted about a month going through the free dump sites scattered all over reddit, half the answers were wrong and the other half were for a version of the exam that doesn't even exist anymore. Eventually gave in and paid the small fee here, and the difference was night and day.
Alisha Kelly
Italy
Honestly, I had already gone through the official documentation quite thoroughly, but still didn't feel fully confident going in. This helped things finally click for me. I realized I knew the material, but just hadn't connected all the pieces yet.
Casper Claassen
Netherlands
Used this along with Microsoft Learn and the combo worked really well. The practice questions made the stuff I'd read actually stick. Passed first attempt, no complaints from me.
Gabriele Ghesla
Italy
The content is accurate and clearly presented, and it's more affordable than competitors. The team has been incredibly responsive whenever I've had an issue, and they've been open to small changes that improve the platform.
Charles Sirois
Canada
As this was my first certification exam, I was understandably nervous about what to expect. These study materials made the preparation process much easier, and many of the questions closely reflected those on the actual exam.
Lance Chambers
United States
Wasted about a month going through the free dump sites scattered all over reddit, half the answers were wrong and the other half were for a version of the exam that doesn't even exist anymore. Eventually gave in and paid the small fee here, and the difference was night and day.
Alisha Kelly
Italy
Honestly, I had already gone through the official documentation quite thoroughly, but still didn't feel fully confident going in. This helped things finally click for me. I realized I knew the material, but just hadn't connected all the pieces yet.
Casper Claassen
Netherlands
Used this along with Microsoft Learn and the combo worked really well. The practice questions made the stuff I'd read actually stick. Passed first attempt, no complaints from me.
Gabriele Ghesla
Italy
The content is accurate and clearly presented, and it's more affordable than competitors. The team has been incredibly responsive whenever I've had an issue, and they've been open to small changes that improve the platform.
Morgan Farmer
United Kingdom
I don't usually leave reviews, but this one felt worth sharing. The questions were quite close to what actually appeared on the exam, more than I expected. I spent about a week going through the material before my test, and it helped me feel more prepared.
Remi Nuyts
United States
Passed ITIL 4 Foundation with 87%. Material was enough by itself.
Archie Hopkins
United States
I had a smooth experience from start to finish. Access was available right away, no technical issues, which made it easy to get started. The content felt relevant and aligned well with what I was looking for.
Nancy Mcbride
United States
Does what it says it does. Content felt solid, nothing confusing to navigate and I didn't run into any weird issues. I been putting off scheduling the exam for a while and going through this gave me enough confidence to finally book it and pass.
Neil Savage
United States
A very quick response was received via email when a link issue occurred. The study materials provided were high quality and extremely helpful. I was able to complete the test successfully. Many thanks for the excellent support.
Morgan Farmer
United Kingdom
I don't usually leave reviews, but this one felt worth sharing. The questions were quite close to what actually appeared on the exam, more than I expected. I spent about a week going through the material before my test, and it helped me feel more prepared.
Remi Nuyts
United States
Passed ITIL 4 Foundation with 87%. Material was enough by itself.
Archie Hopkins
United States
I had a smooth experience from start to finish. Access was available right away, no technical issues, which made it easy to get started. The content felt relevant and aligned well with what I was looking for.
Nancy Mcbride
United States
Does what it says it does. Content felt solid, nothing confusing to navigate and I didn't run into any weird issues. I been putting off scheduling the exam for a while and going through this gave me enough confidence to finally book it and pass.
Neil Savage
United States
A very quick response was received via email when a link issue occurred. The study materials provided were high quality and extremely helpful. I was able to complete the test successfully. Many thanks for the excellent support.

Before you buy

Answers about access, updates, payments, and the refund policy.

01Are these real exam questions?

Our Microsoft 98-381 questions are based on real exam experiences and are continuously updated to match the current exam format. Most candidates who study with us report passing on their first attempt, based on a self reported post exam survey.

02What happens if I don't pass the exam?

With our Premium package, you get a 100% money back guarantee. If you don't pass your exam after studying with our materials, simply contact us with your exam results and we'll refund your purchase. Terms and conditions apply, read our full refund policy to learn more.

03How often are the questions updated?

Our question bank is updated regularly based on feedback from recent exam takers. We typically review and update our content every week with reports about new questions or changes to the exam format.

04Can I extend my access period?

Yes. When your access is close to expiring, you can renew it for another 30 days directly from the exam page. If you need more time while you are still preparing, reach out and we will help.

05Is this a single payment or a subscription?

This is a single payment with no recurring charges. Once you purchase, you get full access to all exam questions for the duration of your package (30 days for Standard, 90 days for Premium). No hidden fees or automatic renewals.

06How many questions are included?

You get access to all 40 questions in our database for the Microsoft 98-381 exam. This includes detailed explanations and answer justifications to help you understand the concepts thoroughly.

07Do you offer technical support?

Yes. Email us at hello@examice.com for help with access, billing, or the platform. We read every message and typically reply within 24 hours on business days.

08Is my payment secure?

Absolutely! We use industry standard SSL encryption and process all payments through Stripe, a trusted payment processor used by millions of businesses worldwide. Your payment and personal information are completely secure.

Ready to unlock the rest

All 40 questions from $25, single payment, instant access.

Back to plans