[Q23-Q48] Latest Microsoft 98-381 First Attempt, Exam real Dumps Updated [Dec-2021]

Share

Latest Microsoft 98-381 First Attempt, Exam real Dumps Updated [Dec-2021]

Get the superior quality 98-381 Dumps Questions from iPassleader. Nobody can stop you from getting to your dreams now. Your bright future is just a click away!

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

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

 

NEW QUESTION 24
Evaluate the following Python arithmetic expression:

What is the result?

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

Answer: A

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

 

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

Answer: C,D

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

 

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

Answer: B

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

 

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

Answer:

Explanation:

Explanation:

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 31
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.
Hot Area:

Answer:

Explanation:

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

 

NEW QUESTION 32
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 33
You are creating a Python program that shows a congratulation message to employees on their service anniversary.
You need to calculate the number of years of service and print a congratulatory message.
You have written the following code. Line numbers are included for reference only.

You need to complete the program.
Which code should you use at line 03?

  • A. print("Congratulations on" + str(end - start)) + "years of service!"
  • B. print("Congratulations on" + str(int(end)-int(start)) + "years of service!"
  • C. print("Congratulations on" + (int(end)-int(start)) + "years of service!"
  • D. print("Congratulations on" + int(end - start) + "years of service!"

Answer: C

 

NEW QUESTION 34
You are creating a Python program that shows a congratulation message to employees on their service anniversary.
You need to calculate the number of years of service and print a congratulatory message.
You have written the following code. Line numbers are included for reference only.

You need to complete the program.
Which code should you use at line 03?

  • A. print("Congratulations on" + str(end - start)) + "years of service!"
  • B. print("Congratulations on" + str(int(end)-int(start)) + "years of service!"
  • C. print("Congratulations on" + (int(end)-int(start)) + "years of service!"
  • D. print("Congratulations on" + int(end - start) + "years of service!"

Answer: C

Explanation:
Section: (none)

 

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

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

 

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

Explanation:

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

 

NEW QUESTION 39
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. 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 40
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.

Answer:

Explanation:

Explanation:

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

 

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

Answer: B,C

Explanation:
Explanation/Reference:
References: https://docs.python.org/3/library/random.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.
Hot Area:

Answer:

Explanation:

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

 

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

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

 

NEW QUESTION 45
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 46
HOTSPOT
You are developing a Python application for an online product distribution company.
You need the program to iterate through a list of products and escape when a target product ID is found.
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.
Hot Area:

Answer:

Explanation:

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

 

NEW QUESTION 47
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 48
......

Guaranteed Success with Valid Microsoft 98-381 Dumps: https://www.ipassleader.com/Microsoft/98-381-practice-exam-dumps.html