[Previous Homework] [Next Homework]

hw04 - Variables


From Linux on the GL machine:
  • Create a text file named Variables.txt in your ./cmsc104/hw04 directory

  • Answer each of the questions below. Number them as they are below. ONE answer per line.

  • Use the SUBMIT utility turn in the homework.
    submit cs104_grasso hw04 Variables.txt

  1. For each of the following, indicate whether they are: 1) reserved word 2) legal indentifier 3) illegal identifier
    1. MIN_COOKIES
    2. date
    3. 123xwy
    4. H
    5. void
    6. homework#2
    7. Mike's
    8. "int"
    9. return
    10. When_Johnny_Comes_Marching_Home_Again_Hurrah_Hurrah
    11. #include
    12. float

  2. Write the following numbers in normal decimal notation
    1. 222e-3
    2. 1.2345e+3
    3. 123.45e+5

  3. Write the following decimal numbers in C scientific notation
    1. 1300000
    2. .12345
    3. 0.00529

  4. Write declaration statements that would declare and initialize variables for the following data using the datatypes of int, double or char. For example: If you are given the data   2 , the declaration statement would look like   int feet = 2;       If the data itself is not in a legal C format, say "illegal". Make sure that the variable names you pick are legal and follow conventions.
    1. 41
    2. -37.491
    3. "T"
    4. 12E-5
    5. 'z'
    6. .912
    7. 4,179
    8. 'RISE'
    9. 'true'
    10. @
    11. '@'