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)
SECTION A
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.
SECTION B
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
not closed.
3. Even if Ada used the style of comments used in C and Pascal, bugs caused by not closing comments would be less frequent.
Why?
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?
SECTION C
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.
SECTION D
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
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more