CSCI 240 - Quiz Questions - Week 7

1. (2) How many characters are there in the extended ASCII character set used on our PCs?
a. 256
b. 127
c. 26
d. it depends on the data type used

2. (2) The data type char and the data type __________ are often interchageable in C.

3. (2) What will happen if you cout a char as an int?
a. you see the character
b. you see the ASCII value of the character
c. it will not compile
d. it will produce a run-time error

4. (2) What is the ASCII value of the character '1'?

5. (2) What is the ASCII value of the character 'c'?

6. (3) Write a cout statement to display the ASCII value of the character stored in a char variable called ch.

7. (2) What is a scalar?  Give an example of a scalar and a non-scalar.

8. (2) Explain what tolower() does.  What are its argument(s) and what does it return?

9. (4) Write a function that takes any digit character as an argument and returns its int value.  So if the argument is '4' the return value is 4.

10. (4) Write a switch statement to print out a string depending on the value of a char variable.  If

Declare any needed variable(s) but you do not need to initialize them.  Assume they have values by the time the switch is executed.