Chapter 5

Concepts of Programming Languages 10th Edition – Robert W. Sebesta
Page 255-260
Lecturer : Tri Djoko Wahjono

Review Questions (Randomly 8 of 23)

  1. What are the design issues for names ? (Number 1)
    Are names case sensitive ? and Are the special words of the language reserved words or keywords ?
  2. What is the potential danger of case-sensitive names ? (Number 2)
    The danger is that you might not be able to find the name in a reference even if you have spelled it correctly, because you haven’t got the case right. Therefore, you won’t find information that you need, or you might incorrectly create a new record with a different case, which nobody else will be able to find because it isn’t with the rest of the information.
  3. What is an alias ? (Number 4)
    An alternative name for an object, such as variable, file, or device.
  4. Define binding and binding time. (Number 7)
    Binding is an association between an attribute and an entity, such as between a variable and its type or value, or between an operation and a symbol. Binding Time is The time at which a binding takes place.
  5. Define static binding and dynamic binding. (Number 9)
    Static Binding is the process of mapping a message to a specific sequence of code (method) at compile-time. Dynamic Binding is the process of mapping a message to a specific sequence of code (method) at runtime.
  6. What is the general problem with static scoping? (Number 15)
    It’s usually too much access. Scope structure destroyed as program evolves.
  7. What is a block? (Number 18)
    The storage of a variable is allocated when the section is entered and deallocated when the section is exited.
  8. What are the advantages of named constants? (Number 23)
    The advantages are readability and modifiability.

Problem Sets (Randomly 4 of 12)

  1. Decide which of the following identifier names is valid in C language. Support your decision. (Number 1)
    _Student = valid, it starts with an underline and it is allowed.
    Int = invalid. It is a reserved name for integer data type.
    Student = valid. It uses capital letter which is allowed.
    123Student=invalid. Variable names in C cannot be started with numbers.
    Student123=valid. Variable in C can contain numbers as long it is not on the front.
  2. What is l-value ? Write a statement in C language which gives the compile time error “l-value required” (Number 2)
    L-value is memory address that are programmatically accessible to the running program.
  3. Why is the type declaration of a variable necessary? What is the value range of the int type variable in Java? (Number 4)
    The type of a variable determines the range of values the variable can store and the set of operations that are defined for values of the type.
    The int type in Java have a value range of –2147483648 to 2147483647.
  4. Assume the following JavaScript program was interpreted using static-scoping rules. What value of x is displayed in function sub1? Under dynamic scoping rules, what value of x is displayed in function sub1?
    var x;
    function sub1(){
       document.write(“x = ” + x + “<br />”);
    function sub2(){
       var x;
       x = 10;
    x = 5;
    sub2(); (Number 7)
    Static scoping: x=5; Dynamic scoping: x=10;
This entry was posted in KBP. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s