Home > Microsoft > Quizzes > 98-381: Introduction to Programming Using Python Exam
98-381: Introduction to Programming Using Python Exam
Fast practice, instant feedback. Timer auto-submits when time’s up.
Avg score: 19% Most missed: “You are writing code that generates a random integer with a minimum value of 5 a…”
98-381: Introduction to Programming Using Python Exam
Time left 00:00
9 Questions

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?
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 math functions should you use?
3. 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?
4. 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?
5. 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 code segments should you use?
6. 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?
7. You are writing code that generates a random integer with a minimum value of 5 and a maximum value of 11. Which functions should you use?
8. Evaluate the following Python arithmetic expression: What is the result?
9. 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?