Jan-2022 Microsoft 98-381 Actual Questions and 100% Cover Real Exam Questions [Q18-Q39]

Share

Jan-2022 Microsoft 98-381 Actual Questions and 100% Cover Real Exam Questions

98-381 Free Exam Questions & Answers PDF Updated on Jan-2022


What Is 98-381 Test?

Like other Microsoft tests, it contains 40-60 questions that you have to attempt within 45 minutes. To register for the main validation, you have to pay $127. However, this is not a fixed price and might vary from country to country. Next, this exam comes in English, German, Korean, Simplified Chinese, Spanish, Portuguese, and French.

 

NEW QUESTION 18
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 19
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 20
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 21
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:

Explanation:

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

 

NEW QUESTION 22
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 23
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. name = input
  • C. input(name)
  • D. input("name")

Answer: D

 

NEW QUESTION 24
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 25
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:

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

 

NEW QUESTION 26
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 27
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 = int(input("How many items would you like?"))
  • C. totalItems = float(input("How many items would you like?"))
  • D. totalItems = str(input("How many items would you like?"))

Answer: A

Explanation:
References:
http://www.informit.com/articles/article.aspx?p=2150451&seqNum=6

 

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

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

 

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

Answer: E

 

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

Answer: C,E,F

 

NEW QUESTION 32
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. name = input
  • C. input(name)
  • D. input("name")

Answer: D

 

NEW QUESTION 33
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 34
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:

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

 

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

Answer:

Explanation:

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

 

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

Answer: A,E

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

 

NEW QUESTION 37
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 38
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. name = input()
  • D. input(name)

Answer: C

 

NEW QUESTION 39
......

Microsoft 98-381 Real 2022 Braindumps Mock Exam Dumps: https://www.easy4engine.com/98-381-test-engine.html