Online Questions - Valid Practice To your 98-381 Exam (Updated 42 Questions) [Q25-Q42]

Share

Online Questions - Valid Practice To your 98-381 Exam (Updated 42 Questions)

Practice To 98-381 - Remarkable Practice On your Introduction to Programming Using Python Exam


More Details about 98-381 Exam Topics

The first tested topic covers the concepts about constructing code segments that perform iteration and use branching statements. The second area focuses on the notions of code segments that perform the file output and input operations along with performing console input and output processes. The next part puts an emphasis on code segments using documents & comment strings and also covers the function definitions. The fourth topic talks about notions of syntax, runtime, and logic errors and as well handles the exception segment. After that, the fifth domain involves the concepts of performing the operations using built-in modules and solving complex computing problems. The last section evaluates the expression to identify the data type Python, performing data type operations, and selecting the appropriate operator to achieve the intended results.


What are the main topics of the Microsoft 98-381 exam?

It is highly recommended for those students who are preparing for this Microsoft exam to visit the official website and find out the information about all the topics that are included in its content. Speaking of the covered subject areas, you should train the following:

  • Perform Operations Using Data Types and Operators (20-25%):

    This part includes the following areas:

    • Evaluate an expression to identify the data type that Python will assign to each variable: The candidates should know how to identify data types, such as string, integer, float, and bool.
    • Perform data and data type operations: The individuals’ abilities to convert from one data type to another, construct data structures, and perform indexing and slicing operations are measured in this domain.

    Moreover, the test takers have to be skilled in determining the sequence of execution based on operator precedence and selection of the appropriate operator to achieve the intended result.

  • Perform Troubleshooting and Error Handlings (5-10%):

    In this section, the applicants have to demonstrate their expertise in analyzing, detecting, and fixing code segments that have errors as well as analyzing and constructing code segments that handle exceptions.

  • Perform Operations Using Modules and Tools (1-5%):

    The last topic is about your competence in built-in modules used to perform basic operations and solve complex computing problems.

  • Document and Structure Code (15-20%):

    This topic is all about the students’ ability to use documentation strings and comments to document code segments construct and analyze code segments, which include function definitions, use indentation, comments, white space, and documentation strings, call signatures, and use pydoc to generate documentation.

  • Control Flow with Decisions and Loops (25-30%):

    Here the learners have to show their knowledge of the construction and analysis of code segments that use branching statements and perform iteration. They should also know about the compound and nested conditional expressions, such as if, else, break, for, pass, while, continue, as well as nested loops and loops that include compound conditional expressions.

  • Perform Output and Input Operations (20-25%):

    This section requires your ability to construct and analyze code segments that perform file input and output operations, such as open, close, read, write, append, check existence, and delete. The candidates’ skills in constructing and analyzing code segments that perform console input and output operations are evaluated as well. They should be able to read input from the console, print formatted text, and use command-line arguments.


Domain Operations through Modules and Tools

The last exam domain is the shortest of all. Only 1-5% of exam content is covered by it. It is designed to impart a foundational understanding about key operations through the in-built modules, knowledge of random, datetime, and math, and solving tedious computing problems.

 

NEW QUESTION 25
You develop a Python application for your school.
You need to read and write data to a text file. If the file does not exist, it must be created. If the file has content, the content must be removed.
Which code should you use?

  • A. open("local_data", "r+")
  • B. open("local_data", "w+")
  • C. open("local_data", "w")
  • D. open("local_data", "r")

Answer: B

Explanation:
Explanation/Reference:
Explanation:
Modes 'r+', 'w+' and 'a+' open the file for updating (reading and writing). Mode 'w+' truncates the file.
References:
https://docs.python.org/2/library/functions.html
https://pythontips.com/2014/01/15/the-open-function-explained/

 

NEW QUESTION 26
You develop a Python application for your school.
You need to read and write data to a text file. If the file does not exist, it must be created. If the file has content, the content must be removed.
Which code should you use?

  • A. open("local_data", "r+")
  • B. open("local_data", "w+")
  • C. open("local_data", "w")
  • D. open("local_data", "r")

Answer: A

Explanation:
References: https://pythontips.com/2014/01/15/the-open-function-explained/

 

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

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.

Answer:

Explanation:

Explanation:

References:
https://www.w3resource.com/python/python-data-type.php
https://www.w3resource.com/python/python-if-else-statements.php

 

NEW QUESTION 28
You develop a Python application for your company.
You want to add notes to your code so other team members will understand it.
What should you do?

  • A. Place the notes before the first line of code separated by a blank line
  • B. Place the notes after the # sign on any line
  • C. Place the notes after the last line of code separated by a blank line
  • D. Place the notes inside of parentheses on any time

Answer: B

Explanation:
References: http://www.pythonforbeginners.com/comments/comments-in-python

 

NEW QUESTION 29
DRAG DROP
You are writing a function that works with files.
You need to ensure that the function returns None if the file does not exist. If the file does exist, the function must return the first line.
You write the following code:

In which order should you arrange the code segments to complete the function? To answer, move all code segments from the list of code segments to the answer area and arrange them in the correct order.

Answer:

Explanation:

Explanation:

References: http://effbot.org/zone/python-with-statement.htm

 

NEW QUESTION 30
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 will generate a syntax error
  • C. The code will generate a runtime error
  • D. The code runs, but generates a logic error

Answer: A

Explanation:
Explanation/Reference:
References: https://docs.python.org/2/library/exceptions.html

 

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

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.
Hot Area:

Answer:

Explanation:

Explanation/Reference:
References:
https://www.w3resource.com/python/python-data-type.php
https://www.w3resource.com/python/python-if-else-statements.php

 

NEW QUESTION 32
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.
Select and Place:

Answer:

Explanation:

Explanation/Reference:
References:
https://docs.python.org/3.1/tutorial/inputoutput.html
https://stackoverflow.com/questions/11619942/print-series-of-prime-numbers-in-python
https://www.programiz.com/python-programming/examples/prime-number-intervals

 

NEW QUESTION 33
HOTSPOT
For each of the following statements, select Yes if the statement is true. Otherwise, select No.
Hot Area:

Answer:

Explanation:

Explanation/Reference:
References: https://docs.python.org/2.0/ref/try.html

 

NEW QUESTION 34
You are writing an application that uses the sqrt function. The program must reference the function using the name squareRoot.
You need to import the function.
Which code segment should you use?

  • A. from math import sqrt as squareRoot
  • B. import math.sqrt as squareRoot
  • C. import sqrt from math as squareRoot
  • D. from math.sqrt as squareRoot

Answer: A

Explanation:
References:
https://infohost.nmt.edu/tcc/help/pubs/python/web/import-statement.html

 

NEW QUESTION 35
HOTSPOT
You develop a Python application for your company.
You have the following code. Line numbers are included for reference only.

Use the drop-down menus to select the answer choice that answers each question based on the information presented in the code segment.
Hot Area:

Answer:

Explanation:

Explanation/Reference:
References: http://www.mathcs.emory.edu/~valerie/courses/fall10/155/resources/op_precedence.html
http://interactivepython.org/runestone/static/pythonds/BasicDS/InfixPrefixandPostfixExpressions.html

 

NEW QUESTION 36
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.

Answer:

Explanation:

Explanation:

References: https://www.w3resource.com/python/python-data-type.php

 

NEW QUESTION 37
You develop a Python application for your company.
You want to add notes to your code so other team members will understand it.
What should you do?

  • A. Place the notes before the first line of code separated by a blank line
  • B. Place the notes after the # sign on any line
  • C. Place the notes after the last line of code separated by a blank line
  • D. Place the notes inside of parentheses on any time

Answer: B

Explanation:
References:
http://www.pythonforbeginners.com/comments/comments-in-python

 

NEW QUESTION 38
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. The code will generate a syntax error
  • B. The code will generate a runtime error
  • C. No change is needed
  • D. The code runs, but generates a logic error

Answer: A

Explanation:
References: https://docs.python.org/2/library/exceptions.html

 

NEW QUESTION 39
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.)

  • A. random.randint(5, 11)
  • B. random.randrange(5, 11, 1)
  • C. random.randrange(5, 12, 1)
  • D. random.randint(5, 12)

Answer: A,B

Explanation:
References:
https://docs.python.org/3/library/random.html#

 

NEW QUESTION 40
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?

  • A. Option B
  • B. Option A
  • C. Option C
  • D. Option D

Answer: A

 

NEW QUESTION 41
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.

Which code should you write at line 02?

  • A. name = input()
  • B. name = input
  • C. input(name)
  • D. input("name")

Answer: D

 

NEW QUESTION 42
......

True 98-381 Exam Extraordinary Practice For the Exam: https://www.actual4dumps.com/98-381-study-material.html