Exampractice

98-381 Line Practice Questions

The free 98-381: Introduction to Programming Using Python questions that deal with line, with answers and explanations. The full bank and the timed practice test cover every topic the exam asks about.

Question #6

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?

Question #7

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

Select 3 answers.

Question #8

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?

Continue with 98-381: Introduction to Programming Using Python

Unlock the full question bank

You have read the first 10 questions. A subscription opens every question in 98-381: Introduction to Programming Using Python, the full timed practice test, and your progress and weak-topic reporting.

  • Single exam

    $19.99for 30 days

    Full question bank and practice test for one exam, for 30 days.

  • Single exam

    $49.99for 1 year

    One exam for a full year. Nothing renews and nothing to cancel.

  • Full access

    $39.99/mo

    Every exam in the catalogue, month to month.

  • Full access

    $199.99/yr

    Every exam in the catalogue for a year.

Already subscribed? Sign in to pick up where you left off.

All 98-381: Introduction to Programming Using Python practice questions →