[Sep-2021] Pass Microsoft 98-381 Exam in First Attempt Guaranteed! [Q22-Q44]

Share

[Sep-2021] Pass Microsoft 98-381 Exam in First Attempt Guaranteed!

Full 98-381 Practice Test and 42 unique questions with explanations waiting just for you, get it now!

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

Answer:

Explanation:

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

 

NEW QUESTION 24
DRAG DROP
You are writing a Python program to perform arithmetic operations.
You create the following code:


What is the result of each arithmetic expression? To answer, drag the appropriate expression from the column on the left to its result on the right. Each expression may be used once, more than once, or not at all.

Answer:

Explanation:

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

 

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

Answer: B

 

NEW QUESTION 26
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 27
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. The code will generate a runtime error
  • D. No change is needed

Answer: D

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

 

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

Answer: B

 

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

Answer: A

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 30
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 31
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. input(name)
  • B. name = input
  • C. name = input()
  • D. input("name")

Answer: C

 

NEW QUESTION 32
DRAG DROP
You are writing a Python program to perform arithmetic operations.
You create the following code:


What is the result of each arithmetic expression? To answer, drag the appropriate expression from the column on the left to its result on the right. Each expression may be used once, more than once, or not at all.

Answer:

Explanation:

Explanation:

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

 

NEW QUESTION 33
Evaluate the following Python arithmetic expression:

What is the result?

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

Answer: C

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

 

NEW QUESTION 34
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 True if the format is correct and print False if the format is incorrect.
How should you complete the code? To answer, select the appropriate code segments in the answer area.

Answer:

Explanation:

 

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

Answer:

Explanation:

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

 

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

Answer: A,D,E

 

NEW QUESTION 39
DRAG DROP
You are building a Python program that displays all of the prime numbers from 2 to 100.
How should you complete the code? To answer, drag the appropriate code segments 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:

Explanation:

Explanation/Reference:
References:
https://docs.python.org/3.1/tutorial/inputoutput.html
https://stackoverflow.com/questions/11619942/print-series-of-prime-numbers-in-python
https://www.programiz.com/python-programming/examples/prime-number-intervals

 

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

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

 

NEW QUESTION 41
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 42
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.

Answer:

Explanation:

Explanation:

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

 

NEW QUESTION 43
HOTSPOT
You are developing a Python application for your company.
You write the following code:

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: https://www.w3resource.com/python/python-list.php

 

NEW QUESTION 44
......

Get Latest 98-381 Dumps Exam Questions in here: https://www.vcedumps.com/98-381-examcollection.html