exam questions

Exam 98-381 All Questions

View all questions & answers for the 98-381 exam

Exam 98-381 topic 1 question 35 discussion

Actual exam question from Microsoft's 98-381
Question #: 35
Topic #: 1
[All 98-381 Questions]

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.

  • A. No change is needed
  • B. The code runs, but generates a logic error
  • C. The code will generate a runtime error
  • D. The code will generate a syntax error
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️
References: https://docs.python.org/2/library/exceptions.html

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
sagacious_smith
Highly Voted 4 years, 2 months ago
it will execute without error as long as in.txt file exist. The question does not specifically say that this file exists. However it is safe to assume as question says 'out.txt' does not exist specifically. As python is interpreted language, as long as code is not going to exception, it won't care for any issues there. Hence suggested answer is correct.
upvoted 5 times
Sarah987
2 years, 1 month ago
Also, even without the out.txt file, a file will be created with the file mode 'w+'.
upvoted 1 times
...
...
Mist3
Most Recent 3 years, 12 months ago
Correct. The code executes as long as input file exists.
upvoted 3 times
...
Sathish804
4 years, 4 months ago
Correct answer would be "C" file_name is not defined, code will throw runtime error.
upvoted 2 times
...
cynthya
4 years, 6 months ago
NameError: file_name is not defined
upvoted 2 times
...
Tnk_dragonzpk
4 years, 7 months ago
Where is the underlined text?
upvoted 2 times
Tnk_dragonzpk
4 years, 6 months ago
"The code will execute without error" (Is the underlined text)
upvoted 1 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago