Sams Teach Yourself C in 21 Days

(singke) #1

Workshop ............................................................................................................


The Workshop provides quiz questions to help you solidify your understanding of the
material covered and exercises to provide you with experience in using what you’ve
learned.

Quiz ..............................................................................................................


  1. What is a stream, and what does a C program use streams for?

  2. Are the following input devices or output devices?
    a. Printer
    b. Keyboard
    c. Modem
    d. Monitor
    e. Disk drive

  3. List the five predefined streams and the devices with which they are associated.

  4. What stream do the following functions use?
    a.printf()
    b.puts()
    c.scanf()
    d.gets()
    e.fprintf()

  5. What is the difference between buffered and unbuffered character input from
    stdin?

  6. What is the difference between echoed and unechoed character input from stdin?

  7. Can you “unget” more than one character at a time with ungetc()? Can you
    “unget” the EOFcharacter?

  8. When you use C’s line input functions, how is the end of a line determined?

  9. Which of the following are valid type specifiers?
    a.“%d”
    b.“%4d”
    c.“%3i%c”
    d.“%q%d”
    e.“%%%i”
    f.“%9ld”

  10. What is the difference between stderrandstdout?


374 Day 14

22 448201x-CH14 8/13/02 11:12 AM Page 374

Free download pdf