Introduction To Programming Using Python 98-381 Practice

Want to know Exambible 98-381 Exam practice test features? Want to lear more about Microsoft Introduction to Programming Using Python certification experience? Study Breathing Microsoft 98-381 answers to Regenerate 98-381 questions at Exambible. Gat a success with an absolute guarantee to pass Microsoft 98-381 (Introduction to Programming Using Python) test on your first attempt.

Page: 1 / 3
Total 40 questions Full Exam Access
Question 1
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 two code segments should you use? Each correct answer presents a complete solution. (Choose two.)
My answer: -
Reference answer: E
Reference analysis:

References: https://www.w3resource.com/python/python-list.php#slice

Question 2
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?
My answer: -
Reference answer: B
Reference analysis:

References: https://pythontips.com/2014/01/15/the-open-function-explained/

Question 3
HOTSPOT
You are developing a Python application for your company. You write the following code:
98-381 dumps exhibit
Use the drop-down menus to select the answer choice that answers each question based on the information presented in the code segment.
98-381 dumps exhibit
Solution:
References: https://www.w3resource.com/python/python-list.php

Does this meet the goal?
My answer: -
Reference answer: A
Reference analysis:

None

Question 4
HOTSPOT
The ABC company is building a basketball court for its employees to improve company morale.
You are creating a Python program that employees can use to keep track of their average score.
The program must allow users to enter their name and current scores. The program will output the user name and the user’s average score. The output must meet the following requirements:
✑ The user name must be left-aligned.
✑ If the user name has fewer than 20 characters, additional space must be added to the right.
✑ The average score must have three places to the left of the decimal point and one place to the right of the decimal (XXX.X).
How should you complete the code? To answer, select the appropriate code segments in the answer area.
NOTE: Each correct selection is worth one point.
98-381 dumps exhibit
Solution:
References: https://www.python-course.eu/python3_formatted_output.php

Does this meet the goal?
My answer: -
Reference answer: A
Reference analysis:

None

Question 5
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?
My answer: -
Reference answer: C
Reference analysis:

References: https://infohost.nmt.edu/tcc/help/pubs/python/web/import-statement.html

Question 6
DRAG DROP
Match the data type to the type operations.
To answer, drag the appropriate data type to the correct type operation. Each data type may be used once, more than once, or not at all.
98-381 dumps exhibit
Solution:
References: https://www.w3resource.com/python/python-data-type.php

Does this meet the goal?
My answer: -
Reference answer: A
Reference analysis:

None

Question 7
Evaluate the following Python arithmetic expression:
98-381 dumps exhibit
What is the result?
My answer: -
Reference answer: C
Reference analysis:

References: http://www.mathcs.emory.edu/~valerie/courses/fall10/155/resources/op_precedence.html

Question 8
This question requires that you evaluate the underlined text to determine if it is correct.
You write the following code:
98-381 dumps exhibit
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.
My answer: -
Reference answer: D
Reference analysis:

References: https://docs.python.org/2/library/exceptions.html

Question 9
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.
98-381 dumps exhibit
Solution:
References: https://www.w3resource.com/python/python-user-defined-functions.php

Does this meet the goal?
My answer: -
Reference answer: A
Reference analysis:

None

Question 10
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.)
My answer: -
Reference answer: DE
Reference analysis:

References: https://docs.python.org/2/library/math.html#number-theoretic-and- representation-functions

Question 11
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.
98-381 dumps exhibit
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.)
My answer: -
Reference answer: F
Reference analysis:

None

Question 12
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.
98-381 dumps exhibit
Solution:
References:
https://www.w3resource.com/python/python-operators.php https://www.w3resource.com/python/python-if-else-statements.php

Does this meet the goal?
My answer: -
Reference answer: A
Reference analysis:

None

Question 13
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?
My answer: -
Reference answer: A
Reference analysis:

References: http://www.informit.com/articles/article.aspx?p=2150451&seqNum=6

Question 14
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?
My answer: -
Reference answer: A
Reference analysis:

References: http://www.pythonforbeginners.com/comments/comments-in-python

Question 15
HOTSPOT
For each of the following statements, select Yes if the statement is true. Otherwise, select No.
98-381 dumps exhibit
Solution:
References: https://docs.python.org/2.0/ref/try.html

Does this meet the goal?
My answer: -
Reference answer: A
Reference analysis:

None

Question 16
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:
98-381 dumps exhibit
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.
98-381 dumps exhibit
Which code should you write for line 05 and line 06?
98-381 dumps exhibit
My answer: -
Reference answer: B
Reference analysis:

None

Question 17
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.
98-381 dumps exhibit
Solution:
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

Does this meet the goal?
My answer: -
Reference answer: A
Reference analysis:

None

Question 18
You are writing code that generates a random integer with a minimum value of 5 and a maximum value of 11.
Which two functions should you use? Each correct answer presents a complete solution. (Choose two.)
My answer: -
Reference answer: BD
Reference analysis:

References: https://docs.python.org/3/library/random.html#

Question 19
HOTSPOT
You are coding a math utility by using Python. You are writing a function to compute roots.
The function must meet the following requirements:
98-381 dumps exhibit
How should you complete the code? To answer, select the appropriate code segments in the answer area.
98-381 dumps exhibit
Solution:
References: https://www.w3resource.com/python/python-if-else-statements.php

Does this meet the goal?
My answer: -
Reference answer: A
Reference analysis:

None

Page: 1 / 3
Total 40 questions Full Exam Access