Professional Documents
Culture Documents
SECTION “A”
[20 Q. 0.5 = 10 marks]
Choose the most appropriate answer.
1. The first language for scientific application was .
[ ] ALGOL 60 [ ] FORTRAN [ ] LISP [ ] Prolog
4. A grammar that generates a sentential form for which there are distinct parse
trees is said to be ambiguous.
[ ] Two [ ] Three [ ] Four [ ] All given options
12. The database of the prolog program consist of two kinds of statements, which are
[ ] list and atoms [ ] list and facts
[ ] facts and rules [ ] atoms and rules
15. Which of the following is the advantage of declarative languages over imperative
languages?
[ ] Can use abstract data type [ ] Easy to verify the properties of the program
[ ] Is more efficient [ ] Can be strong-typed
1. In what language is UNIX written? What is aliasing? Explain different aspects of the cost of
a programming language.
2. Define syntax and semantics. Write a grammar for the language consisting of string that have
n copies of the letter a followed by the same number of copies of the letter b, where n>0. For
example, the string ab, aaaabbbb, and aaaaaaaabbbbbbbb are in the language but a, abb, ba,
and aaabb are not.
3. Define lexeme and token with examples. Explain two grammars characteristic that prohibit
them from being used as the basic for a top-down parser.
4. In what way are reserved words better than keywords? What are the advantage and
disadvantage of dynamic scoping?
5. What is a descriptor? What languages support negative subscripts? Define row major order
and column major order.
7. What are the three general characteristic of subprogram? What are formal parameters and
actual parameters? Explain with examples.
SECTION “C”
[2 Q. 8 = 16 marks]
8. Show a complete parse, including the parse stack contents, input string, and action for the
string id+id*id, using the grammar and parse table given below.
Grammar:
1. E E+T
2. E T
3. T T*F
4. T F
5. F (E)
6. F id
10. What are the design issues for subprograms? What are the modes, the concept models of
transfer, the advantages, and the disadvantages of pass-by-value, pass-by-result, pass-by-
value-result, and pass-by-reference parameter-passing methods?