98-381 : Introduction to Programming Using Python : Part 01

  1. HOTSPOT

    You are writing a Python program to validate employee numbers.

    The employee number must have the format ddd-dd-dddd and consist only of numbers and dashes. The program must print True if the format is correct and print False if the format is incorrect.

    How should you complete the code? To answer, select the appropriate code segments in the answer area.

    98-381 Part 01 Q01 001 Question
    98-381 Part 01 Q01 001 Question
    98-381 Part 01 Q01 001 Answer
    98-381 Part 01 Q01 001 Answer
  2. 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 Part 01 Q02 002
    98-381 Part 01 Q02 002

    How should you complete the code? To answer, select the appropriate code segments in the answer area.

    98-381 Part 01 Q02 003 Question
    98-381 Part 01 Q02 003 Question
    98-381 Part 01 Q02 003 Answer
    98-381 Part 01 Q02 003 Answer
  3. HOTSPOT

    You work for a company that distributes media for all ages.

    You are writing a function that assigns a rating based on a user’s age. The function must meet the following requirements:
    – Anyone 18 years old or older receives a rating of “A”
    – Anyone 13 or older, but younger than 18, receives a rating of “T”
    – Anyone 12 years old or younger receives a rating of “C”
    If the age is unknown, the rating is set to “C”

    You need to complete the code to meet the requirements.

    How should you complete the code? To answer, select the appropriate code segments in the answer area.

    98-381 Part 01 Q03 004 Question
    98-381 Part 01 Q03 004 Question
    98-381 Part 01 Q03 004 Answer
    98-381 Part 01 Q03 004 Answer
  4. HOTSPOT

    You are designing a decision structure to convert a student’s numeric grade to a letter grade. The program must assign a letter grade as specified in the following table:

    98-381 Part 01 Q04 005
    98-381 Part 01 Q04 005

    For example, if the user enters a 90, the output should be, “Your letter grade is A”. Likewise, if a user enters an 89, the output should be “Your letter grade is B”.

    How should you complete the code? To answer, select the appropriate code segments in the answer area.

    98-381 Part 01 Q04 006 Question
    98-381 Part 01 Q04 006 Question
    98-381 Part 01 Q04 006 Answer
    98-381 Part 01 Q04 006 Answer
  5. HOTSPOT

    You are developing a Python application for an online product distribution company.

    You need the program to iterate through a list of products and escape when a target product ID is found.

    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 Part 01 Q05 007 Question
    98-381 Part 01 Q05 007 Question
    98-381 Part 01 Q05 007 Answer
    98-381 Part 01 Q05 007 Answer
  6. 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 Part 01 Q06 008 Question
    98-381 Part 01 Q06 008 Question
    98-381 Part 01 Q06 008 Answer
    98-381 Part 01 Q06 008 Answer
  7. DRAG DROP

    You are creating a Python script to evaluate input and check for upper and lower case.

    Which four code segments should you use to develop the solution? To answer, move the appropriate code segment from the list of code segments to the answer area and arrange them in the correct order.

    98-381 Part 01 Q07 009 Question
    98-381 Part 01 Q07 009 Question
    98-381 Part 01 Q07 009 Answer
    98-381 Part 01 Q07 009 Answer
  8. HOTSPOT

    You develop a Python application for your company.

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

    98-381 Part 01 Q08 010
    98-381 Part 01 Q08 010

    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 Part 01 Q08 011 Question
    98-381 Part 01 Q08 011 Question
    98-381 Part 01 Q08 011 Answer
    98-381 Part 01 Q08 011 Answer
  9. 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?

    • totalItems = input(“How many items would you like?”)
    • totalItems = float(input(“How many items would you like?”))
    • totalItems = str(input(“How many items would you like?”))
    • totalItems = int(input(“How many items would you like?”))
  10. HOTSPOT

    You create the following program to locate a conference room and display the room name. Line numbers are included for reference only.

    98-381 Part 01 Q10 012
    98-381 Part 01 Q10 012

    Colleagues report that the program sometimes produces incorrect results.
    You need to troubleshoot the program. 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 Part 01 Q10 013 Question
    98-381 Part 01 Q10 013 Question
    98-381 Part 01 Q10 013 Answer
    98-381 Part 01 Q10 013 Answer
  11. HOTSPOT

    During school holidays, you volunteer to explain some basic programming concepts to younger siblings.
    You want to introduce the concept of data types in Python. You create the following three code segments:

    98-381 Part 01 Q11 014
    98-381 Part 01 Q11 014

    You need to evaluate the code segments.

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

    NOTE: Each correct selection is worth one point.

    98-381 Part 01 Q11 015 Question
    98-381 Part 01 Q11 015 Question
    98-381 Part 01 Q11 015 Answer
    98-381 Part 01 Q11 015 Answer

    Explanation:

    – Code Segment 1: You cannot convert str to int. x1 = “2” is a string. Therefore code will produce an error.
    – Code Segment 2: b = 1.5, which is a float.
    – Code Segment 3: c = 2.5, which is a float, not an int.

  12. 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 Part 01 Q12 016 Question
    98-381 Part 01 Q12 016 Question
    98-381 Part 01 Q12 016 Answer
    98-381 Part 01 Q12 016 Answer
  13. 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.

    98-381 Part 01 Q13 017 Question
    98-381 Part 01 Q13 017 Question
    98-381 Part 01 Q13 017 Answer
    98-381 Part 01 Q13 017 Answer
  14. 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 Part 01 Q14 018 Question
    98-381 Part 01 Q14 018 Question
    98-381 Part 01 Q14 018 Answer
    98-381 Part 01 Q14 018 Answer
  15. DRAG DROP

    The ABC company is converting an existing application to Python. You are creating documentation that will be used by several interns who are working on the team.

    You need to ensure that arithmetic expressions are coded correctly.

    What is the correct order of operations for the six classes of operations ordered from first to last in order of precedence? To answer, move all operations from the list of operations to the answer area and arrange them in the correct order.

    98-381 Part 01 Q15 019 Question
    98-381 Part 01 Q15 019 Question
    98-381 Part 01 Q15 019 Answer
    98-381 Part 01 Q15 019 Answer
  16. 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.

    98-381 Part 01 Q16 020 Question
    98-381 Part 01 Q16 020 Question
    98-381 Part 01 Q16 020 Answer
    98-381 Part 01 Q16 020 Answer
  17. 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.

    98-381 Part 01 Q17 021
    98-381 Part 01 Q17 021

    You need to complete the program.

    Which code should you use at line 03?

    • print(“Congratulations on” + (int(end)-int(start)) +
      “years of service!”)
    • print(“Congratulations on” + str(int(end)-int(start)) +
      “years of service!”)
    • print(“Congratulations on” + int(end – start) +
      “years of service!”)
    • print(“Congratulations on” + str(end – start)) +
      “years of service!”)
  18. HOTSPOT

    You are developing a Python application for your company.

    You write the following code:

    98-381 Part 01 Q18 022
    98-381 Part 01 Q18 022

    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 Part 01 Q18 023 Question
    98-381 Part 01 Q18 023 Question
    98-381 Part 01 Q18 023 Answer
    98-381 Part 01 Q18 023 Answer
  19. DRAG DROP

    You are writing a Python program to perform arithmetic operations.

    You create the following code:

    98-381 Part 01 Q19 024
    98-381 Part 01 Q19 024

    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.

    98-381 Part 01 Q19 025 Question
    98-381 Part 01 Q19 025 Question
    98-381 Part 01 Q19 025 Answer
    98-381 Part 01 Q19 025 Answer
  20. DRAG DROP

    You are writing a Python program that evaluates an arithmetic formula.

    The formula is described as b equals a multiplied by negative one, then raised to the second power, where a is the value that will be input and b is the result.

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

    98-381 Part 01 Q20 026
    98-381 Part 01 Q20 026

    You need to ensure that the result is correct.

    How should you complete the code on line 02? To answer, drag the appropriate code segment 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 Part 01 Q20 027 Question
    98-381 Part 01 Q20 027 Question
    98-381 Part 01 Q20 027 Answer
    98-381 Part 01 Q20 027 Answer
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments