Try Before You Buy

Download a free sample of any of our exam questions and answers

  • 24/7 customer support, Secure shopping site
  • Free One year updates to match real exam scenarios
  • If you failed your exam after buying our products we will refund the full amount back to you.

Microsoft 98-381 Cert Guide PDF 100% Cover Real Exam Questions [Q23-Q39]

Share

Microsoft 98-381 Cert Guide PDF 100% Cover Real Exam Questions

Pass 98-381 Exam - Real Questions & Answers


Domain Taking care of Troubleshooting & Error Handling

Speaking of the fifth domain, it is all about knowing the ins and outs of Python-related troubleshooting and error handling. This section tries to impart best-of-breed understanding about analyzing, detecting and fixing error code segments that are known to involve errors. Applicants have to learn more about the errors related to syntax, logic, and runtime. In addition, one's knowledge of analyzing and constructing exception handling code segments is required.


Basic Exam Prerequisites

It's suggested that applicants for 98-381 have notable expertise in writing syntactically correct Python code and handle associates tasks with full perfection. The vendor also recommends the intended candidates to have a bare minimum experience of 100 hours in Python programming language for easy exam journey. Besides that, it is important to have knowledge of Python features and capabilities, code generation procedure, basis principles of debugging the programming issues, and fundamental skills in maintaining the Python code.

 

NEW QUESTION 23
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. from math import sqrt as squareRoot
  • B. import math.sqrt as squareRoot
  • C. import sqrt from math as squareRoot
  • D. from math.sqrt as squareRoot

Answer: A

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

 

NEW QUESTION 24
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", "w+")
  • C. open("local_data", "w")
  • D. open("local_data", "r")

Answer: A

Explanation:
References: https://pythontips.com/2014/01/15/the-open-function-explained/

 

NEW QUESTION 25
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.

Answer:

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

 

NEW QUESTION 26
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.

Answer:

Explanation:

b = (-a)**2

 

NEW QUESTION 27
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 B
  • B. Option A
  • C. Option C
  • D. Option D

Answer: A

 

NEW QUESTION 28
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.

Answer:

Explanation:

Explanation:

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

 

NEW QUESTION 29
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.

Answer:

Explanation:

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

 

NEW QUESTION 30
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", "w+")
  • C. open("local_data", "w")
  • D. open("local_data", "r")

Answer: B

Explanation:
Modes 'r+', 'w+' and 'a+' open the file for updating (reading and writing). Mode 'w+' truncates the file.
References:
https://docs.python.org/2/library/functions.html
https://pythontips.com/2014/01/15/the-open-function-explained/

 

NEW QUESTION 31
DRAG DROP
You are writing a Python program. The program collects customer data and stores it in a database.
The program handles a wide variety of data.
You need to ensure that the program handles the data correctly so that it can be stored in the database correctly.
Match the data type to the code segment. To answer, drag the appropriate data type from the column on the left to its code segment on the right. Each data type may be used once, more than once, or not at all.
Select and Place:

Answer:

Explanation:

Section: (none)
Explanation/Reference:
References: https://www.w3resource.com/python/python-data-type.php

 

NEW QUESTION 32
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.

Answer:

Explanation:

Explanation:

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

 

NEW QUESTION 33
HOTSPOT
You create a function to calculate the power of a number by using Python.
You need to ensure that the function is documented with comments.
You create the following code. Line numbers are included for reference only.

For each of the following statements, select Yes if the statement is true. Otherwise, select No.
Answer Area

Answer:

Explanation:

Explanation:

References:
http://www.pythonforbeginners.com/comments/comments-in-python
https://www.w3resource.com/python/python-string.php

 

NEW QUESTION 34
HOTSPOT
You create the following program to locate a conference room and display the room name. Line numbers are
included for reference only.

Colleagues report that the program sometimes produces incorrect results.
You need to troubleshoot the program. 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:

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

 

NEW QUESTION 35
HOTSPOT
You are designing a decision structure to convert a student's numeric grade to a letter grade. The program must assign a letter grade as specified in the following table:

For example, if the user enters a 90, the output should be, "Your letter grade is A". Likewise, if a user enters an 89, the output should be "Your letter grade is B".
How should you complete the code? To answer, select the appropriate code segments in the answer area.

Answer:

Explanation:

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

 

NEW QUESTION 36
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:

Answer:

Explanation:

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

 

NEW QUESTION 37
HOTSPOT
The ABC company is building a basketball court for its employees to improve company morale.
You are creating a Python program that employees can use to keep track of their average score.
The program must allow users to enter their name and current scores. The program will output the user name and the user's average score. The output must meet the following requirements:
The user name must be left-aligned.
If the user name has fewer than 20 characters, additional space must be added to the right.
The average score must have three places to the left of the decimal point and one place to the right of the decimal (XXX.X).
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.

Answer:

Explanation:

References:
https://www.python-course.eu/python3_formatted_output.php

 

NEW QUESTION 38
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.fabs(x)
  • B. math.fmod(x)
  • C. math.frexp(x)
  • D. math.floor(x)
  • E. math.ceil(x)

Answer: A,E

Explanation:
References:
https://docs.python.org/2/library/math.html#number-theoretic-and-representation-functions

 

NEW QUESTION 39
......

100% Free 98-381 Daily Practice Exam With 42 Questions: https://www.validexam.com/98-381-latest-dumps.html