Exam Details

  • Exam Code
    :98-381
  • Exam Name
    :Introduction to Programming Using Python
  • Certification
    :MTA
  • Vendor
    :Microsoft
  • Total Questions
    :40 Q&As
  • Last Updated
    :Dec 18, 2024

Microsoft MTA 98-381 Questions & Answers

  • Question 1:

    The ABC company is creating a program that allows customers to log the number of miles biked. The program will send messages based on how many miles the customer logs. You create the following Python code. Line numbers are included for reference only.

    You need to define the two required functions.

    Which code segments should you use for line 01 and line 04? Each correct answer presents part of the solution? (Choose two.)

    A. 01 def get_name():

    B. 01 def get_name(biker):

    C. 01 def get_name(name):

    D. 04 def calc_calories():

    E. 04 def calc_calories(miles, burn_rate):

    F. 04 def calc_calories(miles, calories_per_mile):

  • Question 2:

    You develop a Python application for your company.

    You want to add notes to your code so other team members will understand it.

    What should you do?

    A. Place the notes after the # sign on any line

    B. Place the notes after the last line of code separated by a blank line

    C. Place the notes before the first line of code separated by a blank line

    D. Place the notes inside of parentheses on any time

  • Question 3:

    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 4:

    You are creating a function that reads a data file and prints each line of the file. You write the following code. Line numbers are included for reference only.

    The code attempts to read the file even if the file does not exist.

    You need to correct the code.

    Which three lines have indentation problems? Each correct answer presents part of the solution. (Choose three.)

    A. Line 01

    B. Line 02

    C. Line 03

    D. Line 04

    E. Line 05

    F. Line 06

    G. Line 07

    H. Line 08

  • Question 5:

    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 6:

    You develop a Python application for your company.

    You need to accept input from the user and print that information to the user screen.

    You have started with the following code. Line numbers are included for reference only.

    Which code should you write at line 02?

    A. name = input

    B. input("name")

    C. input(name)

    D. name = input()

  • Question 7:

    You are writing a Python program to automate inventory. Your first task is to read a file of inventory transactions. The file contains sales from the previous day, including the item id, price, and quantity. The following shows a sample of data from the file:

    The code must meet the following requirements: Each line of the file must be read and printed If a blank line is encountered, it must be ignored When all lines have been read, the file must be closed

    You create the following code. Line numbers are included for reference only.

    Which code should you write for line 05 and line 06?

    A. Option A

    B. Option B

    C. Option C

    D. Option D

  • Question 8:

    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 9:

    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 10:

    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)

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.