Microsoft 98-381 Introduction to Programming Using Python Exam Practice Test

Page: 1 / 14
Total 40 questions

Question 1

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?



Answer : B

Question 2

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.)



Answer : F

Question 3

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.



Answer : D

Question 4

You develop a Python application for your company.

You want to add notes to your code so other team members will understand it.

What should you do?



Answer : A

Question 5

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.)



Answer : B, E

Page:    1 / 14   
Total 40 questions