- What is the difference between a compiler and an interpreter?
- A compiler attempts to translate the whole source code, reports errors at the end and, if there are no errors, creates an executable file. An interpreter reads each line, translates and executes it, and stops when an error is encountered. An interpreter does not store the program in executable format.
- Why does an interpreter make debugging easier?
- An interpreter stops when an error is found, so the error can be corrected in real time and the result of the changes seen immediately. Errors are shown one at a time, so the programmer can correct them and carry on. Incomplete code can also be run.
- Why is a compiler used for the finished version of a program?
- A compiler creates an executable file, so the program can be distributed without the source code and users do not need the translator. No time is spent retranslating the program each time it runs. An interpreter suits writing and testing, while a compiler suits the finished program.
- What is a partly compiled, partly interpreted program?
- The source code is compiled first to an intermediate code, which is then interpreted when it is run on several different platforms. Java in console mode is the syllabus example. Machine code is generated at run time, so the code is optimised for the CPU.
- Which IDE tools help a programmer debug a program?
- A typical IDE offers single stepping, which runs the code line by line, and breakpoints, which stop the code at a set point so the values can be checked. A report window shows variables and expressions as the program runs. Dynamic syntax checks find errors as the code is written.
- Is pretty printing a debugging tool?
- No. Pretty printing is a presentation feature that identifies key terms. Debugging uses single stepping, breakpoints and the report window. Examiners reported that context-sensitive prompts and pretty printing are tools for coding rather than debugging.