Ultimate Guide to the 98-381 - Latest Dec 07, 2021 Edition Available Now [Q23-Q48]

Share

Ultimate Guide to the 98-381 - Latest Dec 07, 2021 Edition Available Now

2021 Updated Verified 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.


With an aim to prepare a skilled workforce that will have a top-notch understanding of Python language, the Microsoft 98-381 exam has gained global significance and praise. It verifies one's core skills and knowledge providing a strong base for further development.


Introduction to Programming Using Python 98-381 Exam

Introduction to Programming Using Python 98-381 Exam which is related to Microsoft Certified Technology Associate Certification. This exam measures and validates the Candidates ability to recognize and write syntactically correct Python code, recognize data types supported by Python, and have the working experience of writing code of Python language that will logically solve a given problem. Microsoft Technology Associate usually holds or pursue this certification and you can expect the same job role after completion of this certification.

 

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

Answer:

Explanation:

Explanation:

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

 

NEW QUESTION 24
Evaluate the following Python arithmetic expression:

What is the result?

  • A. 0
  • B. 1
  • C. 2
  • D. 3

Answer: A

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

 

NEW QUESTION 25
HOTSPOT
The ABC Video company needs a way to determine the cost that a customer will pay for renting a DVD.
The cost is dependent on the time of day the DVD is returned. However, there are also special rates on Thursdays and Sundays. The fee structure is shown in the following list:
The cost is $1.59 per night.

If the DVD is returned after 8 PM, the customer will be charged an extra day.

If the video is rented on a Sunday, the customer gets 30% off for as long as they keep the video.

If the video is rented on a Thursday, the customer gets 50% off for as long as they keep the video.

You need to write 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:

Section: (none)
Explanation/Reference:
References:
https://www.w3resource.com/python/python-operators.php
https://www.w3resource.com/python/python-if-else-statements.php

 

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

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

 

NEW QUESTION 27
You are writing an application that uses the sqrtfunction. 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.sqrt as squareRoot
  • D. C.from math import sqrt as squareRoot

Answer: D

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

 

NEW QUESTION 28
You are creating a function that manipulates a number. The function has the following requirements:
A floatis 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.frexp(x)
  • C. math.floor(x)
  • D. math.ceil(x)
  • E. math.fmod(x)

Answer: A,D

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

 

NEW QUESTION 29
HOTSPOT
For each of the following statements, select Yes if the statement is true. Otherwise, select No.
Hot Area:

Answer:

Explanation:

Explanation/Reference:
References: https://docs.python.org/2.0/ref/try.html

 

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

Answer:

Explanation:

Explanation:

References: https://www.w3resource.com/python/python-format.php#num

 

NEW QUESTION 31
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. The code runs, but generates a logic error
  • B. The code will generate a syntax error
  • C. No change is needed
  • D. The code will generate a runtime error

Answer: C

Explanation:
Explanation/Reference:
References: https://docs.python.org/2/library/exceptions.html

 

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

Answer:

Explanation:

References:
https://www.w3resource.com/python/python-format.php#num

 

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

Answer:

Explanation:

Explanation:

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

 

NEW QUESTION 34
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.randrange(5, 11, 1)
  • B. random.randint(5, 12)
  • C. random.randint(5, 11)
  • D. random.randrange(5, 12, 1)

Answer: A,C

Explanation:
References:
https://docs.python.org/3/library/random.html#

 

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

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

 

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

Answer: A

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

 

NEW QUESTION 38
HOTSPOT
The ABC Video company needs a way to determine the cost that a customer will pay for renting a DVD.
The cost is dependent on the time of day the DVD is returned. However, there are also special rates on Thursdays and Sundays. The fee structure is shown in the following list:
The cost is $1.59 per night.
If the DVD is returned after 8 PM, the customer will be charged an extra day.
If the video is rented on a Sunday, the customer gets 30% off for as long as they keep the video.
If the video is rented on a Thursday, the customer gets 50% off for as long as they keep the video.
You need to write code to meet the requirements.
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-operators.php
https://www.w3resource.com/python/python-if-else-statements.php

 

NEW QUESTION 39
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 06
  • B. Line 03
  • C. Line 01
  • D. Line 04
  • E. Line 07
  • F. Line 05
  • G. Line 08
  • H. Line 02

Answer: A,E,G

 

NEW QUESTION 40
HOTSPOT
You are writing a Python program to validate employee numbers.
The employee number must have the format ddd-dd-dddd and consist only of numbers and dashes. The
program must print Trueif the format is correct and print Falseif the format is incorrect.
How should you complete the code? To answer, select the appropriate code segments in the answer area.
Hot Area:

Answer:

Explanation:

 

NEW QUESTION 41
You develop a Python application for your company.
A list named employees contains 200 employee names, the last five being company management. You need
to slice the list to display all employees excluding management.
Which two code segments should you use? Each correct answer presents a complete solution. (Choose two.)

  • A. employees [1:-5]
  • B. employees [0:-4]
  • C. employees [1:-4]
  • D. employees [0:-5]
  • E. employees [:-5]

Answer: D,E

Explanation:
Explanation/Reference:
References: https://www.w3resource.com/python/python-list.php#slice

 

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

Answer:

Explanation:

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

 

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

Answer: A

Explanation:
Section: (none)
Explanation/Reference:
References: https://pythontips.com/2014/01/15/the-open-function-explained/

 

NEW QUESTION 44
Evaluate the following Python arithmetic expression:

What is the result?

  • A. 0
  • B. 1
  • C. 2
  • D. 3

Answer: A

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

 

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

Answer:

Explanation:

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

 

NEW QUESTION 46
You are creating a function that manipulates a number. The function has the following requirements:
* A floatis 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.frexp(x)
  • C. math.ceil(x)
  • D. math.floor(x)
  • E. math.fmod(x)

Answer: A,D

Explanation:
C: math.floor(x) returns the largest integer less than or equal to x.
E: math.fabs(x) returns the absolute value of x.
Incorrect Answers:
A: math.fmod() takes two variables
B: math.frexp(x) returns the mantissa and exponent of x as the pair (m, e). m is a float and e is an integer
D: math.ceil(x) returns the smallest integer greater than or equal to x
References: https://docs.python.org/2/library/math.html#number-theoretic-and-representation-functions
https://docs.python.org/3/library/math.html

 

NEW QUESTION 47
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. 04 def calc_calories(miles, burn_rate):
  • B. 04 def calc_calories():
  • C. 01 def get_name(name):
  • D. 01 def get_name(biker):
  • E. 04 def calc_calories(miles, calories_per_mile):
  • F. 01 def get_name():

Answer: A,D

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

 

NEW QUESTION 48
......

Dumps Moneyack Guarantee - 98-381 Dumps Approved Dumps: https://www.testkingpass.com/98-381-testking-dumps.html