98-381 Practice Exam Tests Latest Updated on Oct-2021
Pass 98-381 Exam in First Attempt Guaranteed Dumps!
NEW QUESTION 12
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 13
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 14
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. input("name")
- D. name = input()
Answer: C
Explanation:
Section: (none)
NEW QUESTION 15
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 16
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 = float(input("How many items would you like?"))
- C. totalItems = int(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 17
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.
Select and Place:
Answer:
Explanation:
Section: (none)
Explanation/Reference:
References: https://www.w3resource.com/python/python-operators.php
NEW QUESTION 18
Evaluate the following Python arithmetic expression:
What is the result?
- A. 0
- B. 1
- C. 2
- D. 3
Answer: C
Explanation:
Explanation/Reference:
References: http://www.mathcs.emory.edu/~valerie/courses/fall10/155/resources/op_precedence.html
NEW QUESTION 19
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(int(end)-int(start)) + "years of service!"
- B. print("Congratulations on" + int(end - start) + "years of service!"
- C. print("Congratulations on" + str(end - start)) + "years of service!"
- D. print("Congratulations on" + (int(end)-int(start)) + "years of service!"
Answer: D
Explanation:
Section: (none)
NEW QUESTION 20
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 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.
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 22
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 23
DRAG DROP
You are writing a Python program that evaluates an arithmetic formula.
The formula is described as b equals a multiplied by negative one, then raised to the second power, where ais the value that will be input and bis the result.
You create the following code segment. Line numbers are included for reference only.
You need to ensure that the result is correct.
How should you complete the code on line 02? To answer, drag the appropriate code segment 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:
Section: (none)
NEW QUESTION 24
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(int(end)-int(start)) + "years of service!"
- B. print("Congratulations on" + int(end - start) + "years of service!"
- C. print("Congratulations on" + str(end - start)) + "years of service!"
- D. print("Congratulations on" + (int(end)-int(start)) + "years of service!"
Answer: D
NEW QUESTION 25
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:
Explanation/Reference:
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 26
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.
Answer:
Explanation:
Explanation:
References: https://www.w3resource.com/python/python-if-else-statements.php
NEW QUESTION 27
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 28
......
Microsoft Python Free Certification Exam Material from TorrentExam with 42 Questions: https://www.torrentexam.com/98-381-exam-latest-torrent.html

