Application Generaton Flashcards

1
Q

1) What is machine code?

2) What are Opcodes and Operands?

A

1)
-Processors only understand machine code
-Machine code is binary sequences that represent instructions and data
-Originally no choice but to code in machine code
2)
-Opcodes are the sequences contain instructions
-Operands are the sequences containing data

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

What is an instruction set?

A
  • Each processor has its own instruction set
  • They are the instructions that are available for a certain processor to process
  • Code has to be written for each processor
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

1) What is assembly language?

2) What is an assembler?

A

1)
-Written in mnemonics making code easier to read and write
-Not very portable (different chips will have different languages)
2)
-Assembler converts assembly into object code

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

Why were HLL’s introduced?

A
  • in the 19950’s due to limitations on assembly code, more money was spent on developing software than purchasing hardware. Even with the relatively higher cost of hardware compared to today
  • Fortran the first HLL made code more-readable
  • HLL needs interpreters and compilers in order to convert it into something the CPU can utilise
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is an interpreter? +/-

A

*Reads code line by line
*Each line is converted into machine code
*Then Machine code is executed
+Useful when debugging as the execution will terminate at the line where the error occurs
-Runs slower
-May involve the translation of the same code multiple times
-User needs to have access to an interpreter to execute the code which takes up more memory

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

What is a compiler?

A
  • Takes HLL source code and converts it to object code
  • Compiled code can be run as often as required
  • Faster than interpreted code after complication. The complication takes longer
  • Hides the original code as compiled code is machine code
  • small programs can compile in seconds, more complex can take a while
  • Unlike interpreted code you do not have to release source code for other people to run it meaning other people cannot steel it
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is object code?

A
  • Intermediary step taken before producing ‘pure’ machine code
  • contains placeholders where library code should be placed
  • Passing the object code through a linker generates machine code that can be executed by the processor
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are utilities? Examples?

A
  • Relatively small program with one purpose usually concerned with system maintenance
  • Anti Virus programs: detects and removes viruses
  • Disk defragmentation: Groups all parts of paged/segmented data so they can be read in one go
  • Compression: Reduce amount of space data takes up in storage. Makes use of regularly repeated patterns in data
  • File managers: Allow files and directories to be moved, copied, deleted and renamed
  • Backup utilities: Allow backups to be automatically made of specific data
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are applications? Examples?

A
  • Software which allow user to perform a task or produce something
  • Word processors, spreadsheet packages, presentation software, desktop publishing software, image editors, web browsers and computer aided design packages
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How to compilers work? (In general terms)

A

-go through a defined sequence of steps

Each step brings the high level code closer to machine code

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

What is lexical analysis?

A
  • All comments and whitespace stripped from code
  • HHL converted into tokens
  • tries to ID the reserved words (IF, THEN etc), operators, variables and constants
  • all separate entities become their own tokens
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a symbol table used for?

A
  • Throughout compilation the complier must track the variables and subroutines within the code
  • the names of these are added to the symbol table
  • later on, info such as data type and scope (global/local) are added
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is syntax?

A

-set of rules that govern its structure

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

What is syntax analysis?

A
  • compiler checks the code has been written in line with syntactic rules of the language
  • if code doesn’t, a list of syntax errors will be generated
  • generates an abstract syntax tree (AST) that will represent program
  • if tokens generated in lexical analysis do not fit into this tree than we have a syntax error
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the code generation step of compilation?

A
  • the code is generated as an AST

- complainer now takes this and converts into object code

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

What is the optimisation step of compilation?

A
  • we want code to run efficiently (as fast as possible or as low memory usage as possible)
  • optimisation can remove redundant/unreachable code or replace instructions with more efficient alternatives
  • occurs during and after code generation
17
Q

What are libraries?

A
  • Reusable, complex code written by other programmers to simplify programming tasks
  • Accessed through API’s (application programming interface)
  • not uncommon for a library to be written in one language and have API’s designed to allow other languages to work with it (different languages will be suited to different problems)
18
Q

What are linkers/loaders?

A
  • if we have used libraries we need to ensure they are included with final code
  • a linkers is required to include the library code and our compiled code into a single exe
  • linkers can be static or dynamic (loaders)
19
Q

What is static linking?

A
  • all library code is inserted directly into the program when it is complies
  • final exe very large
  • can have multiple exe’s with all the same library embedded
20
Q

What is dynamic linking?

A
  • attempt to bypass the size of static linking
  • compiled versions of the library are stored
  • OS links a program to the library when it is run
  • loaders are core parts of the OS and are tasked with loading a program into memory
  • reduces duplication of library packages