[2021] 98-381 All-in-One Exam Guide Practice To your 98-381 Exam!
Preparations of 98-381 Exam 2021 Microsoft Python Unlimited 42 Questions
Microsoft 98-381 Exam Syllabus Topics:
| Topic | Details |
|---|---|
| Topic 1 |
|
| Topic 2 |
|
| Topic 3 |
|
| Topic 4 |
|
| Topic 5 |
|
| Topic 7 |
|
| Topic 8 |
|
| Topic 9 |
|
NEW QUESTION 11
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:
References:
http://www.informit.com/articles/article.aspx?p=2150451&seqNum=6
NEW QUESTION 12
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:
References:
https://www.w3resource.com/python/python-list.php
NEW QUESTION 13
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 14
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.
Hot Area:
Answer:
Explanation:
Explanation/Reference:
References: https://www.w3resource.com/python/python-if-else-statements.php
NEW QUESTION 15
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:
Section: (none)
Explanation/Reference:
References: https://docs.python.org/3/library/random.html#
NEW QUESTION 16
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 17
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 18
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 19
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 20
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 21
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:
Section: (none)
Explanation/Reference:
References: https://www.w3resource.com/python/python-data-type.php
NEW QUESTION 22
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.
Hot Area:
Answer:
Explanation:
Explanation/Reference:
References: https://www.w3resource.com/python/python-if-else-statements.php
NEW QUESTION 23
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:
References:
https://www.w3resource.com/python/python-data-type.php
NEW QUESTION 24
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:
Section: (none)
Explanation/Reference:
References: https://infohost.nmt.edu/tcc/help/pubs/python/web/import-statement.html
NEW QUESTION 25
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 26
......
Focus on 98-381 All-in-One Exam Guide For Quick Preparation: https://www.realvce.com/98-381_free-dumps.html