microsoft 98-381 Exam Questions

Questions for the 98-381 were updated on : Jun 17 ,2024

Page 1 out of 3. Viewing questions 1-15 out of 43

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:

Answer:


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

Discussions
0 / 1000

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:

Answer:


Explanation:
References:
https://www.w3resource.com/python/python-if-else-statements.php

Discussions
0 / 1000

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

A

User Votes:
A
50%
B
50%
C
50%
D
50%

Explanation:
References:
http://www.pythonforbeginners.com/comments/comments-in-python

Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 4

Evaluate the following Python arithmetic expression:

What is the result?

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

C

User Votes:
A
50%
B
50%
C
50%
D
50%

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

Discussions
vote your answer:
A
B
C
D
0 / 1000

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:

Answer:


Explanation:
References:
https://www.w3resource.com/python/python-user-defined-functions.php

Discussions
0 / 1000

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:

Answer:


Discussions
0 / 1000

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:

Answer:


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

Discussions
0 / 1000

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:

Answer:


Explanation:
References:
https://www.w3resource.com/python/python-while-loop.php

Discussions
0 / 1000

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?”))
Answer:

B

User Votes:
A
50%
B
50%
C
50%
D
50%

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

Discussions
vote your answer:
A
B
C
D
0 / 1000

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:

Answer:


Explanation:
References:
http://effbot.org/zone/python-with-statement.htm

Discussions
0 / 1000

Question 11

HOTSPOT
You work for a company that distributes media for all ages.
You are writing a function that assigns a rating based on a users 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:

Answer:


Explanation:
References:
https://www.w3resource.com/python/python-if-else-statements.php

Discussions
0 / 1000

Question 12

HOTSPOT
You develop a Python application for your company.
You have the following code. Line numbers are included for reference only.

Use the drop-down menus to select the answer choice that answers each question based on the information presented in
the code segment.
Hot Area:

Answer:


Explanation:
References:
http://www.mathcs.emory.edu/~valerie/courses/fall10/155/resources/op_precedence.html
http://interactivepython.org/runestone/static/pythonds/BasicDS/InfixPrefixandPostfixExpressions.html

Discussions
0 / 1000

Question 13

DRAG DROP
Match the data type to the type operations.
To answer, drag the appropriate data type to the correct type operation. Each data type may be used once, more than once,
or not at all.
Select and Place:

Answer:


Explanation:
References:
https://www.w3resource.com/python/python-data-type.php

Discussions
0 / 1000

Question 14

HOTSPOT
During school holidays, you volunteer to explain some basic programming concepts to younger siblings.
You want to introduce the concept of data types in Python. You create the following three code segments:

You need to evaluate the code segments.
For each of the following statements, select Yes if the statement is true. Otherwise, select No.
NOTE: Each correct selection is worth one point.
Hot Area:

Answer:


Explanation:
Code Segment 1: You cannot convert str to int. x1 = 2 is a string. Therefore code will produce an error. Code Segment


2: b = 1.5, which is a float.
Code Segment 3: c = 2.5, which is a float, not an int.

References:
https://www.w3resource.com/python/python-data-type.php

Discussions
0 / 1000

Question 15

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

C

User Votes:
A
50%
B
50%
C
50%
D
50%

Explanation:
References:
https://infohost.nmt.edu/tcc/help/pubs/python/web/import-statement.html

Discussions
vote your answer:
A
B
C
D
0 / 1000
To page 2