March Sale Special Limited Time Flat 70% Discount offer - Ends in 0d 00h 00m 00s - Coupon code: 70spcl

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

Note! Following 98-381 Exam is Retired now. Please select the alternative replacement for your Exam Certification.
Page: 1 / 4
Total 40 questions

Introduction to Programming Using Python Questions and Answers

Question 1

You are writing a Python program to perform arithmetic operations.

You create the following code:

Question # 1

Question # 1

What is the result of each arithmetic expression? To answer, drag the appropriate expression from the column on the left to its result on the right. Each expression may be used once, more than once, or not at all.

Options:

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

Options:

A.

math.fmod(x)

B.

math.frexp(x)

C.

math.floor(x)

D.

math.ceil(x)

E.

math.fabs(x)

Question 3

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.

Question # 3

Options:

Question 4

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.

Question # 4

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

Options:

A.

01 def get_name():

B.

01 def get_name(biker):

C.

01 def get_name(name):

D.

04 def calc_calories():

E.

04 def calc_calories(miles, burn_rate):

F.

04 def calc_calories(miles, calories_per_mile):

Question 5

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.

Question # 5

Which code should you write at line 02?

Options:

A.

name = input

B.

input(“name”)

C.

input(name)

D.

name = input()

Question 6

You create a function to calculate the power of a number by using Python.

You need to ensure that the function is documented with comments.

You create the following code. Line numbers are included for reference only.

Question # 6

For each of the following statements, select Yes if the statement is true. Otherwise, select No.

Answer Area

Question # 6

Options:

Page: 1 / 4
Total 40 questions