Você está na página 1de 34

1.

The function of operating systems a. describe the main features of operating systems i. provides a user interface to allow the user to interact with the computer easily ii. provides system software for housekeeping purposes, allows the computer to remain in its optimal condition. e.g. defragmenter, firewall iii. provides security by creating access right, user accounts and passwords, encrypts data during transmission and storage. iv. manages system resources 1. memory management 2. scheduling v. provides basic I/O drivers for essential hardware vi. provides a kernel b. explain how interrupts are used to obtain processor time and how processing of interrupted jobs may later be resumes i. Purpose of interrupts 1. to obtain processor time 2. for a higher priority task 3. to avoid delays 4. to avoid loss of data 5. as an indicator to the processor 6. that a device needs to be serviced. ii. types of interrupts 1. I/O Interrupts a. signal generated by I/O device b. to indicate input or output is complete or an error has occurred. c. E.g. Printer (buffer empty) 2. Hardware Interrupts a. signal generated by hardware within the computer b. can indicate problems experienced by hardware c. E.g. power failure/system failure, indicates OS needs to be safely stored. 3. Timer Interrupt a. signal generated by internal clock, that the processor must attend due to its time sensitive nature. E.g. clock interrupt. 4. Program Interrupts a. signal generated due to a logic error, e.g. divide by zero error or a violation of memory use ( e.g. access address reserved to OS only.) iii. processing of an interrupt 1. interrupt register is checked after the execution of an instruction. 2. interrupts are held in queues, in order of priority. 3. when an interrupt has a higher priority than the current job

4. contents of the register is moved into a stack, with the process control block to allow the process to return to its original job. 5. Control is given to the interrupt handler 6. Once the interrupt is serviced the interrupt register is checked again.

c. define and explain the purpose of scheduling, job queues, priorities and how they are used to manage job throughput i. scheduling 1. maximises the number of user 2. ...with no apparent delay. 3. Maximises the number of jobs processes 4. as quickly as possible 5. obtain efficient use of processor time 6. dependent upon priorities 7. To ensure all jobs obtain processor time/long jobs do not monopolise the processor ii. job queues 1. used to provide some kind of order. 2. Set generally in the order of importance 3. As some jobs are used more urgently than others. 4. allows what job is to be processed next. 5. Ready queue and Blocked queue iii. priorities 1. used when there are multiple jobs. 2. allows scheduler to decide which job is the most important, and therefore which to be executed first 3. allows important jobs to executed first to prevent data loss. 4. higher priority jobs are moved to the tops of the queue. 5. I/O jobs are usually completed efficiently when dealt with before the executing iv. I/O and Processor Bound jobs 1. I/O bound jobs do not use processor much instead it is more concerned with input and output between the processor and a device. 2. Processor bound jobs fully use the capabilities of the processor. 3. E.g. printing documents and working out the salary of each employer are examples of I/O and processor bound jobs, respectively. v. factors that are used to determine which process to be completed first 1. priority 2. I/O bound or process bound 3. Type of job (real-time or batch) 4. resource requirement 5. resources used so far

Formatted: Underline Formatted: Underline Formatted: Underline

6. waiting time.

vi. Types Schedulers 1. low a. decides when job is being processed next b. thus decides the order in which jobs are processed, the actual order of the jobs is determined by the scheduling algorithm. c. moves that job in and out (pre-emptive) of the running state 2. medium a. moves jobs to blocked state when the job is waiting for a device outside the processor b. can move blocked job from primary memory to backing store. c. once the job is unblocked, the medium level scheduler is moved into the ready queue. 3. high a. place a job into the ready queue b. makes sure the system is not overloaded vii. Scheduling algorithms 1. First Come First Serve a. jobs are executed in the order they arrive into the ready queue. b. generally favours long jobs as it can monopolise processor time, as it is a non-pre-emptive. 2. Length of job a. jobs are sorted in the shortest expected processor time needed for each to be executed. b. non-pre-emptive scheduler, so once a long job is the shortest job available it will still be executed even when there are shorter jobs available in the ready queue. 3. Shortest Time Remaining a. jobs are sorted in the processor time required to be fully executed. b. it is a pre-emptive scheduler, so long job may never complete as they will be moved back into the ready queue each time a shorter is available. 4. Round Robin a. each job is give a set processing time, called a timeslice. b. the timeslice is assigned to each job sequentially. c. priority of a job is not considered. d. pre-emptive scheduler, thus when the job has used up its timeslice the low level scheduler moves the job at the back of the ready queue.

5. System of priorities a. Highest priority first 6. Multi-level feedback Queue a. several queues are used, the top one holding the high priority job, the second one holding the medium priority jobs and the thirds being the low priority jobs. b. each job begins are a high priority job and is given a set amount of processing time called a timeslice. c. if the job uses up that timeslice and has not completed it is moved down to a lower priority queue. d. higher priority queues are handled first, so if top queue is empty, second priority queue is handled. The moment a job with a higher priority arrives, the lower priority job is moved back to the queue. e. the bottom level queue is where priority of the job is ignored. A round robin scheduling system is used. d. explain how memory is managed in a typical modern computer system i. Purpose of memory management 1. protects the OS 2. Reallocates memory when necessary. 3. Manages paging or segmentation 4. allocating memory to job so that separate processes can run at the same time. 5. to protect data from interfering with each other 6. allows memory to be shared. ii. OS is responsible for loading and linking portioned jobs. 1. Linkers a. allows parts of the program to be linked as a single executable code. b. resolves references in the main program to library routines and other code partitioned from the main program. 2. Loader a. re-calculateds the addresses of the instruction and the data used by first finding the first address of the instruction. b. copies program into main memory c. they are also responsible for loading pre-compiled library functions that are being called by a program. iii. Virtual Memory a. allows more programs to be running despite of that fact there is insufficient main memory for them. b. To allow programs to run that needs more memory than is available. c. backing store used as main memory. d. as additional memory

e. partitions jobs into fixed sized pages so they can be moved in and out of backing store. f. swaps pages between memory & backing store g. to make space for pages needed h. All unneeded pages are placed in a page file in the backing store. i. each page or segment is index, using page tables. j. Segmentation and paging are ways of partitioning memory. 2. Paging a. job is partitioned according to physical divisions. All pages are fixed in size. b. Advantages i. very little calculation required when swapping pages. c. Disadvantages i. if job is smaller than the page, memory is wasted ii. if job is larger than the page, multiple pages are required when job needed. 3. Segmentation a. job is partitioned according to the logical breaks in the code. So size of each segment is adjustable. b. Advantages i. multiple page dont need to be swapped as only needed parts of the job can be moved to main memory. c. Disadvantages i. segment swapping more difficult as start address on physical memory has to be calculated to ensure the segment fits in main memory. 4. page tables are used to keep track of the pages in virtual memory, they are also used to translate virtual addresses into physical addresses during page swapping. 5. Disk Threshing a. Occurs when pages are constantly swapped between main memory and backing store, due to multiple page faults. b. High rate of hard drive access occurs c. little processing is done most of the time spent by the processor is moving pages, as the hardrive is much slower than the IAS. So it takes time for the needed to pages to be swapped. d. Thus causes the computer to hang 6. Similarities and differences between segmentation and paging a. Ways of partitioning memory

b. Allows program to run despite of insufficient memory. c. Segments and pages are stored in backing store d. Segments and pages are assigned to memory when needed. e. Segments are different sizes, but pages fixed size. f. Segments are complete sections of programs, while pages are made to fit sections of memory. g. Segments are logical divisions and pages are physical divisions. e. describe spooling, explain why it is used i. What is spooling? 1. jobs that are sent to a device, that is currently handling another job, are intercepted by the spooling software and stored randomly in the backing store for printing at another time. 2. their job references, such as the address of the job in backing store, are stored in a queue to keep track of each job and ensure fairness to each job. 3. higher priority jobs are placed at the top of the queue. ii. Purpose 1. There is speed mismatch between the processor and the device (usual example is printer). 2. Avoids delays 3. Spooling software frees up the CPU so that is can process another job while this job is saved on backing store until device is free (an interrupt will be sent to the processor when the next job needs to be sent to the printer). Thus user doesnt not have wait until job is sent to the printer. 4. allows multiple jobs to be sent on a single printer. 5. allows a single device, like a printer, to be shared on a network by multiple users. iii. examples where spooling is used 1. job queue in a batch processing system 2. handling of jobs in a round robin system. f. describe the main components of a typical desktop PC operating system, including the file allocation table (FAT) and how it is used, and the purpose of the boot file. i. User Interface 1. Graphic User Interface (GUI) a. uses WIMP (windows, icons, menus and pointers) b. multitasking possible, so memory used. c. GUI itself requires a lot of memory d. easy to use as little expertise required. e. access in some part can be restricted. 2. Command Line interface (CLI) a. multitasking is not possible b. CLI uses very little main memory

c. d. ii. Boot process 1. POST a. b.

high expertise is required, user must know all keywords. fully access to the computer available.

Power On Self TestSelf-Test checks all essential computer hardware and clears the cpu register. c. loads the first instruction of the boot program 2. BOOT Program a. stored in ROM and contain the simple structure of the basic input output system (BIOS) b. simple BIOS find other BIOS information and combines it. c. User defined part of the BIOS is stored on the CMOS and can determine things like the BOOT sequence. d. the complete BIOS is now called the BOOT file and is stored on the RAM. The boot file is used while the loading the OS, after POST. Boot files provides personal settings, such as the boot sequence and the parameters by which the system will run. 3. OS initialised a. boot program find the OS in different locations, like hard drive C: b. files like COMMAND.COM and SYSTEM.INT are found and run. c. OS now takes control d. performs its own tests and loads drivers. e. CONFIG.SYS and AUTOEXEC.BAT are used to load user settings. 1. A map of where files are stored on the hard drive. 2. Cluster is indexed on the FAT 3. Uses a linked lists by providing addresses to the start of files and pointers to point to the next cluster of the file 4. Holds: name, size, access rights, memory reference (location in Disk), identifies free space 5. Updated by the OS, when files are saved or deleted. 6. Used by the OS when files are accessed. 6.7. loaded unto RAM for fast & frequent access. 7.8. Description of the FAT file system. a. HDD is divided concentric circles called tracks and sectors, b. Multiple sectors on a single track form clusters. c. When adding files, the OS know which clusters are empty d. When a file is deleted the pointer is set to zero.

iii. FAT

2. The function and purpose of translators a. describe the need for, and use of, translators to convert source code to object code i. computers understand binary code ii. it is difficult for humans to write and debug binary code. iii. language closer to English is preferred iv. cannot be understood by computers, so must be translated. v. Translators convert source code to object code vi. Detects errors in source code vii. What is source code? 1. Original code written by programmer 2. Often in a high level language 3. Maybe in assembly language 4. Source code can be understood by people vi.5. But cannot be executed until translated. b. understand the relationship between assembly language and machine code i. one to one correspondence between the mnemonics and its binary equivalent. ii. binary operation, opcode, have equivalents called mnemonics. 1. easy to remember 2. closer to English iii. labels in assembly language represent physical addresses of where that value will be stored, this is called symbolic addressing. iv. both machine code and assembly language are specific to the architecture of the computer. v. Assembly language 1. Low level language 2. Machines specific. 3. Uses descriptive names for data stores 4. Uses mnemonic for instructions. 5. 1:1 relationship of opcode and mnemonics. 6. May use macros. 7. Uses labels to allow selection. 8. Translated by an assembler 7.9. Easier to write machine code but harder to write than high level language vi. Machine Code 1. Binary notation (can be written in hex) 2. Set of all instruction available to the architecture. 3. Instructions operate on bytes of data 4. No translation needed 3.5. Very difficult to write c. describe the use of an assembler in producing machine code i. the source, assembly language, is translated into machine code. ii. storage is reserved for the data and instructions

Formatted: Font: Bold Formatted: Font: Bold, No underline Formatted: Font: Bold Formatted Formatted: Font: Bold Formatted: Font: Bold Formatted: Font: Bold

Formatted: Font: Bold Formatted: Font: Bold

Formatted: Font: Candara

iii. mnemonics are replaced by their corresponding opcode using the look up table. iv. assembler resolves symbolic addresses for numeric addresses v. Symbol table is created and to match labels with their numeric addresses. vi. Checks syntax/offers diagnostics for errors

d.

describe the difference between interpretation and compilation


Compilers translated as a single unit of code Interpreter each statement is translated and executed line by line if an error is found, translation stops in that position. source code needs to be interpreted before every run. Executes program directly from source code

Formatted: Normal, No bullets or numberin

errors in the code are reported them at the end of the compilation. source is compiled once

object code/intermediate code is produced.

Code is optimised by reducing the number of lines executed. Practical Pros and Cons harder to debug, spurious error are reported easier to debug code as location of error in the code can be seen interpreter and source code required for each run

source runs slowly as it needs to be translated every time. object code can of be intermediate translated by many computers each computer requires e.d. describe the purpose code in a virtual machine its own intepreter to to i. it is partially translated code, that requires further translation. Closer translate source code.

source code is not required, so more suitable for distribution. Intellectual right protected, as object cannot be turned back into source code because it very hard to read. object code run very fast

machine code but not machine specific. ii. Translated by an interpreter ii. intermediate code is translated using an interpreter iii. can be interpreted by a variety of computers using a virtual machine, thus it is very portable. iv. many compilers can translated source code into intermediate code. This allows section of intermediate code to be written in different high level languages. v. To run intermediate code an interpreter/virtual machine is required. This means that additional software is required to run intermediate code.however v.vi. The program will run slowly on a virtual machine as they need to be interpreted every time the program is run. f.e. describe what happens during lexical analysis i. Source program used as input ii. Tokens are created from individual symbols. iii. Tokens are created from the reserved words of the program, using the look up table. iv. all comments, redundant characters are removed

Formatted: Font: Not Italic Formatted: Font: Not Italic, Underline Formatted: Font: Not Italic Formatted: Font: Bold, Not Italic Formatted: Font: Not Italic Formatted: Font: Not Italic, Underline Formatted: Font: Not Italic Formatted: Font: Candara, Bold

v. symbol table is created to holds variable names. The symbol table holds, data type, variable names, address in memory and length, but these details are not added yet. 1. symbol table is a hash table, so a hashing algorithm is used locate entries for identifiers. 2. two identifiers that have the same hash use, link list is used. vi. Error diagnostics are given vii. Prepares code for syntax analysis. g.f. describe what happens during syntax analysis, explaining how errors are handled i. accepts output from lexical analysis i.ii. string of tokens from the lexical analysis stage is checked against theare checked against rules of the program language as defined by BNF. iii. If a syntax error occurs and it is listed. List is reported at the end of compilation. iv. Diagnostic errors may be given ii.v. uses the keyword table and symbol table to determine the type of statement it is and sees whether it is acceptable by the rules. iii.vi. Proceeds to code generation stage once the code is error free. vii. extra information about the variable is added to the symbol table, iv.viii. such as data type and scope. v. if not, a syntax error occurs and is listed. An error diagnostic report is given at the end of the stage. vi. checks the semantics of the code, flow control (IFs go with the right END IFs) and makes sure all variables have been correctly declared. vii.ix. Proceeds to code generation stage once the code is error free. h.g.explain the code generation phase and understand the need for optimisation i. memory addresses are allocated to each variable and instruction. ii. in the symbol table, memory address are filled. iii. look up table is used to translate tokens into machine code iv. each higher level code is broken into several low level commands. v. optimisation 1. allows makes code to work in the most efficient wayas efficient as possible 2. increases processing speed 2.3. reduces the number of instruction by removing unnecessary statements. 3.4. has to choose between speed and memory optimisation i.h. describe the use of library routines. i. Routines are pieces of software ii. are modules that perform common tasks. i.iii. such as sorting or searching. iv. pre-compiled v. Why does it help programmers ii.1. pre-written, pre-tested and pre-compiled.so error free 1.2. ready to use so saves time

Formatted: Font: Bold

Formatted: Font: Bold

Formatted: Font: Bold

Formatted: Font: Not Bold

Formatted: Font: Not Bold Formatted: Font: Bold

Formatted: Font: Bold Formatted: Font: Bold Formatted

iii.3. allows modulesroutines to be reused.reusable iv. ready to use v. pre-written, pre-tested and pre-compiled. 4. many programmers with different expertise can use it as it croutines comes in many different source languages 5. allows programmer to use others expertise vi. Linkers and Loaders 1. Linker is used 2. To link routine with program 3. Loader handles addresses vi.4. When program is to be run. vii. error free. 3. Computer architectures a. describe classic Von Neumann architecture, identifying the need for, and the uses of, special registers in the functioning of a processor i. Von Neumann Architecture 1. Single Control Unit a. Fetches decodes and synchronises the instruction. 2. Uses the Fetch-Decode-Execute Cycle 3. Executes one instruction at a time 4. data and instructions are stored in the same format/ in same way. 5. Uses special registers: a. Location in the processor b. Used for a specific purpose c. (temporarily) stores data/ or control information d. Accessed frequently e. Give an example of a register i. Program counter ii. Memory address registers iii. Memory data registers iv. Current instruction register v. Index register vi. Interrupt registers 4.vii. accumulator b. describe, in simple terms, the fetch/decode/execute cycle, and the effects of the stages of the cycle on specific registers b. generally if the question mentions a special register, say what it does. i. Fetch 1. PC holds the next instruction 1.2. address in the PC is copied to the MAR 2.3. PC is incremented 3.4. MDR reads the MAR and gets the instruction in memory. 4.5. Instruction in the MDR is moved to the CIR ii. Decode 1. CIR splits the instruction into its address partoperand (address part) and the instruction partopcode (instruction part)

Formatted Formatted: Strikethrough

Formatted: Underline Formatted: Underline Formatted: Font: Bold, No underline Formatted: Font: Bold, No underline Formatted: Font: Bold Formatted Formatted: Font: Bold Formatted: Font: Bold Formatted: Font: Bold

Formatted: Font: Bold Formatted: Font: Bold Formatted Formatted: Font: Bold Formatted: Font: Bold Formatted: Font: Bold Formatted: Font: Bold Formatted: Font: Italic Formatted: Font: Bold Formatted Formatted: Font: Bold Formatted: Font: Bold Formatted: Font: Bold Formatted: Font: Bold Formatted: Font: Bold Formatted: Font: Bold Formatted: Font: Candara, Bold, Italic

Formatted: Indent: Left: 1", No bullets or numbering Formatted: Font: Not Bold, Italic Formatted: Font: Bold

2. CIR holds the opcode of the instruction and address part is moved the MAR 3. MDR read the MAR and gets the address of the data 4. Data is moved from the MDR to the accumulator 5. Opcode is looked up on a look up table and decoded. iii. Execute 1. opcode is followed carried outby by the ALU and data in the accumulator is processed 2. accumulator temporarily holds the results, until it knows what to do with it. iv. Jump instruction 1. The CIR splits address part of the instruction out 2. during execution, that address part is loaded into the PC and the cycle is reset. c. discuss co-processor, parallel processor, and array processor system, their uses, advantages and disadvantages i. Co-Processor 1. additional processor that works in conjunction with the main processer 2. designed to complete a specific task 3. e.g. maths processor designed to complete maths work quickly. 4. Advantages a. speeds up specific tasks, e.g. maths tasks b. over all jobs is processed more efficiently c. it overall, cheaper to implement 5. Disadvantages a. co-processor is redundant if job involves less of that specific task. b. needs extra hardware space to fit in this processor. c. complex programming required to take advantage of this processor ii. Parallel Processor a. consists more than one processor b. a can be job can be split to allow parts separateof its instructions to executed simultaneously. c. work together in a synchronised fashion d.c. controlled by complex operating system e.d. can use pipelining, usually associated with RISC processors. i. processor splits into three part each handling a specific phase of the cycle ii. each instruction moves through the fetch decode- execute cycle. Registers that are not in use will be used to process another instruction iii. advantages 1. increases throughput

Formatted: Underline

iv. disadvantages 1. processor needs to be cleared and cycle needs to be restarted when a jump instruction occurs. 2. Advantages a. processing is considerably faster b. different processors can handle different tasks a.c. more than one instructions is processed at the same time. 3. Disadvantages a. Complex OS required ensuring synchronisation. b. Program is more difficult to test, write and debug. c. complex programming required to allows instruction of a job to run simultaneously, as each instruction may rely on the previous instructionprogram needs to be written in a suitable format. a. b.d.not completely efficient as two processor take double the power. iii. Array Processor 1. contain multiple ALUs within a single processor. 2. each processor is identical to one anotherprocessor runs the same instruction simultaneously 2.3. on multiple data locations. 3.4. e.g. graphics processingweather forecasting 4.5. Advantages a. performs an the same instruction on multiple items of data b. same calculation can be performed on an array of data simultaneously c. the same calculation on different is very fast b.d.Single Instruction Multiple Data (SIMD) 5.6. Disadvantages a. Inefficient at executing a single instruction and data item. d. describe and distinguish between Reduced Instruction Set Computer (RISC) and Complex Instruction Set Computer (CISC) architectures. RISC Single cycle used to complete a single (simple) instruction many general register sets small range of instructions available (small instruction set) uses only STO and LOAD functions can reference main memory few addressing modes available fixed length format instructions highly pipelined CISC Multiple cycles used to complete a single (complex) instruction single register set large number of instructions available (large instruction set) Any functions can reference memory many addressing modes available variable length format instructions little or no pipeline, so executes

Formatted: Font: Bold

Formatted: Font: Not Bold

Formatted: Font: Bold

Formatted: Font: Bold

Formatted: Font: Bold Formatted: Font: Candara, Bold

Formatted: Font: Bold Formatted: Font: Bold

Formatted: Normal, No bullets or numberin

Formatted: No underline

Formatted: Space After: 0 pt, Line spacing single

RISC instructions are generally faster to execute Harder to program One or more register set used

instructions one at a time. Program runs more slowly due to the more complex instructions. Programming is easier, closer to high level languages One or more register set used

CISC can make programming simpler and closer to a high level language as it has a larger instruction set and complex hardware to decode it. RISC requires more complex compilers to make sure all instructions use the limited instruction available within the processor.

4. Data representation a. demonstrate an understanding of floating point representation of a real binary number i. positive mantissas starts with 01 and negative mantissas start with 10 ii. mantissa | exponent iii. a floating point binary is said to normalised if it follows the rules above. iv. use twos complement to make a (binary number) negative. v. Purpose of Normalisation 1. To ensure there is unique representation of a number in binary form 2. To provide maximum precision / accuracy 3. Multiplication is also more accurate. b. normalise a real binary number c. discuss the trade-off between accuracy and range when representing number i. for a set number of bits: 1. if the FP binary has a very large mantissa, the accuracy will be high, but the range that it can represent is low. 2. if the FB binary have a very large exponent, the accuracy will be low but the range it can represent is high. 3. if the accuracy of a number does not fit the mantissa, is rounds off. 5. Data Structures and data manipulation a. explain how static data structures may be used to implement dynamic data structures
Static Structures

Advantages easy to program easy to check for overflow compiler can allocate space during compilation an array allows random access Makes efficient use of memory Only uses the space needed at any time

Dynamic Structures

Disadvantages programmer has to estimate the maximum amount of space that is going to be needed can waste a lot of space. Difficult to program can be slow to implement searches A linked list only allows serial access.

1.

Static a. Size is fixed when structure is created 2. Dynamic a. Size of the structure is variable 1. examples of static data structures: arrays 2. examples of dynamic data structures: linked lists

b. describe algorithms for the insertion, retrieval and deletion of data item stores in stack, queue and tree structures i. Stack (LIFO) 1. Insertion Check stack is full if so report error to user and stop increment pointer by +1 Insert data item to pointer position and stop note if item is added unto a full stack, overflow occurs. 2. Retrieval/ Deletion Check stack is not empty if so report error to user and stop Read/Delete data item on current point decrement point by 1 and stop ii. Queue (FIFO) 1. Insertion Check if queue is full if so report error to user and stop Increment Head pointer by +1 insert data item on pointer location and stop 2. Retrieval/Deletion Check if queue is empty if so report error to use and stop read/delete data item on current pointer Increment Tail pointer by 1 and stop iii. Tree 1. Insertion If tree is empty, add item to be root and stop Current Node = Root Node While Current node is not terminal node If Current Node < data item Choose right node as Current Node Else Choose left node as Current Node End IF End While Current Node is terminal node If Current Node < data item Create New Node on the right and Enter data item Else

Formatted: Indent: Left: 4"

Formatted: Indent: Left: 4.5"

Formatted: Indent: Left: 4" Formatted: Indent: Left: 4.5"

Formatted: Indent: Left: 4"

Formatted: Indent: Left: 4.5"

Formatted: Indent: Left: 4"

Create New Node on the Left and Enter data item End IF start at root repeat compare new data with current data if new data < current data, follow left pointer else follow right pointer until pointer is null write new data create (null) pointers for new dataRepeat with each data item to create a binary tree. MUST SPECIFY ROOT OF THE TREE.

Formatted: Indent: Left: 4.5"

Formatted: Indent: Left: 4" Formatted: Font: Candara, Bold Formatted: Indent: Left: 2"

Formatted: Font: Bold

Formatted: Font: Not Italic, Font color: Bla Formatted: Font: Bold Formatted: List Paragraph

Retrieval If Binary Tree is empty report error to user and stop Current Node = Root Node While Current Node = data Item or Current Node =Terminal Node If Current Node < data item then Choose right node Current node Else Choose left node as Current node End If End While If Current Node = Data item then Report to user Item found and stop Else Report Item no found and stop End If 2. Deletion a. Search the data item you need b. if data item is not found, report error to user and stop c. else traverse (Pre Order) this sub-tree, with the node, into a stack then delete the sub tree d. pop nodes and add each on the same binary tree. 3. Traversing a. Pre-order i. Root - Left Right b. In-order i. Left Root Right ii. output is in ascending order c. Post-order i. Left Right Root ii. used in Reverse Polish c. explain the difference between binary searching, highlighting the advantages and disadvantages of each i. Serial Search 1. Looks through each item and compares it with the search item, sequentially until item has been found or end of file has been reached. 2. Advantages easy to implement good performance in small lists doesnt require order 3. Disadvantages search is slow in large lists worst case is when search item is at the end of the list, so every item needs to be searched.

ii. Binary Search 1. Begins at the middle of the list and compares it with the data search item. 1.2. If match occurs, output location in array 2.3. If the data search item is larger than the data item, the list on the right side of the middle is taken 3.4. Else the list on the left hand side of the middle is taken 4.5. process is repeated on each list, until data item is found or list is reduced to one data item which does not match the search item 5.6. reports results to user and stop 6.7. Advantages a. faster at searching large lists b. reduced number of items searchedare checked. 7.8. Disadvantages a. data must be orders before hand d. explain how to merge data files i. Algorithm Open existing files Create new file Check existing files are not empty Use pointer/counters to identify records for comparison Repeat Compare records indicate by pointers Copy earlier value records to new file until end of one file Copy remaining records from other files Close files Assume common key Assume if 2 records are the same Only 1 is written to new file. i.ii. two files that need to be merged as assumed to have: 1. the same common key 2. both are in the same order e. explain the differences between the insertion and quick sort methods, highlighting the characteristics, advantages and disadvantages of each. i. insertion method 1. takes each data item and places it in the correct position in the sorted part of the list. 2. sorted part of the list and unsorted part of the list are divided by a line. 3. indicate what number is being compared and what action is being taken. 4. Advantage a. simple to implement b. good performance in small lists 5. Disadvantage a. takes a long time on large lists

Formatted: Font: Bold

Formatted: No underline Formatted: Indent: Left: 1.5", No bullets numbering

ii. quick sort method 1. pivot is taken, usually the middle value of the list. 2. list is reorders such that, all item that have a higher value than the pivot is moved to the right side and items that have a lower value than the pivot are moved to the left side. 3. the left and right un-sorted lists are then also sorted this way, until all data items have been sorted. 4. all data items are combined to form a sorted list. 5. Advantages a. sorts large lists faster than insertion sort 6. Disadvantage a. more difficult to implement iii. any more?Difference between quick sort and insertion sort. 1. Sets of numbers broken into multiple sets. b.2. Uses pivots. High-level language programming paradigms f. identify a variety of programming paradigms (low level, object-oriented, declarative and procedural) g. explain, with examples, the terms object-oriented, declarative and procedural as applied to high-level languages, showing an understanding of typical uses i. object oriented 1. it is where facts about an entity and the methods that can be applied to them are stored together as an object 2. uses classes which are templates for objects that belong to those classes. 3. each class has its own name, methods and characteristics. 4. a sub-class can inherit methods and characteristics of super class. 5. sub-classes are known as derived classes. 6. information about an object can only be accessed by its class, data encapsulation. ii. declarative 1. list of facts are declared about an item 2. rules are used to organise those facts 3. goals are set by the user to find items. 4. based on predicate logic 5. backtracks in each time it finds a successful match. a. Backtracking. i. After finding a solution to a goal. ii. Go back and follow an alternative path. 5.iii. To attempt to find another solution. 6. solutions are instantiated by the program and represented to the user. 7. tells what to do but not how to do it 8. e.g. Backus-Naur form iii. procedural

Formatted Formatted: Font: Bold Formatted Formatted: Underline

Formatted: Font: Bold Formatted Formatted: Font: Bold Formatted Formatted: Font: Bold Formatted: Font: Bold

1. imperative programming 2. tells what to do and how to do itprogram states what to do and how to do it 3. uses programming constructs like sequence, iteration and selection 4. Program statements are in blocks 5. Each block is procedure or function 3.6. Logic of program is given in a series of procedure calls. 4.7. allows the use of global and local variables 5.8. written in a list of statements that are executed sequentially. 6. code can be broken in to block called functions and procedures. 7. main program can call those function and procedures. 8.9. e.g. VBAC++ h. discuss the concepts and, using examples, show an understanding of data encapsulation, classes and derived classes, and inheritance when referring to object-oriented languages. i. understand the purpose of the unified modelling language i. A standard way to present information ii. About the design of a system. i.iii. Visual representation so easy to understand. i.iv. allows system analysts, programmers and clients to communicate ii. clearly about the program that its being designed. iii. it is a visual representation of the program, iv. thus it is easier to understand v. this also makes the program more maintainable.Makes system maintenance easier when modifying a system. j. interpret class, object, use case and communication diagrams i. Class diagrams 1. A class is an entity of a given system that provides an encapsulation of the functionality of a given entity. 2. drawn like a rectangle that three compartments: a. first (top) name of the class, starts with Upper Case b. second list of attributes that hold facts, <attribute name> : <data type> always lower case c. third list of methods that can be used to look at those facts. get <name of method>() always lower case 3. there may be more methods which have not been listed, this is represented by or an ellipsis, 4. If common attributes and methods are moved into a new class to ensure data integrity is maintained. 5. that class is stored such that is accessible to all classes that share this common attribute, this is called in inheritance. It is represented by an arrow pointing to the superclass that holds common attributes. 6. use the diagram given in the question as an example in your answer.

Formatted: Font: Candara

Formatted: Font: Bold Formatted: Font: Bold Formatted: Font: Bold

Formatted: Font: Candara Formatted Formatted: Font: Bold Formatted: Font: Candara Formatted: Font: Bold Formatted: Font: Candara Formatted: Font: Candara, Bold

ii. Object diagrams 1. it is an entity of a given class. 2. contains specific data, holds it in the order that matches the lift of attributes of the class that represents it. 3. anonymous objects represent any entity of a given class. Drawn as a single rectangle with contains a colon, followed by the name of the class. iii. Use Case diagrams 1. used to show how user interact with the system 2. users are represented as stick figure 3. box around the action represents the system 4. oval shape in the middle of the rectangle is the action 5. lines linking the action with users are association lines. 6. two types of users exist: initiating actor and receiving actor. Initiating actor initiates a task. 7. arrows are not drawn when order is not necessary iv. Communication diagrams 1. shows how different objects carry out a task. 2. each object placed within a rectangle 3. connected by arrows to indicate in which direction information is flowing 4. arrows are labelled with details of which information is being shared. The label starts with a number to order how each action happens. 5. labels are written as though they are methods v. State Diagrams 1. shows how an object might behave though the various processes of a system 2. Entry point: shaded circle and Exit point: shaded circle with another circle around it. 3. rectangle with rounded corners is known as a state. It represents a state an object can be. 4. arrows are transitions 5. labels are known as the trigger event, is responsible for changing the state of the object. vi. Sequence Diagrams 1. shows how object interact with one another. 2. dotted vertical line is called the life line. Earliest time at the top and the latest time is at the bottom of the life line. 3. long thin rectangles which show when the methods associated with the object are activated to do something vii. Activity Diagrams 1. visual representation of the actions taken using sequence, selection and iteration and can also show a number of actions occurring concurrently. 2. ovals represent actions;

3. diamonds represent decisions; 4. bars represent the start (split) or end (join) of concurrent activities; 5. a shaded circle represents the starting point of the workflow; 6. an encircled shaded circle represents the end point of the activity diagram. 7. arrows are used to show the direction of the workflow, can have a label which represents a condition statement k. create class, object, use case and communication diagrams l. discuss the concepts and, using examples, show an understanding of backtracking, instantiation, predicate logic and satisfying goals when referring to declarative languages. i. Backtracking 1. the process of going back from the last successful match and going back to find another solution. ii. Instantiation 1. giving a variable a value iii. Predicate Logic 1. it is where statements can be either True or False. iv. Satisfying Goals 1. the process of finding a goal. 6. Programming techniques a. explain how functions, procedures and their related variables may be used to develop a program in a structured way, using stepwise refinement a. i. Stepwise refinement 1. The iterative process of breaking the goal of a program into sections 2. into which become progressively smaller problems 3. until each problem module can be written as a single function or a procedure. 4. What Stepwise refinement allows: a. Each modules can be written as a functional procedure a.b. allows each module to be written and tested individuallyseparately b.c. modules can be distributed to different programmers according to their expertise d. allows modules function/procedures canto be re-used e. main program consists of calls to f. function/procedures c.g. which may be nested. d.h.allows the use of library modulesroutines e.i. different people can work on different modules at the same time. ii. Functions 1. block of statementscode..

Formatted

Formatted: Font: Not Bold Formatted: Font: Not Bold

Formatted: Font: Bold

Formatted: Font: Not Bold

2. perform a single task 3. returns a single value to the main program. 4. can use local variable iii. Procedures 1. blocks of statementscode 2. perform a task, which can be complex 3. may or may not return a value to the main program. 4. can use local variables. b. describe the use of parameters, local and global variables as standard programming techniques i. Parameters 1. Information about an item of data 1.2. are variables that are passed to function or procedure during callingsupplied to a function or procedure 2.3. can be passed by value or by reference, where actual value of the variable is sent or address of the variable is sent, respectively. 3.4. the value is passed is now used a local variable. ii. Local Variable 1. declared at the beginning of a module 2. name of the variable can be re-used in other modules 3. only available within the module 4. data held by the variable is lost when the module completes its task. iii. Global Variable 1. declared at the beginning of the program 2. name of the variable can only be used once. 3. can be overwritten by local variable of the same name. 4. exists throughout the program, so can be accessed by all modules. 4.5. Allows data to be shared between modules c. explain how a stack is used to handle procedure calling and parameter passing i. Purpose of the use of stacks 1. So program can return correctly when procedure has been completed/store return address 2. Allows data to be transferred i.ii. achieved by a stack allows parameters current data (including parameters) and return addresses to be stored in the right order. ii.iii. return address required to allow calling program to resume, once procedure has ended. iii.iv. when the a procedure or function is called, the return address is stored first and then the parameters are stored on the stack iv.v. when the called procedure is run, the procedure pops the parameters out of the stack and uses them as local variables. v.vi. once the procedure is completed, the return address is popped and used return to the calling program. vi.vii. multiple procedure calls can occur.

Formatted: Font: Not Bold

Formatted: Font: Bold

Formatted: Font: Bold, No underline Formatted: Font: Not Bold Formatted Formatted: Font: Not Bold

d. explain the need for, and be able to create and apply, BNF (Backus-Naur form) and syntax diagrams i. allows the rules syntax of the programming language to be defined in an unambiguous wmay. ii. ::= means defined to be, <> can be defined further, | means or. iii. syntax diagrams 1. Circles are symbols 2. rectangle box are meta variables like <digit> 3. when defining something using syntax diagram, define each element separately. 4. then use rectangle boxes to define the main thing. e. explain the need for reverse Polish notation i. an unambiguous way of writing mathematical expressions without brackets. ii. Advantages any expression can be processed in order: form left or right i. no rules of precedence are needed/ no brackets needed. ii.iii. operator always applies to two operands. iii.iv. allows the use of stacks, thus calculation is very simple. 1. If a value appears next in the expression, push this value on to the stack 2. If an operator appears next, pop two items from the top of the stack and push the result of the operation onto the stack. f. convert between reverse Polish notation and infix form of algebraic expressions using trees and stacks. i. stacks are excellent for converting polish notation to infix form. ii. example: 1. reverse polish of

Formatted: Font: Bold Formatted: Font: Bold, No underline

Formatted: Indent: Left: 2", No bullets or numbering

is

-1 b d 2 ^ 4 a c - ^ + 2 f iii. in binary trees, post order is used for reverse polish. Other traversing may be compatible with this notation. 7. Low-level languages a. explain the concept and, using examples, demonstrate an understanding of the use of accumulator, registers, and program counter i. accumulator a. temporarily stores results from the ALU b. works in conjunction with the ALU to allow operation to be performed on data that is stored here.holds data being processed b.c. deals with input and output in the processor ii. registers 1. MAR a. holds the address of an instruction or data that is to be fetched

Formatted: Font: Bold

b. gets address of an instruction from PC, or address of the data from CIR. 2. CIR a. holds the instruction that is to be executed and is ready for decoding b. instruction consists of an opcode and the address of the data or instruction (if it is a jump instruction) c. opcode is referred to a code table to allow the CPU to perform the specified operation. 3. MDR a. temporary storage during the transfer from main memory to a register 4. Index register a. Used in index addressing a.b. special register used to adjust modify the memory address part of an instruction iii. program counter 1. holds the address of the next instruction to be executed 2. address another instruction can be loaded during a jump b. describe immediate, direct, indirect, relative and index addressing of memory when referring to low level languages b. give example, preferable relevant to the context of the question. i. immediate 1. used in assembly language 1.2. value in the address part of the instruction is the value to be used.uses the data in the address as a constant 2.3. advantage is that the value does not needs to be searched 3.4. disadvantage is that, it is difficult to reuse this instruction as it is too specific. It is also very hard to alter during execution. ii. direct 1. value in the address part of the instruction is the location of the value to be used. Thus no modification of the address of data. 2. advantages: simple to use 3. disadvantages: a. restricts the number of memory locations that can be accessnumber of addresses available is limited - limited range. a. b. by the size of the address field c. Code is not re-locatable b.d.same instruction has to be re-written for each new address location, especially instruction needs to be applied to a number of data. solved by index addressing. iii. indirect 1. address in the instruction acts as a vector, pointing to the address of the instruction.

Formatted: Font: Not Bold

Formatted: Indent: Left: 1", No bullets or numbering Formatted: Font: Not Bold, Italic Formatted: Font: Not Bold

Formatted: Font: Bold

Formatted: Font: Bold

1.2. Used to access library routines 2.3. Advantages a. increases the size of the address that can be used b. allows a wider range of memory location to be accessed. 3.4. address part of instruction is often small, but they can point to a memory location that can store a much larger address. iv. relative 1. uses a base address 2. this is added to the relative address (operand) of the CIR to find the physical real address. 3. so the relative address in the CIR address is actually an offset. 4. useds in arrays and in storing variables in the program as location in memory is often not predictable. 5. all addresses are dependent on the address of the first instruction, as that contains the base address. 6. Uses a. Arrays 5.b. Branching v. index 1. uses special register,an Index register and an absolute address, is used to hold a value 2. value in the index register used to adjust modify the address of the instruction in the address to find the physical real address. 3. the index behaves similar to an offset and is adjusted in each cycle to perform the same instruction on a different operand. 4. Allows efficient access to a range of memory location 3.5. Example is to use access an array. c. discuss the concepts and, using examples, show an understanding of mnemonics, opcode, operand and symbolic addressing in assembly languages to include simple arithmetic operations, data transfer and flow control. i. mnemonics 1. easily remembersed 2. represent an instructions in binary code 3. it is instruction part of a statement 4. mnemonics represent an opcode 4.5. give example ii. opcode 1. the mnemonic part of the instruction 1.2. are codes that represent the operation that a processor can carry out. 2.3. very hard to remember as they are written in binary code iii. operand 1. address field of the data instructionor 2. holds data 3. to be used by operation given by the opcode 1. Give example the data itself depending on the address mode.

Formatted: Underline

Formatted: Font: Bold Formatted: No underline Formatted Formatted: Font: Not Bold

Formatted: Font: Bold Formatted: Font: Bold

Formatted: Font: Bold

Formatted: Font: Bold

Formatted: Font: Bold Formatted: Font: Bold Formatted: Font: Bold Formatted: Font: Italic

4. e.g. ADD 12, where 12 is operand. 2.5. operand and opcode together make up a single instruction. iv. symbolic addressing 1. similar to the use of mnemonics 2. the use of characters to represent the address of a store locationwhen referring to a piece of data, you have to refer to address of the data instead. 3. labels are used to represent these addresses instead. 4.1. this is known as symbolic addressing v. data transfer 1. low level language allows data to be loaded into the accumulator using Get mnemonic 2. Data can be stored using the STO instruction. 3. low level languages can access memory location directly. vi. flow control 1. it is the order in which statements are executed 2. in low level languages, order of control flow control instruction are to jump instructionscan be changed by jump instructions. a. they can be available via conditional jump instructions b. jump instructions change the order of instruction execution vii. arithmetic operations 1. available depending on the processors instruction set 2. ADD and SUB are most common. 3. Opcode allows the ALU arithmetic operations on data in the accumulator. d. does not need translation, language only uses the instruction set of the cpu. e. close to the architecture of the processor f. machine code g. assembly languages

Formatted: Font: Bold, Italic

8. Databases a. describe flat files and relational databases, explain the differences between them i. Flat Files 1. collection of sets of similar records. ii. Relational Databases 1. consists of a series of related tables. iii. Advantages over flat files 1. Avoids data duplication 2. Improved Data integrity 3. Easier to maintain in a large database as data is easier to change. 1. 2.4. improved data consistency 3.5. data can be added easily 4.6. access to data can be controlled more easily 7. changes to records needs to be made once. 5.8. Easier to change data format iv. Advantages of flat files 1. all data is stored in the same place 2. Easy to understand 3. sorting and searching is usually simple, more straight forward 4. criteria is simple v. Disadvantages of flat files 1. lack of flexibility 2. difficult to obtain new types of reports 3. new program needs to be written when a new query is required. 4. not compatible with a program that written in a different language or structure. b. design a simple relational database to the third normal form (3NF), using entityrelationship (E-R) diagrams and decomposition. One to one One to many

Formatted: Underline

many to many

many to many in resolved in 3NF

c. define and explain the purpose of primary, secondary and foreign keys i. Primary Key 1. an attribute that is

2. a unique identifier in a table ii. Secondary Key 1. an attribute to allows you to sort, search 2. groups data 3. different from the primary iii. Foreign Key 1. is a primary key in another table 1.2. used as an attribute in another table 2.3. creates links between the two table, known as a onone to many relationship with its own table and in the table in which it is foreign key. d. describe the structure of a DBMS including the function and purpose of the data dictionary, data description language (DDL) and data manipulation language (DML). use SQL to define tables and views, insert select and delete data and to produce reports. Describe what reports are. 1. DBMS a. ? manages the complexities of handling a database b. External Level i. shows how individual users can see data ii. manages the views of each user. 1. to protect data 2. from to prevent unauthorised access 3. to ensure user can see the data they require 1. 2.4. to ensure little technical skillspecialist knowledge is required 3. to ensure user can see what is required c. Conceptual Level i. gives a single, usable view of all data ii. used by administrators. d. Internal Level i. concerned the way data is stored on the hard drive ii. low level representation of database iii. hidden by DBMS 2. DDL (Data definition Language) a. Creates table b. Security of data is set up, like setting up passwords and user names. c. defines validation rules of fields d. defines data type, primary keys e. creates attributes f. schema and sub schema of the database is created. i. sub-schema would be views for each user. 3. DML (Data Manipulation Language) a. allows user to update and ass or delete records

Formatted: Font: Bold

Formatted: Font: Bold, Italic Formatted: Font: Bold, Italic

b. high level language so minimal skill is required c. can query data d. creates a queries, the results of which is the view the user sees through. e. enforces referential integrity i. e.g. any field that is a foreign key can have value of 0 or only values from the parent tables primary key. 4. Data Dictionary a. a files containing description of data in a database b. used by database managers c. used to alter database structure d. uses meta data to find the tables. e. They hold a.i. access rights by programs b.ii. meaning of data c.iii. define attributes d.iv. holds characteristics of data e.v. stores relationship between data 5. Reports a. presentation of selected data b. set up idefined in advance c. so the user does have to set it up d. usually in the form of a table e. features of a report: i. Query ii. Display order 6. SQL a. examples of DLL and DML. b. often called a Declarative language but has procedural elements. c. creating views d. insert and select data
INSERT INTO My_table (field1, field2, field3) VALUES ('test', 'N', NULL); 1. adds rows into tables

Formatted: Font: Bold Formatted: Font: Bold Formatted: Font: Bold Formatted: Font: Bold, Italic Formatted: Font: Not Bold, Underline Formatted: Font: Italic, Underline Formatted

e. delete data
DELETE FROM My_table WHERE field2 = 'N'; 1. removes existing rows from table

f.

create queries (views)


SELECT * FROM Book WHERE price > 100.00 ORDER BY title; 1. adds rows into tables. 2. asterisk means to return all coloumns.

g. create table

CREATE TABLE My_table( my_field1 INT, my_field2 VARCHAR(50), my_field3 DATE NOT NULL, PRIMARY KEY (my_field1, my_field2) );

BNF was brief binary tree traversing DML and DDL and SQL was brief Status diagrams uses of queues, algorithms for queues. reverse polish and binary trees!!!

Você também pode gostar