98-381 Introduction to Programming Using Python

Loading demo links...

Showing 4–5 of 5 questions

Question 4

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

Select all that apply, then click Submit answer.

  • random.randint(5, 12)

  • random.randint(5, 11)

  • random.randrange(5, 12, 1)

  • random.randrange(5, 11, 1)

Question 5

This question requires that you evaluate the underlined text to determine if it is correct.

You write the following code:

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.

Select an option, then click Submit answer.

  • No change is needed

  • The code runs, but generates a logic error

  • The code will generate a runtime error

  • The code will generate a syntax error