Microsoft Introduction to Programming Using Python - 98-381 Exam Practice Test
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.

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.

Correct Answer:

References:
https://www.w3resource.com/python/python-user-defined-functions.php
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?
You need to import the function.
Which code segment should you use?
Correct Answer: B
Vote an answer
Explanation: Only visible for Fast2test members. You can sign-up / login (it's free).
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?
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?
Correct Answer: D
Vote an answer
Explanation: Only visible for Fast2test members. You can sign-up / login (it's free).
Evaluate the following Python arithmetic expression:

What is the result?

What is the result?
Correct Answer: A
Vote an answer
Explanation: Only visible for Fast2test members. You can sign-up / login (it's free).
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.)
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.)
Correct Answer: C
Vote an answer
Explanation: Only visible for Fast2test members. You can sign-up / login (it's free).