# microsoft 98-381 online test

## Introduction to Programming Using Python

### What students need to know about the 98-381 exam

• Total 43 Questions & Answers
• Passing score: 700

##### Question 1

DRAG DROP
The ABC company is converting an existing application to Python. You are creating documentation that will be used by
several interns who are working on the team.
You need to ensure that arithmetic expressions are coded correctly.
What is the correct order of operations for the six classes of operations ordered from first to last in order of precedence? To
answer, move all operations from the list of operations to the answer area and arrange them in the correct order.
Select and Place:  Explanation:
References:
http://www.mathcs.emory.edu/~valerie/courses/fall10/155/resources/op_precedence.html

Discussions

##### Question 2

HOTSPOT
You are coding a math utility by using Python.
You are writing a function to compute roots.
The function must meet the following requirements: How should you complete the code? To answer, select the appropriate code segments in the answer area.
Hot Area:  Explanation:
References:
https://www.w3resource.com/python/python-if-else-statements.php

Discussions

##### Question 3

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

A

Explanation:
References:

Discussions

##### Question 4

Evaluate the following Python arithmetic expression: What is the result?

• A. 3
• B. 13
• C. 15
• D. 69

C

Explanation:
References:
http://www.mathcs.emory.edu/~valerie/courses/fall10/155/resources/op_precedence.html

Discussions

##### Question 5

HOTSPOT
You are developing a Python application for an online game.
You need to create a function that meets the following criteria:
The function is named update_score The function receives the current score and a value The function adds the value to the current score The function returns the new score  How should you complete the code? To answer, select the appropriate code segments in the answer area.
Hot Area:  Explanation:
References:
https://www.w3resource.com/python/python-user-defined-functions.php

Discussions

##### Question 6

DRAG DROP
You are writing a Python program that evaluates an arithmetic formula.
The formula is described as b equals a multiplied by negative one, then raised to the second power, where a is the value that
will be input and b is the result.
You create the following code segment. Line numbers are included for reference only. You need to ensure that the result is correct.
How should you complete the code on line 02? To answer, drag the appropriate code segment to the correct location. Each
code segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll
to view content.
NOTE: Each correct selection is worth one point.
Select and Place:  Discussions

##### Question 7

DRAG DROP
The ABC company is converting an existing application to Python. You are creating documentation that will be used by
several interns who are working on the team.
You need to ensure that arithmetic expressions are coded correctly.
What is the correct order of operations for the six classes of operations ordered from first to last in order of precedence? To
answer, move all operations from the list of operations to the answer area and arrange them in the correct order.
Select and Place:  Explanation:
References:
http://www.mathcs.emory.edu/~valerie/courses/fall10/155/resources/op_precedence.html

Discussions

##### Question 8

DRAG DROP
You are creating a Python script to evaluate input and check for upper and lower case.
Which four code segments should you use to develop the solution? To answer, move the appropriate code segment from the
list of code segments to the answer area and arrange them in the correct order.
Select and Place:  Explanation:
References:
https://www.w3resource.com/python/python-while-loop.php

Discussions

##### Question 9

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?

• A. totalItems = input(“How many items would you like?”)
• B. totalItems = float(input(“How many items would you like?”))
• C. totalItems = str(input(“How many items would you like?”))
• D. totalItems = int(input(“How many items would you like?”))

B

Explanation:
References:
http://anh.cs.luc.edu/python/hands-on/3.1/handsonHtml/io.html

Discussions

##### Question 10

DRAG DROP
You are writing a function that works with files.
You need to ensure that the function returns None if the file does not exist. If the file does exist, the function must return the
first line.
You write the following code: In which order should you arrange the code segments to complete the function? To answer, move all code segments from
the list of code segments to the answer area and arrange them in the correct order.
Select and Place:  