200-901 exam dumps

200-901 practice question 168 of 204

Cisco DevNet Associate. Associate level, Cisco. Free question with the correct answer and a full explanation.

200-901 Question 168

Select 2

You are reviewing changes to a Python project stored in a Git repository. Your teammate has submitted a pull request, and you run the 'git diff' command to compare the changes in the branch to the main branch. The unified diff output includes the following lines:

@@ -10,7 +10,7 @@
 def calculate_sum(a, b):
     # Adding two numbers
-    return a + b
+    return a - b

@@ -25,6 +25,7 @@
 print("Welcome to the calculator app!")
 calculate_sum(5, 3)
+print("Subtraction feature added")

What can you infer from this unified diff output?

  1. A

    A line was removed where the 'calculate_sum' function previously added two numbers.

  2. B

    The 'calculate_sum' function was modified to subtract two numbers instead of adding.

  3. C

    A new feature was added to perform subtraction instead of addition.

  4. D

    A new print statement was added to the code after the call to 'calculate_sum'.

  5. E

    The 'print("Welcome to the calculator app!")' line was removed.

Show answer and explanation

Correct answers: B, D

Explanation

In a unified diff, lines prefixed with '-' indicate content removed, '+' indicates content added, and lines without prefixes remain unchanged. The diff output shows the return statement in the 'calculate_sum' function was modified to subtract instead of add. Additionally, a new print statement was added after the call to 'calculate_sum'.

  • A. Incorrect.

    This is incorrect because the unified diff does not indicate a line was removed; rather, it shows a change to the existing 'calculate_sum' function.

  • B. Correct.

    This is correct because the diff shows that the return statement in the 'calculate_sum' function was changed from 'a + b' to 'a - b'.

  • C. Incorrect.

    This is incorrect because the diff does not indicate that a subtraction feature as a new function was added. It only modifies the existing behavior of 'calculate_sum'.

  • D. Correct.

    This is correct because the diff shows that a new line, '+print("Subtraction feature added")', was added to the code.

  • E. Incorrect.

    This is incorrect because the diff does not show the removal of the 'print("Welcome to the calculator app!")' line. That line remains unchanged.

Timed practice exam

Take a 200-901 practice test under exam conditions

75 questions in 120 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam