CUSTOMER_CODE SMUDE DIVISION_CODE SMUDE

advertisement
CUSTOMER_CODE
SMUDE
DIVISION_CODE
SMUDE
EVENT_CODE
OCTOBER15
ASSESSMENT_CODE BC0051_OCTOBER15
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
3445
QUESTION_TEXT
What is C preprocessor? Mention the four separate facilities that it
provides
SCHEME OF
EVALUATION
The C preprocessor is a macro processor that is used automatically by
the C compiler to transform your program before actual compilation. (2
marks)
The facilities it provides:
1.Inclusion of header files: these are the files of declarations that can be
substituted into your program.-(2 marks)
2.Macro expansion: you can define macros, which are abbreviations for
arbitrary fragments of C code, and then the C preprocessor will replace
the macros with their definitions throughout the program.-(2 mrks)
3.Conditional compilation: using special preprocessing directives, you
can include or exclude parts of the program according to various
conditions. (2 marks)
4.Line control: if you use a program to combine or rearrange source
files into an intermediate file which is then compiled, you can use line
control to inform the compiler of where each source line originally came
from. (2 marks)
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
3447
QUESTION_TEXT
Explain Syntactic errors and Semantic errors with example
Syntactic errors:
Explanation(4 marks)
Example(1 mark)
SCHEME OF EVALUATION
Semantic errors:
Explanation(4 marks)
Example(1 mark)
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
3450
QUESTION_TEXT
Write a short on
a. Lexical analysis
b. Syntax analysis.
SCHEME OF EVALUATION
a.Lexical analysis(5 marks)
b.Syntax analysis(5 marks)
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
72899
QUESTION_TEXT
What is the difference between compiler and interpreter?
SCHEME OF
EVALUATION
The difference between an interpreted and a compiled language lies in
the result of process of interpreting or compiling. An interpreter
produces a result from programme, while compiler produces a
programme written in assembly language. The assembler of architecture
then turns the resulting program in to binary code.
A compiled program is not human readable, but instead is in an
architecture specific machine language. Creating a compiled program
requires several steps.
Different kinds of computer do not speak each other. Machine
languages, a compiled program will only work on the platform it was
designed for.
In an interpreted program, on the other hand, the source code typically is
the program of this type require an interpreter, which parses the
commands in the program and then executes them.
Intermediate to computer specific compiled programs and interpreted
scripts are programs designed for runtime environments.
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
72901
QUESTION_TEXT
Discuss Elementary Symbol table organization.
a. Fixed and variable entities: 3 marks
b. Fixed Length entity: 2 marks
SCHEME OF EVALUATION
c: A variable length entity: 2 marks
d. Advantages of fixed length entity -3 marks
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
114583
Explain the following LPDT:
QUESTION_TEXT
a.
LEX
b.
YACC
a.
LEX: LEX is a tool for automatically generating lexical analyzers.
A LEX source program is a specifications of a lexical analyzer,
consisting of a set of regular expressions together with an action for each
regular expression .The action is a piece of code which is to be executed
whenever a token specified by the corresponding regular expression is
recognized. Typically, an action will pass an indication of the token
found to the parser, perhaps with side effects such as making an entry in
the symbol table. The output of LEX is a lexical analyzer program
constructed from the LEX source specification.
(5 marks)
SCHEME OF
EVALUATION
b.
YACC: The main component of the input to YACC is a syntax
directed definition for the translation of the source program into an IR or
the target program. YACC allows the user to specify a possibly
ambiguous grammar along with precedence and associatively
information about operators and how YACC resolves any parsing action
conflicts that arise. The user provides YACC with a grammar, and
YACC builds the LALR states. YACC then attempts to select the
parsing actions for each state.
(5 marks)
Download