Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this activity, you are going to be thinking about how to test the isPrime function which takes a number and tests if it is
In this activity, you are going to be thinking about how to test the isPrime function which takes a number and tests if it is prime.
For each question, we will describe a mistake that the programmer might have made in writing isPrime. We will imagine that there
is a check function that takes the number with which to test isPrime, and the expected answer True or False The check function
might look something like this:
For each question, your answer should be a single call to check that identifies the problem described in the question prompt. For
example, if the question prompt suggests that isPrime does not work correctly, you could answer
check True
to identify the mistake.
Suppose the programmer writing isPrime mistakenly thought that all prime numbers were odd, so they first
checked if the number passed in is even, and if so returned False right away.
That looks like a great testcase
Suppose the programmer could not think of a general algorithm so instead they just checked several specific case
with the first several prime numbers:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started