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. if (isPrime)
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...

Write SQL statements to do the following:

Assume that the following table is created and stored in your database: Staff (staffNo, name, post, salary, sex, DOB) (a) Increment the salary of managers by 5%; (b) Remove the records of all 'salesmen' from the Staff table; (c) List the Staff table tablespace name, pctfree, and pctused.

Computer Science & Information Technology

The Display options available in the Word Options dialog box can be used to turn hidden codes off by default for all Word documents

Indicate whether the statement is true or false

Computer Science & Information Technology

The ________ operating system is owned by Google

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

The ________ Inspector is a tool that reviews a workbook for hidden or personal data stored in the document.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology