Question 1 Report
A developer is preparing a completed program for distribution to users. The source code uses library routines supplied with the programming environment. The diagram shows a simplified process for producing a runnable program. The developer wants to understand the difference between compiling the finished program and interpreting code while it is being developed. An integrated development environment (IDE) is also being used to edit, test and correct the source code. Labels A and B have been removed from the diagram.
(a) State two tasks performed by a compiler. [2]
(b) State the names of the program forms before compilation and after linking. [2]
(c) Complete labels A and B in the diagram. [2]
(d) Give two benefits of using an interpreter while developing a program. [2]
(e) Give two facilities of an IDE that can help a programmer find mistakes. [2]
(f) Identify the type of error in the statement IF age >= 18 OUTPUT "Adult", assuming this pseudocode requires THEN after the condition. [2]
(g) Compare a compiler with an interpreter in terms of translation and program execution. [3]
(a) A compiler translates high-level source code into object/machine code and checks or reports syntax errors [2].
(b) Before compilation the form is source code/source program. After linking it is an executable file/program [2].
(c) A is a compiler; B is an executable file/program [2].
(d) An interpreter translates and runs one statement at a time, so an error can be located at the statement being executed. Changes can also be tested immediately without producing a complete executable [2].
(e) IDE facilities include breakpoints and single stepping [2]. Syntax highlighting, error messages and variable watch/trace tools are also valid.
(f) This is a syntax error because the required THEN keyword is missing [2].
(g) A compiler translates the whole source program before it runs, normally producing object code or an executable. An interpreter translates and executes one statement at a time. Compiled code normally runs faster after compilation, whereas interpretation supports immediate testing and debugging [3].
Everything you need to excel in your exams