Posted: September 18th, 2017
DEPARTMENT OF COMPUTER SCIENCE
UNIVERSITY OF CALABAR
FIRST SEMESTER OPEN-BOOK/TAKE-HOME TEST, PGD-2014/2015 SESSION (27th July, 2015)
CSC 501- ORGANISATION OF PROGRAMMING LANGUAGES
TIME: 2 WEEKS (SUBMISSION DUE DATE: MON, 10th Aug, 2015)
INSTRUCTION: ANSWER ANY TWO QUESTIONS FROM EACH SECTION
(HINT: These questions are as extracted from the work of, Understanding Programming Languages, by M. Ben-Ari)
1. Describe how to implement a compiler for a language in the same language (“bootstrap- ping”).
2. Invent a syntax for an APL-like matrix-based language that uses ordinary characters.
3. Write a list of interesting operations on strings and compare your list with the predefined operations of SNOBOL and Icon.
4. Write a list of interesting operations on sets and compare your list with the predefined operations of SETL.
5. Simulate a (universal) Turing machine in several programming languages.
1. Translate (part of) the BNF syntax of C or Ada into syntax diagrams.
2. Write a program in Pascal or C that compiles and executes, but computes the wrong answer because of a comment that was
3. Even if Ada used the style of comments used in C and Pascal, bugs caused by not closing comments would be less frequent.
4. In most languages, keywords like begin and while are reserved and may not be used as identifiers. Other languages like
FORTRAN and PL/I do not have reserved keywords. What are the advantages and disadvantages of reserved words?
1. Study your compiler’s documentation and list the optimizations that it performs. Write programs and check the resulting object
code for the optimizations.
2. What information does the debugger need from the compiler and linker?
3. Run a profiler and study how it works.
4. How can you write your own simple testing tool? What influence does automated testing have on program design?
5. AdaS is an interpreter for a subset of Ada written in Pascal. It works by compiling the source into P-Code and then executing
the P-Code. Study the AdaS program and write a description of the P-Code machine.
1. Read your compiler documentation and list the precisions used for the different integer types.
2. Write 200 + 55 = 255 and 100 −150 = −50 in two’s complement nota
Place an order in 3 easy steps. Takes less than 5 mins.