Programming flag variables are used in programs for remembering states or conditions. What are the two best data types to use for flags? Give an example of a flag that remembers if a value is negative, zero or positive.

What will be an ideal response?

Program flags are usually Boolean or integer, and sometime chars. The two best are bools and ints. If a program had to remember if a value was positive, negative or zero, you’d need to use an integer value or char. If you used an int you could set the value to –1, 0, or +1 . If you used a char you could use the letters ‘p’, ‘z’, or ‘n’.

Computer Science & Information Technology

You might also like to view...

In order to add the values stored in the cells from C2 to C32, a user could use this formula: =add(C2:C32)

Indicate whether the statement is true or false

Computer Science & Information Technology

An actor downloads and runs a program against a corporate login page. The program imports a list of usernames and passwords, looking for a successful attempt.Which of the following terms BEST describes the actor in this situation?

A. Script kiddie B. Hacktivist C. Cryptologist D. Security auditor

Computer Science & Information Technology