If you wrote a program asking the user to enter a color (such as red, blue, etc.) would it be possible to use a switch statement to compare the user’s color to a program color? (In other words, could you use as case statement like this? case “red”:)

What will be an ideal response?


No, you could not use string “red” in a case statement. The switch only allows integer or characters to be compared in a case statement.

Computer Science & Information Technology

You might also like to view...

When a compiler encounters a function parameter for a single-subscripted array of the form int a[], it converts the parameter to:

a. int a b. int &a c. int *a d. No conversion is necessary.

Computer Science & Information Technology

A __________ is the unit of data (for example, a sector) that is transferred between a peripheral device and memory.

a. record b. logical record c. relative record d. physical record

Computer Science & Information Technology

Another name for a rubber ducky antenna is a(n)_______ antenna

Fill in the blank(s) with correct word

Computer Science & Information Technology

In a disjointed ____________________, the name of a child object in the hierarchy does not contain the name of the parent object—for example, the relationship between different trees in the same forest

a. Namespace b. Organizational unit c. Forest d. Hierarchy

Computer Science & Information Technology