BLACK FRIDAY SALE – Unlock Up to 25% OFF on All Exam Prep! - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

WGU Scripting and Programming Foundations (D278) Exam - Topic 3 Question 20 Discussion

Posted by Dorothy on Nov 03, 2026 at 05:11 AM

An algorithm should output "OK" if a number is between 98.3 and 98.9, else the output is "Not OK." Which test is a valid test of the algorithm?

Suggested Answer: B

Comprehensive and Detailed Explanation From Exact Extract:

A valid test checks if the algorithm produces the expected output for a given input, according to its specification. The algorithm outputs 'OK' for numbers in the range [98.3, 98.9] (inclusive or exclusive bounds not specified, but typically inclusive in such problems) and 'Not OK' otherwise. According to foundational programming principles, we evaluate each test case.

Specification:

Input in [98.3, 98.9] Output: 'OK'.

Input outside [98.3, 98.9] Output: 'Not OK'.

Option A: 'Input 98.6. Ensure output is 'Not OK.'' Incorrect. Since 98.6 is between 98.3 and 98.9 (98.3 98.6 98.9), the output should be 'OK', not 'Not OK'. This test is invalid.

Option B: 'Input 98.6. Ensure output is 'OK.'' Correct. 98.6 is within the range, and the expected output is 'OK', making this a valid test.

Option C: 'Input 99.9. Ensure output is 'OK.'' Incorrect. 99.9 is outside the range (99.9 > 98.9), so the output should be 'Not OK', not 'OK'. This test is invalid.

Option D: 'Input 99.9. Ensure output is '98.9.'' Incorrect. The algorithm outputs either 'OK' or 'Not OK', not a numerical value like '98.9'. This test is invalid.

Certiport Scripting and Programming Foundations Study Guide (Section on Algorithm Testing).

General Programming Principles: Testing and Validation.

W3Schools: ''Python Conditions'' (https://www.w3schools.com/python/python_conditions.asp).


Get Premium Scripting and Programming Foundations (D278) Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
6 comments · newest first
BE
Belen 15 hours ago
I think A makes more sense.
LA
Lauran 6 days ago
B is the right choice!
MI
Mike 11 days ago
I vaguely recall that the output should match the input range, so maybe B is right, but I need to double-check the boundaries.
BE
Berry 16 days ago
I feel like option A is definitely wrong since 98.6 is between 98.3 and 98.9, so it can't be "Not OK."
LA
Lashandra 21 days ago
I'm not so sure about that. I remember practicing with similar questions, and I thought the output for 98.6 should be "Not OK."
TA
Tammy 26 days ago
I think option B is correct because 98.6 is within the range, so it should output "OK."
0/2000 characters

Save Cancel