Suppose isPrime is a boolean variable, which of the following is the correct and best statement for testing if isPrime is true.

a. if (isPrime = true)
b. if (isPrime == true)
c. if (isPrime)
d. if (!isPrime = false)
e. if (!isPrime == false)


c A and D are incorrect. B, C, and E are correct. But C is the simplest and thus the best.

Computer Science & Information Technology

You might also like to view...

Consequentialism is the theory that states that the end result behind an action, not the motivation behind the action, makes the action either good or bad.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

In a mail merge, the ________ holds the text that remains constant

Fill in the blank(s) with correct word

Computer Science & Information Technology

Pages of the body of the report are numbered at the top right.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

To calculate a mortgage payment based on varying interest rates and loan terms, you could use a(n) ____.

A. two-input data table B. scenario summary C. one-input data table D. linear regression

Computer Science & Information Technology