98-381 Exam Details

  • Exam Code
    :98-381
  • Exam Name
    :Introduction to Programming Using Python
  • Certification
    :Microsoft Certifications
  • Vendor
    :Microsoft
  • Total Questions
    :40 Q&As
  • Last Updated
    :Jul 15, 2026

Microsoft 98-381 Online Questions & Answers

  • Question 21:

    HOTSPOT

    You work for a company that distributes media for all ages.

    You are writing a function that assigns a rating based on a user's age. The function must meet the following requirements:

    Anyone 18 years old or older receives a rating of “A”

    Anyone 13 or older, but younger than 18, receives a rating of “T”

    Anyone 12 years old or younger receives a rating of “C”

    If the age is unknown, the rating is set to “C”

    You need to complete the code to meet the requirements.

    How should you complete the code? To answer, select the appropriate code segments in the answer area.

    Hot Area:

  • Question 22:

    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.)

    A. random.randint(5, 12)
    B. random.randint(5, 11)
    C. random.randrange(5, 12, 1)
    D. random.randrange(5, 11, 1)

  • Question 23:

    HOTSPOT

    You find errors while evaluating the following code. Line numbers are included for reference only.

    You need to correct the code at line 03 and line 06.

    How should you correct the code? Use the drop-down menus to select the answer choice that answers each question based on the information presented in the code segment.

    NOTE: Each correct selection is worth one point.

    Hot Area:

  • Question 24:

    HOTSPOT

    The ABC organics company needs a simple program that their call center will use to enter survey data for a new coffee variety.

    The program must accept input and return the average rating based on a five-star scale. The output must be rounded to two decimal places.

    You need to complete the code to meet the requirements.

    How should you complete the code? To answer, select the appropriate code segments in the answer area.

    NOTE: Each correct selection is worth one point.

    Hot Area:

  • Question 25:

    This question requires that you evaluate the underlined text to determine if it is correct.

    You write the following code:

    The out.txt file does not exist. You run the code. The code will execute without error.

    Review the underlined text. If it makes the statement correct, select "No change is needed". If the statement is incorrect, select the answer choice that makes the statement correct.

    A. No change is needed
    B. The code runs, but generates a logic error
    C. The code will generate a runtime error
    D. The code will generate a syntax error

  • Question 26:

    HOTSPOT

    The ABC company needs a way to find the count of particular letters in their publications to ensure that there is a good balance. It seems that there have been complaints about overuse of the letter e. You need to create a function to meet the requirements.

    How should you complete this code? To answer, select the appropriate code segments in the answer area.

    NOTE: Each correct selection is worth one point.

    Hot Area:

  • Question 27:

    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.)

    A. math.fmod(x)
    B. math.frexp(x)
    C. math.floor(x)
    D. math.ceil(x)
    E. math.fabs(x)

  • Question 28:

    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?

    A. import math.sqrt as squareRoot
    B. import sqrt from math as squareRoot
    C. from math import sqrt as squareRoot
    D. from math.sqrt as squareRoot

  • Question 29:

    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?

    A. open("local_data", "r")
    B. open("local_data", "r+")
    C. open("local_data", "w+")
    D. open("local_data", "w")

  • Question 30:

    HOTSPOT

    You are an intern for ABC electric cars company. You must create a function that calculates the average velocity of their vehicles on a 1320 foot (1/4 mile) track. The output must be as precise as possible.

    How should you complete the code? To answer, select the appropriate code segments in the answer area.

    Hot Area:

Tips on How to Prepare for the Exams

Nowadays, the certification exams become more and more important and required by more and more enterprises when applying for a job. But how to prepare for the exam effectively? How to prepare for the exam in a short time with less efforts? How to get a ideal result and how to find the most reliable resources? Here on Vcedump.com, you will find all the answers. Vcedump.com provide not only Microsoft exam questions, answers and explanations but also complete assistance on your exam preparation and certification application. If you are confused on your 98-381 exam preparations and Microsoft certification application, do not hesitate to visit our Vcedump.com to find your solutions here.