Online Access Free 98-381 Practice Test

Exam Code:98-381
Exam Name:Introduction to Programming Using Python
Certification Provider:Microsoft
Free Question Number:42
Posted:Jun 01, 2026
Rating
100%

Question 1

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.

Question 2

You are creating a function that manipulates a number. The function has the following requirements:
* A float is 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.)

Question 3

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.

Question 4

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.

Question 5

You are writing a Python program to automate inventory. Your first task is to read a file of inventory transactions. The file contains sales from the previous day, including the item id, price, and quantity.
The following shows a sample of data from the file:

The code must meet the following requirements:
Each line of the file must be read and printed
If a blank line is encountered, it must be ignored
When all lines have been read, the file must be closed
You create the following code. Line numbers are included for reference only.

Which code should you write for line 05 and line 06?

Add Comments

Your email address will not be published. Required fields are marked *

insert code
Type the characters from the picture.