How might user data be validated?

What will be an ideal response?


When you ask a user to enter data into a computer program, you have no assurance that the data the user enters will be accurate. Loops are frequently used to validate data; that is, to make sure it falls within an acceptable range. For example, suppose part of a program you are writing asks a user to enter a number that represents his or her birth month. If the user types a number less than 1 or greater than 12, you must take some sort of action. For example:
• You could display an error message and stop the program.
• You could choose to assign a default value for the month (for example, 1) before proceeding.
• You could reprompt the user for valid input.

Computer Science & Information Technology

You might also like to view...

The command ls ?? matches the filename(s)

a: AB and ab b: abc c: ?? d: AAAA e: CCAA

Computer Science & Information Technology

The Disk Utility application in OS X includes which capability?

A) Delete, add, and resize disk partitions. B) Wipe (erase) data from the disk. C) Wipe all data on the computer system. D) All answers are capabilities of Disk Utility.

Computer Science & Information Technology

Why are all computer decisions true-or-false decisions?

What will be an ideal response?

Computer Science & Information Technology

In the accompanying figure, the words Datasheet View at the lower left of the screen appear on the ____________________.

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

Computer Science & Information Technology