CS 430/530  Quiz – October 7, 2004

 

Name____________________  Possible points:  10   Earned points :  ____

 

Note:  the numbers in parentheses indicate the points you can earn for each question.  Those with only 1 point are right or wrong (no part credit).

 

  1. What is the definition of a reserved word?    (1)

            A reserved word is a special word that cannot be used as a user-defined name     slide 9

 

  1. What is determined when you specify a type of a variable?          (2)

       the range of values of variables and the set of operations that are defined for values of that

       type; in the case of floating point, type also determines the precision

 

  1. “A binding is an association, such as between an attribute and an entity, or between an operation and a symbol.”   What are the five times when binding can occur? (5)

Language design time --e.g., bind operator symbols to operations

Language implementation time --e.g., bind floating point type to a representation

Compile time --e.g., bind a variable to a type in C or Java

Load time --e.g., bind a FORTRAN 77 variable to a memory cell (or a C static variable)

Runtime --e.g., bind a nonstatic local variable to a memory cell

slide 15

 

  1. What does it mean for a binding to be static? (1)

      A binding is static if it first occurs before run time and remains unchanged throughout  

      program execution.   slide 16

 

  1. “The scope of a variable is the range of statements over which is is visible.”  Using this definition, provide a definition for  the non-local variables of a program unit?  (1)

            The nonlocal variables of a program unit are those that are visible but not declared there

            NOTE: they are not necessarily visible throughout the entire program.