Docsity

Midterm Exam - Principle Programming Language | CS 310, Exams of Computer Science

Toggle sidebar
bg1
Principles of Programming Languages - Midterm
K. Subramani
LCSEE,
West Virginia University,
Morgantown, WV
1 Instructions
1. Each question is worth 4points.
2. Attempt as many problems as you can. You will be given partial credit, as per the policy discussed in class.
3. The Midterm needs to be turned in by 3 : 10 pm., March 2, 2004.
2 Problems
1. Enumerate the different times at which the attributes of a name can be bound. Give one example for each.
2. Briefly explain with examples, the concepts of visibility, scope and scope holes, associated with bindings.
3. Consider the following Expression Grammar:
expr โ†’expr โˆ—expr |expr / expr |number
number โ†’digit number |dig it
digit โ†’0|1|2|3|4|5|6|7|8|9
Identify the problems with the above grammar.
4. Write a new set of rules for the above Expression Grammar such that the problems that you have identified are fixed.
5. Enumerate the different ways in which Computer Scientists have tried to specify semantics of programming lan-
guages, over the years. Identify a shortcoming for each method employed.
1

Partial preview of the text

Download Midterm Exam - Principle Programming Language | CS 310 and more Exams Computer Science in PDF only on Docsity!

Principles of Programming Languages - Midterm

K. Subramani

LCSEE,

West Virginia University,

Morgantown, WV

{[email protected]}

1 Instructions

  1. Each question is worth 4 points.
  2. Attempt as many problems as you can. You will be given partial credit, as per the policy discussed in class.
  3. The Midterm needs to be turned in by 3 : 10 pm., March 2 , 2004.

2 Problems

  1. Enumerate the different times at which the attributes of a name can be bound. Give one example for each.
  2. Briefly explain with examples, the concepts of visibility, scope and scope holes, associated with bindings.
  3. Consider the following Expression Grammar: expr โ†’ expr โˆ— expr | expr / expr | number number โ†’ digit number | digit digit โ†’ 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Identify the problems with the above grammar.
  4. Write a new set of rules for the above Expression Grammar such that the problems that you have identified are fixed.
  5. Enumerate the different ways in which Computer Scientists have tried to specify semantics of programming lan- guages, over the years. Identify a shortcoming for each method employed.