Chapter 5 (Section 2) #2 Flashcards

(47 cards)

1
Q

Section 1: Fundamental Concepts of Translation

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why must programs be translated into machine code before execution?

A

CPU hardware can only process instructions in machine code (binary) because its made up of logic gates. Therefore, any program written in a high-level or assembly language must be converted into machine code and loaded into main memory to run.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the definition of a Translator?

A

Systems software that converts a source program written in a language other than machine code into a format that the computer can execute.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a Source Program?

A

The original program written by the programmer in a high-level or assembly language before it has been translated.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is an Object Program (Object Code)?

A

The machine code version of a program that is produced after the source code has been processed by a compiler or assembler.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How does the mapping of instructions differ between low-level and high-level languages?

A

Low-level language instructions generally have a one-to-one mapping with machine code, whereas one high-level language instruction usually translates into multiple machine code instructions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the definition of machine independent?

A

The program code can be translated to run on any processor / platform

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Section 2: Types of Translators

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is an Assembler?

A

A program that translates a source program written in a low-level assembly language into machine code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a Compiler?

A

A program that translates a source program written in a high-level language into machine code or p-code (object code) as a single, complete unit.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is an Interpreter?

A

A program that analyzes and executes a high-level language program line by line without producing a separate object code file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is bytecode?

A

It is partially complied code that is generated using a compiler. This bytecode can only be interperted on a virtual machine and is machine independent.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Describe how Java source code is translated.

A
  1. Java uses a two-step translation process.
  2. Java code is partially compiled.
  3. Code is translated first into intermediate code (bytecode) using the Java compiler.
  4. The bytecode is finally interpreted by the Java Virtual Machine.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Section 3: Performance and Resource Management

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How does execution speed compare between compiled and interpreted programs?

A

Compiled programs run faster because the translation is performed once before execution; interpreted programs run slower as each line must be translated every time the program is executed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How do compilers and interpreters differ in their use of memory during execution?

A

A compiled program only requires the object code to be in memory. An interpreted program requires both the source code and the interpreter software to be present in memory during execution.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Which translator is more efficient for programs that use loops?

A

A compiler, because it translates the loop code once. An interpreter must re-translate every instruction inside the loop for every iteration.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Section 4: Development and Security

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Why is an interpreter often preferred during the initial development phase of a program?

A

It allows for faster testing and debugging because the programmer can see the results of changes immediately without waiting for a lengthy compilation of the entire project.

20
Q

How do compilers and interpreters handle error reporting differently?

A

A compiler scans the entire program and provides a complete list of all syntax errors at the end. An interpreter stops execution the moment it encounters a single error.

21
Q

Why is a compiler better for protecting Intellectual Property (IP)?

A

A compiler produces an object code file that is difficult for humans to read or reverse-engineer, allowing the developer to distribute the software without sharing the original, readable source code.

22
Q

How does portability differ between compiled and interpreted code?

A

Compiled object code is often specific to a particular hardware architecture. Interpreted source code can run on any machine as long as a compatible interpreter is installed on that system.

23
Q

Section 5: Errors and Debugging

24
Q

What is a Syntax Error?

A

An error in the grammar or rules of the source program (e.g., a misspelled keyword or missing punctuation) that prevents translation.

25
What is a Logic Error?
An error in the design or logic of a program that causes it to produce incorrect results even though the program runs without crashing.
26
What is the definition of Debugging?
The process of finding and correcting logic errors in a program by tracing its execution.
27
Section 6: Integrated Development Environments (IDE)
28
What is an Integrated Development Environment (IDE)?
A software suite that provides a comprehensive set of programs and tools (such as editors and debuggers) used by programmers to write, test, and translate high-level language programs.
29
What is the purpose of the Source Code Editor in an IDE?
It provides a workspace for writing and modifying code, often featuring tools specifically designed to make the code easier to manage.
30
What is "Prettyprinting" in an IDE?
A feature that automatically formats source code with consistent indentation and color-coding to make it easier for humans to read and understand.
31
What is Context-sensitive Prompting?
A feature that displays predictions or suggestions for the code being entered (like variable names or keywords) based on the current context.
32
What is Dynamic Syntax Checking?
An IDE feature that underlines or highlights statements that violate the rules of the programming language while the programmer is still typing.
33
What is Bracket Matching?
A feature that highlights the corresponding opening or closing bracket when the cursor is placed on one of them, helping to manage nested structures.
34
What are Collapsible Code Blocks?
A feature that allows the programmer to hide or "collapse" sections of code (like functions or loops) to make navigating large programs easier.
35
Section 7: Runtime and Debugging Tools
36
What is a Run-time Environment?
A component of an IDE that allows a program to be executed and tested while providing access to specialized debugging tools.
37
What is a Breakpoint?
A deliberate pause placed at a specific line of code by the programmer to stop execution so that the current state of the program can be inspected.
38
What is Single Stepping?
A debugging technique where the program is executed one line at a time, allowing the programmer to observe the effect of each instruction.
39
What is a Report Window?
A separate window in the IDE's debugging environment that displays the current contents of variables and data structures as the program runs.
40
What is an Auto-Documenter?
A feature that automatically generates documentation for the functions, variables, and overall purpose of the code based on the source files.
41
Section 8: Classified Questions
42
Describe the benefits of using a compiler to translate high-level code.
1. Once translated the compiler software is not needed to run the program. 2. Compiled code should execute faster. 3. Compiler produces an executable file. 4. The executable file produced by a compiler can be distributed without users having sight of the source code.
43
Describe the benefits of using an interperter to translate high-level code.
1. Easier de-bugging. 2. The interpreter stops when error encountered, so errors can be corrected in real time. 3. The interpreter translates a statement then executes it immediately. 4. Parts of the program can be tested, without all the program code being available.
44
Identify features that support the visual presentation of the code in a typical Integrated Development Environment (IDE)
1. Prettyprinting. 2. Expand/collapse code blocks. 3. Auto indentation / formatting.
45
Identify features that support the debugging of the code in a typical Integrated Development Environment (IDE)
1. Single stepping. 2. Breakpoints. 3. Report window. 4. Variable expressions.
46
Describe some differences between a compiler and an interperter.
1. Compiler creates an executable//an interpreter does not create an executable. 2. The compiled program can be independently distributed. 3. Compiler reports all errors at the end of compilation//an interpreter stops when it reaches an error. 4. Interpreter executes each statement immediately after decoding/checking it. 5. The compiled program does not require compiler/source code to be present.
47
Explain why software is often developed using library files.
1. The code is already written so the programmer is not starting over again which saves time. 2. The code will have been used by many people so it should be already thoroughly tested and relatively error-free / won’t need re-testing. 3. The programmer can use e.g. mathematical / graphics functions that he may not know how to code. 3. Use of named library functions can simplify the program and make it easier to read. 4. The library routine code should conform to industry standards and therefore contribute towards a more robust program.