F453

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

What is the advantages + disadvantages of serial and binary search?

Serial Search- It is when it makes comparison between each item within the data structure and the intended search. e.g. Binary Search- It succesively split the data sets, until, it eventually retrieves the intended search. -The advantages: Serial Search- It is easy to program. Binary Search- It is fairly quick to searched for an item. -The disadvantages: Serial Search- It is extremely slower to search for an item, in comparison, to binary search. The no. of searches would be 2^m for serial search where m=the number of searches performed by binary search. Binary Search- It is hard to program.

What is the algorith for both serial and binary search?

Serial Search: 1. If n < 1 then report error, array is empty. 2. For i = 1 to n do a. If DataArray[i] = X then return i and stop. 3. Report error, X is not in the array and stop. Binary Search: 1. While the list is not empty do a. Find the mid-point cell in the current list. b. If the value in this cell is the required value, return the cell position and stop. c. If the value to be found is less than the value in the mid-point cell then Make the search list the first half of the current search list Else make the search list the second half of the current search list. 2. Report error, item not in the list.

Explain a Operating System. What are the different function and features of a Operating System?

- A Operating System is needed for the System to run and function. The types of Operating Systems include:- - Single User - Multi User or Networking - Batch Op. System - Real Time Op. System Functions are to provides an interface between the human and the computer, as I mentioned just before it gives an interface between the applications and the computer. The operating system is also responsible for managing hardware resources and providing maintenance utilities and data protection (from other user's in a multi-user operating system)for users. The features are: - Scheduling:- Divides processing time spent of a task or a user in a network. The scheduler is a program which is part of the operating system, its purpose is to maximise the processor usage while allowing users fair allocations of time and providing a reasonable response time to real-time users. - Memory Management:- Manages memory by making sure that the space available the application can run on and does not interfere with other applications. - Allocation of resources- Provides a working area for the user e.g. how many print outs can be made, how much quota space can be available on a disk drive for a user's files etc.. -Keeping track of usage - Data and User Security:- Protects and makes private accounts of user in a system. -Providing system services such as print spooling- Print oust need handed over to the Operating System because it is a slow process. -Managing input/output- -Handling Network Communication-

What is the difference between interpreter and compilier?

- A compilier creates a excutable file immediately. Whereas, interpreter interprets one line at a time. -Debugging is more diffult in compilier because one error can make many spurious errors. Each line of code is checked before being executed. - Compilier is more likely to crash CPU as machine code is run direclty on the system. Whereas, Interpreter is less likely to crash because it is run on Virtual Machine environment, outisde the system. - Compilier protects intellectual property because machine code is more difficult to understand. Whereas, interpreter has a more difficult intellectual property Compilier uses more memory, whereas, interpreter uses less memory. -Unauthorised modification to the code is more difficult in the compilier, whereas, it is to make changes and alteration in interpretation.

What are the different views within a database?

- Internal view - This level of the database is the actual storage of the data in random access and indexed files, this is hidden from the users by the DBMS. - Conceptual- At the conceptual level of the database there is one single usable view of the database whichis just the data as a whole. - External view- t this level there are many different views of the data according to users rights, each viewing showing an abstract representation of part of the total database. The views are created using DML.

What is job scheduling?

- Is a set of rules that determine the order which application programs are excueted. There must be a methodic way of organising the order in when jobs would be handled, especially in a multi-tasking system. There needs to be a set of rules to determine the order of jobs handling, this is job scheduling. - Organised in the order of importance, in such that, it differs the jobs in which are processor bound (CONSUMES alot processing time) to I/O bound jobs (uses and relies on the pheriphal devices). Purpose of scheduling: -Make efficient use of processor time -Make efficient use of resources -Maximize the number of users by receiving a fast reponse time. - Ensure that there is no apparent delay for users - Maximize throughput of the CPU. -Should ensure that all tasks are processed. -Other scheduling algorithm includes: 1). SJF (Shortest Job First)- This is order in processing time, in that the shortest jobs would be first. However, it is unfair because the longest would rarely be at the top and first of the queue. 2). Round Robin- This is when a small amount of processing time would be shared, equally around the jobs. -Used in Mult-tasking OS - Uses Time Slice 3). FCFS (First Come First Served)- 4). SRT (Shortest Remaining Time)- Similiar to SJF, the shortest jobs would be top of the queue. However, the jobs that are put back into the queue because the processor had to ,would always and instantly be at the top of the queue. 5). Multi-level Feedback Queues-(Sort of like football league table). In that, there are different sets of queues. The jobs that have a long processor time and rely mostly on the pheriphal device would be lower down into the table, or even relegated. There would be other jobs that would be promoted.

What is dynamic structure?

- The data structure can be decreased, or increased (can be OVERALL changed).

What is a interpreter?

- The interpreter converts the high level language to an EXCUETABLE line in the program code. -It translate, and then executes between each line. The first, second, third .... - It is easy to find errors because it would be on the line the interpreter is currently translating. It translates and compiles one line at a time. It searches for error - From one line within the instruction, can give way to many machine code. - The basic structure of a high level language is that it contains keywords. These keywords are associated with its statement, and ins Advantages over complier: - Uses little memory - Easier debugging Points the exact position of the error - Interpretation can be restarted from any point when an error has been corrected - Breakpoints can be used to halt at a position and tell the program the value of the variable at that point - Less prone to crashing Disadvantages: -End user needs a interpreter -Speed runs more slowly than compiled code -

What situations can jobs leave the processor?

- These methods are done to maximise the processor and even the pheriphal devices. The algorthm must be robust, else, the processor would block it. The way jobs are excueted in the processor is that: job is "ready, being run, leaves system, else in some circumstances preparing to be blocked". - Relies on a pheriphal device, such as a printer for servicing. In this case, it would stop being run and be transferred to the blocked queue, where it would wait to be serviced. Once finished, it would be put back into the ready queue. There are three reasons why a job would leave, once, it has finished being run: - It a finished being run. - A job of higer priority interrupt appears, whilst, this job is being run. - The job has had long enough processing time. In this, there needs to be a set of algorithms

UML

-It is the diagrammatic form in a object orientated program to describe the effective stages in a UML. -A object orientated program stores the facts about a particular entity and the methods that will be used in a object. There are different types of UML diagrams, possible 12, but 7 will be looked at.

What is immediate, direct, indirect addressing?

1). Immediate addressing is when the operand is the actual data value that the processor needs to excuete the instruction, supposed to its address. e.g. A example is "add 10", which means add the num Advantage- Consume less of the processor's time to fetch the data in the memory address. 2). Direct addressing is when the operand is written in the address that contains the data value needed to excuete the instruction. E.g. In Add 10, the 10 would be the memory's address. In a 32 byte system, 16 byte would store the instruction and other info. There is only 16 bytes that can be used as the address which is limited and little. Same instruction for different data values have to be written out again and This method has a problem with current large RAM capacities, due to the direct nature the address must fit in the value from the instruction, e.g. if our instruction is 32 bit16 reserved for addresses this means we can only cover 2 ^16 locations in memory while wemay have many more than this. The second problem with his method is that it is inefficientwhen we wish to repeat the same instruction on many areas of memory because we have tokeep calling the same instruction with different addresses. Indirect takes the address from the instruction, from here it looks at the memory space pointed by this address and collects the real address to be used from this memory location.Basically the instruction stores the address, where the address of the value to be used will befound. This method allows us to visit larger addresses in memory. 3). Indexed addressing is when it uses the same instruction on mutiple data sets. E.g. Add 10, Add 11, Add 12, Add 13 etc.. Points to the first item "10"and then It uses (IR) Index Register that in this case would be "n+1". Faster processing Relative Addressing- We cannot predict where the data can be, such as in "Add 10" the data sometimes is not in address "10" which we saw in indirect address. In relative address, the address is alway relative to first instruction address mentioned so that means (Every address relative to the first one) If the first instruction Add 10 is stored in address "100", it would now be stored in 110. Every address would be "100" more than what it say it is.

Using a example, explain BNF (Backus Naur Form) ?

-Languages are written differently, take into consideration For loops in C# and C++. To define the strict rules required to produce syntax which can be used by compilers to produce executable machine code we can use Backus-Naur Form or Syntax Diagrams, each an show the same information in a slightly varied way. Before we define the syntax we must have some definites which are not subject to the rules.The are called terminal symbols. For our example we will use the numbers0,1,2,3,4,5,6,7,8,9 and +, /,-,*It is to be noted that | represents or, while ::= represents 'is defined as' -For each language, a set of rules that specify precisely every part of the language. These rules are specified using Backus Naur Form (BNF) or syntax diagrams. <Integer>:==<Digit> Definition of a single digit is: <Digits> ::= 0|1|2|3|4|5|6|7|8|9 "< >" is anything that can be defined e.g. arithmetic signs, alphabet or digits. For long integers, it can be written as: <Integer>::== <Digit><Integer> which produces a recursive algorithm, For a example, using "147 " would produce in the algorithm: 1). <digit>= 1, integer= 47 2). <Digit>=4, <Integer >=7 3). <Digit>=7 <integer> ::= <digit>|<digit><integer> Creating several definitions allow it to be broken down until we have terms whose values can be easily determined, instead of having one big definition. Most like the form of top down modular BNF can define characters, real number etc... Syntax Diagrams As you may be able to see below the terminal symbols are placed in circles while defineditems such as LETTER are placed in boxes. In the right hand diagram the placement of the box for LETTER controls whether a letter is required before it can loop or continue.

What is lexical, syntax and code generation?

-Lexical Analysis is the compiling stage that it spots for any errors. If it does not have any errors, all the keywords would be put into a token table Tokens would exclude comments, white spaces and "=" assignment. - Syntax Analysis- It checks if it meets programming rules. - Code Generation- It is when it would generate the low- level language to a high-level language.

What is the main problem with paging?

-Pages are fairly easy to control because controlled by index system. -The main problem is it is unsensible divided .Rather, it would be sensible for the pages to be split up on procedures. This is why, there is segmentation. The main difference is that paging means dividing the physical memory space up in lines. Whereas, segmentations means logical dividing up the memory space. . The main disavadvantage is that complex to control because the system can no longer predict the beginning and end of a section (the memory size).

What is a complier?

-The Complier translates the whole program ONCE. It CONVERTS source code to object code. Whereas, an Interpreter DOESN'T convert source code to object code. INTERPRETER CONVERTS SOURCE CODE TO INTERMEDIATE CODE TO OBJECCT CODE. - It is easy to run compared to an Interpreter because it doesn't have to be interpret the code as it is being run. - From one line within instruction, can give way to many machine code. - The basic structure of a high level language is that it contains keywords. The keyword is associated with a statement/ an instruction.

What are the different schedulers?

-The scheduler is the part of the OS that controls the jobs around the processor. There is the: High Level Scheduler- It loads the jobs in the ready queue. The ready queue is a queue that these jobs have to wait to get processing time. Low Level Scheduler- It loads the jobs at the top of the ready queue, when a job had currently STOPPED. Medium Level Scheduler- It is when it controls the movement of an jobs between the high level to a low level scheduler. The sheduler described is an pre-emptive sheduler, in that it moves the job from the running to ready state. On the other hand, an emptive scheduler is when the job leaves from a running state to out of the system. It is because it has finished being processed, or requires pheriphal devices.

Why is normalisation used?

-To provide more accuracy in the representation -Mutliplication is more accurate -To ensure unique representation of a number

What is the purpsoe of scheduling

-User get fair access -Ensure there is a reasonable response time -Ensure algorithm rebust so that the system will not fail through overloading or by becoming blocked

What is library routines?

-Without library routes, the smallest line of code will recur. It would waste so much of the programmers time, for the program to keep on compiling, writing and testing these code. -Library routines will call the parameter with its procedure when it is needed. These procedures are pre-written, pre-compiled and pre-tested. "A library program is a collection of files. In programming, a library is a collection of pre-compiled routines that a program can use." -Linker- It links this procedure right place in the program. -Loader- It loads this procedure into the memory of the system. The loader is responsible for loading jobs and adjusting addresses so they work for their current memory positions instead of the ones they were written with. Some addresses can be calculated by relative addressing to the first address. The linker links parts of programs together, this can include the linking of library routines.

What is the algorithm for merging files?

...

What are the compiled methods?

1). Assembler (2) AND (3) translates high-level language (source code) to machine language. 2). Interpreter The interpreter translates 3). Complier

Explain the process of "deleting an item from the stack ".

1). Checks to see if the stack is empty. 2). If it is report an error message. 3). Copy the data item. 4). Decrement the stack pointer and store the copy of the data item.

What are the features of a Operating System?

1). Error detection and reporting :- Job of the Operating System to make sure that the hardware devices are working properly. If it does the computer system would need to report a error to the user and try to solve the problem. 2). Memory Management:- It includes the management of memory and jobs passing through it. 3). Utilities:- Provide utility software, so that maintenance can be CONTINUOUSLY done in the system. 4). File Management- The user makes a new folder, with a desired name and saves the file to the folder in the storage device. The system allocate the exact place in the storage device the folder will be allocated in. The name and the address will be recorded in a lookup table in the storage device, so that it can be retrieved later on. 6). CPU Management - 5). User Interface- Provide an interface between the user and the machine. 6). Provision of utility program - Programs that carry out specific needed task, such as DEFRAG and SCANDISK. Remember : Hardware Resources Interface Security Utility Software Uses disk defragment and disk cleanup Error Handling

What are the inserting methods?

1). Insertation sort- It runs through each item, comparing and then inserting it into a appropriate position. For an example, 20 47 12 53 32 84 85 96 45 18 It runs through 20, 47 --->( in correct POSITION) and then stops at 12. Insert this item "12" in its appropriate position. It supposed to be lower down in oder. Therefore: 12 20 47 53 32 84 85 96 45 18 Insertion sort is pretty much the process of copying every item of data from one table to the correct location in a new table. This method is very time consuming so it wouldn't be used for large sets of data FINAL 2). Quick Sort- It consists of two pointers //20// 47 12 53 32 84 85 96 45 /18/ /18/ 47 12 53 32 84 85 96 45 //20// {It swaps between the two pointer into an appropriate place} 18 /47/ 12 53 32 84 85 96 45 //20// 18 20 12 53 32 84 85 96 45 /47/ UNTIL the items are in order of: 18 /12/ //20// 53 32 84 85 96 45 47 //18// /12/ 20 SPLIT into //53// 32 84 85 96 45 47 /12/ //18// 20 /47/ 32 84 85 96 45 //53// Other methods include: Bubble sort

What is the difference between assembly language and machine code?

1). The assembly language translates to many machine code. 2). Assembly language is MORE portable between the different machines. 3). It involves keywords. Keywords, such as: Print These keywords have to be looked up and searched in a table. If not written correct, it fail to find it in the table and report an error. Else, it would check that it has been used correctly and in the right way.

Virtual Memory

A section of the hard drive that is used like memory rather than secondary storage. Used because so many programs are open that there isn't enough room in the RAM to contain all the required current files. When a new program is opened and requires more RAM than is currently available. Data for a currently open but inactive task/part of a program that isn't in use is transferred into the virtual memory, freeing up enough space for the new program.

What is array processor?

A array processor uses only one single processor on more than one arithmetic logic unit. MOST commonly happens in a one dimensional array, where it has all the same data type. It performs the same calculation SIMULTANEOUSLY on a group of inputted data. E.g where all the values represent the costs of different items in stock and it is required to find the selling prices which are calculated by adding the same percentage to each value.

What is a interrupt?

A interrupt is signal to the processor alarming it to that a task and instruction needs executing. It needs to stop the current instruction and carry out this one. ORDERED IN PRORITIES E.g. interrupt would be sent to the CPU when buffer needs refilling. A register is a area within the processor that holds particular type of data information. If the processor was to stop the current instruction, it would put all the values from the special register into a stack. When the interrupt has finished being executed, the values would be brought back into the processor's memory and it would execute what's leftover. Jumping between the CPU and ISR is called the context switching. If two or more interrupts appear, processor would decide depending on Interrupt Priority 1). Hardware Command Interrupt/ Hardware Failure Power Supply Failure 2). Software Interrupt 3). Timer Interrupt 4). I/O Interrupt Disadvantages of interrupt handling:- - Too many interrupts to handle Must have a skilled programmer to produce a program that can deal with so many interrupts. - Stack Overflow Overflow of Interrupts would crash the computer, therefore, It is best to use polling. When servicing a interrupt, would be loaded data into the stack and the first line excueted in the Interrupt Service Routine. Address of the first line would be recorded in the PC and fetch excuete cycle carried out.

Explain Interrupt Handling.

A processor would fetch an instruction, and then executes it. The cycle goes on, until all the instructions have been executed and complete. The interrupts would stop this cycle, such as: The Buffer is empty and needs refilling. It transfers all the data in the primary memory to secondary storage. Hardware Interrupts Software Interrupt, caused to the flow of a program by a call to an external device. Interrupts are given priorities because jobs and task may appear at the same time. It gives Power Failure Interrupt (HIGHEST priority). If an interrupt has an higher priority than the job currently being executed. Then, the processor would execute this higher priority interrupt and stop doing the other. The processor would store the contents of the other job, previously being executed, in a special registers (A STACK). Else, it would be a total wastage of the processor time. When the higher priority interrupt has finished being executed, then the contents in the other job would be loaded and executed. It execute from where the processor leftover.

What are the advantages and disadvantages of complier?

Advantages: -Complier only translates ONCE -End user does not have to find and download interpreter -Errors are reported to the developer when the program is compiled as opposed to errors being reported to the end user when they occur. - Source code can be confidential -Code portability, compilier can target different processors using the same source code. -Source code is not needed to run the code for it to be interpreted. .

...

Before, people only had to write out instructions in binary! It was difficult and inclusive only to few people. Fortunately, assembly language was developed, which uses a mnemonics (NOT the exact word, but a group of letters familiar to many people for the binary represented instruction e.g. SUB for Subtract, or MULT for multiply) and a label (the name given for the address which contains the data item. Assembly language look alike this: Input value ADD NUM1 - The system refers to a look-up table that translates between - A one to one relationship between binary operations and assembly languages. - The binary representation is the machine code. -The software that translate between assembly language(LOW-LEVEL language)to machine language is the assembler.

How would you express fraction in binary representation?

Binary represent fractions. Example). So 23/4 or 2.75 can be stored in two bytes, such as : 8 4 2 1 . 1/2 1/4 1/8 1/16 ----> 0 0 0 0 0 0 1 0 . 1 1 0 0 0 0 0 It can include more bytes for smaller fractions. Also, the fractional point must be kept in the same place because the computer has no othey way to represent the division between integer and fractional parts of the number. The system would be 2.75 as "10.11". It would be written as ".11011 * 2^10" The system prefers the above Other forms consist of:- .001011 x 2^100 1011. x 2^-10 This represented is called "Normalised". The part can be catergorised in the: -Mantassa-It is the one that contains the actual value, which is "11011" -The exponent- It is the "2^100", "2^-10", "2^100". Consider our 8 bit representation: The largest number that can be stored in this representation is -1 1/2 1/4 1/8 1/16 . -4 2 1 0 1 1 1 1 . 0 1 1, which is 0.1111 x 211 = (1/2 + 1/4 + 1/8 + 1/16) x 23 = 15/16 x 8 = 71/2

Explain the process of merging files?

Create a new list Compare the first item in the first list and the second list. 2) Copy this into the new list 3). Then, compare the second item in the first list with the first item in the second list. For an example, 2 4 7 10 15 and 3 5 12 14 18 26 New = 2 ("2" from the 1st set of data). = 2 3 ("3" from the 1st set of data). = 2 3 4 = 2 3 4 5

What is arithmitics operations, data transfer and flow control?

Different instructions that can be implemented in the processor: 1). Data Transfer- It is the ins and out of data in memory E.g. "Get", "Store" etc.. 2). Arithmitc Operation- When the data has been collected and decoded, the data is passeed to the MDR. All Results are calculted are in ALU Register and data stored in Accumulator 3). Flow Control- Include Conditions such as selection, iteration or JUMP instruction. No operand for Jump Instruction but it explains to the processor to skip to a particular instruction. The processor was going to the next instruction in line but the JUMP instruction changes the flow.

What is intermediate code?

Different designs of computer have different versions of machine code, so 001 in one computer may stand for ADD while in another it stands for SUBTRACT. This would mean that every computer would need a different compiler for each high level language. An alternative is to use a compiler to do most of the translation and end up with a version of the program which is close to all the different machine codes. This version of the program is in 'intermediate code', so called because it is half way between the high level language version and the machine code version necessary to run the program. This version is not machine specific but it is now translated into the particular machine code needed by an interpreter specific to that machine. This means that a program written in a high level language which is translated this way can be used on many different machines. This is called 'portability' and the program is said to be portable when it is in intermediate form. Unfortunately, full use of this method is not properly exploited, think about trying to run a game for whatever play centre you use on another system, it simply won't run. One of the few languages to use intermediate code is Java.

What is intermediate code?

Different systems will be compiled into different languages. To make other systems understand each other, Intermediate code was made. Intermediate code compiles into a code (between low and high level language/object code), so the system can translate it into machine code. Unfortunately, it cannot be run for the system to translate into machine code. It can only be run on a non-existent machine, called Virtual Machine. RUNS THE Intermediate code. A software [emilution] of a physical code Virtual machine is a hypothetical, generalized computer capable of running program as it is given. Intermediate code can be translated to executable code. IMPROVES PORTABILITY OF CODE One advantage :- is to reduce the number of translation programs that are necessary: to fully implement (say) 10 different computer languages on 15 machines would normally require 150 translator programs to be written - 15 for each language. Using an agreed intermediate code, 10 translators would be required to get from a language to the intermediate code, and a further 15 translators to get from intermediate code to the machine code of the computers - a total of only 25 pieces of software." Advantages include: It can be translated into object code in any system, as long as it has a interpreter Much quicker to translate because whole program does not need to be recompiled. Much quicker and easier to test/debug Uses less memory beause it only holds one line of source code at a time. Can be restarted from any point when a error has been corrected Disadvantages: Source code required because it does not produce object code immediately Run slower than excutable code because it has to be run a line at a time

What is object and source code?

Every program has an object code Object code is the translated code. it is translated by a translator program into object code that the computer can understand and execute. The Source code is the original code written by the programmer. You have been writing programs in a high-level language with instructions that are to be executed by the computer. Basically the assembler must translate the mnemonics into binary which is done by having a simple look up table with the mnemonics on one side and the binary equivalents on the other. The labels are a bit more complicated. The assembler does the translation in the same way, but the table is not fixed at the start, it has to be created by the assembler. As the program is input the assembler will recognise the first label as X and then will allocate a location to X. In this way it builds its own look up table for every program that it runs.

What is the algorithm for Insertation sort

FOR Position = 2 to n DO CurrentValue = Vector[Position] {Keep value of current number} {and store it in position 0} Vector[0] = CurrentValue {Now look at each number to the left of current number (Position - 1) and move each number right if it is greater than CurrentValue. If the number is not greater than CurrentValue, insert CurrentValue.} Pointer = Position - 1 WHILE Vector[Pointer] > CurrentValue DO Vector[Pointer + 1] = Vector[Pointer] {Move left one place} Pointer = Pointer - 1 ENDWHILE Vector[Pointer + 1] = CurrentValue ENDFOR END

How does a computer system manage there is not enough memory space for a program?

If there is not enough space for a program, several actions can be taken: 1).Wait for another program to finish that has big enough memory space. 2). Fragmenting part of the program into a free memory space and the memory space that another program has finished in. Fragmenting the program into small sections and parts will have an adverse and massive effect on the performance. 3). Moving programs around in memory, and then putting this program into the free space. Moving around the programs is easy, but the instructions have reference to the location and position in memory. Therefore, it has to be recalculated. 4). Another solution is to split the memory size equally, like 5k, and then each job would have an index is kept to show where all the jobs are, then dividing jobs up will not cause a problem.

Explain the process of deleting, and inserting in a Queue?

In a queue, there is a head pointer (at the top) and a tail bottom (at the bottom). A queue is (FIFO- First In First Out). The algorithm for insertion is: 1. *Check to see if queue is full. (ALWAYs and a MOST!) 2. If the queue is full report an error and stop. 3. Insert new data item into cell pointed to by the head pointer. 4. Increment the head pointer and stop. The algorithm for deletion is: 1. *Check to see if the queue is empty.(ALWAYs and a MOST!) 2. If the queue is empty report error and stop. 3. Copy data item in cell pointed to by the tail pointer. 4. Increment tail pointer and stop.

Explain Reverse Polish Notation and Polish Notation.

Infix notation is when the operator comes between the numbers. ( a + b ) More ambiguous and complex arrangement is c *( a + b) Should the operator inside the bracket come first or the multiplication operator? Prefix notation is when the operators are after or before the numbers. + A, B Polish Notation- ( a + b ) would be written as +, a, b which makes it less confuse and understanding more easier. "+, a, b" means "Add A number to B number". Reverse Polish Notation is the other way around. The operator is written after the operand. E.g. ( a + b) would be written as a, b, + The Reverse Polish Notation can be transferred to a stack. Reverse Polish is important in computing because expressions written in it are unambiguous, do not need brackets and they can be solved using stacks. A common use of binary trees is to convert an infix expression to RPN.we produce a binary tree in the form where each nodes 2 direct children are the numbers with which the nodes operation must be carried out on. Once we have this binary tree of the equation we can use Post-Order traversal to retrieve the string in RPN (post-fix notation), because we are putting the operators after the operands (post) we use post order so that we retrieve the parents (operators) after their children (operands).

What are the Normalised Form stages?

Instead of fields we call the columns attributes and the rows are called tuples. The files are called tables. Following stages take away repeated data and repeated groups. Definitionn of the stages- UNF-(Un Normalised Form) 1NF-This stage makes sure that the data is grouped and the attribute has one value. Outlines key fields:- primary key or foreign key. 2NF- This stage groups the data that are dependant on one another. 3NF-A relation that is in 1NF and 2NF, and in which no non-primary key attribute is transitively dependent on the primary key is in 3NF. That is, all non-key elements are fully dependent on the primary key

What is parallel processors?

It is a extension to a array processor. It has more than one processor working on a tonne load of calculation, but it needs to make sure that checks are made so the prerequisites can be completed. It has specially written instructions. NOT the standard instructions because it would have to depend on when other instructions have been implemented. E.g. when systems are receiving many inputs from sensors and the data need to be processed in parallel. Advantage-It is faster to get results! IMPROVES PROCESSING SPEED BY PROCESSING CONCURRENTLY becase mutiple instructions processed and more than one instruction processed at a time Different processors can handle different part of the same job Disadvantage-Special written program has to be done. Disadvantage: Not suitable for some programs. Program have to be specially written and made for the co-processor. Harder and difficult to test. OS is more complex to ensure synchronisation

Why is a database table set up?

It is because it allows records of data to be stored and a number of relationships to be set up. But SQL (Structured Query Language) is the method of setting up the database table and accessing data from it. Must understand SQL E.g. CREATE DATABASE test ( CREATE TABLE club ( ClubID INT NOT NULL, ClubName VARCHAR(50) NOT null, PRIMARY KEY( ClubID) ) It sets up a database table called "test", with the columns "ClubID" as a integer, Club Name as string of 50 characters. It makes sure that none of these columns are empty and declares "ClubID" as a primary key. The next line inserts data into the database table: INSERT INTO "test", "clubs", ("ClubID, "ClubName") VALUES("1","The Pullman Club") SQL (Structured Query Language) can delete, update and selecting records.

What the purpose of a spool queue?

It is especially used when there are loads of printout to be done, but there is such a slowness between the processor and the printer. This consumes and waste processing time. Therefore, the printouts are stored in the secondary storage/ hard disk drive (spool file). It will store all the print jobs on the secondary storage device and then to print them from the disk so that the processor(s) can get on with something else. This frees up the processor to continue with another job. It is stored in a queue, because it would be unfair for a random printout to be first priority. It must store the references to the jobs and their location in the queue. In a queue, it is an standard data structure. Therefore, It is must store in a secondary storage device because the queue would be a standardisd and unfixed size. A printout with a high priority may appear, than it stores the details in the queue and at the front rather than at the end. Spooling is simultaneous peripheral operations on-line is when jobs are stored in a buffer, or even in a disk, so that when the device is ready it can access it. It is very useful because different devices access in different rates. The printer gets on with another job, because the job is accessible and retrievable from the peripheral device . The buffer and the disk provides is an waiting station for the slower devices. The program that accepts a number of print outs is called the spooler. Print outs would be done in the background on a single user operating system. In a network, the printing would be done on a printing server. In a network, print outs can be prioritised. Print outs are optimised by given a lot of memory space to them, which makes it efficient and able to deal with a large number of print outs. If the total print out exceeds the memory fixed, the printer would stall, until some files have taken away from the queue.

Why is it important to have sorted files?

It is important because it allows binary search and to merge files together. SORTED includes: numberical or alphabetical order. Examples). 1 2 3 4 5 6 7 8 a b c d e f g h i

Sequence Diagram

It is meant to show how the different object interact between eachother and how/when the methods are activated in the object. The dotted lines symbolises how long the object is supposed to be processed. It is called the "lifeline" in sequence diagram. Some dotted line would be finite and small, compared to others.

Communicaton Diagrams

It is shows how different the objects are combined to carry out certain tasks. INSIDE the rectangles would be the object The arrows show the direction of data, beside it, there would be labels to show the methods for accessing the attributes of the object. Label, such as, giveReport, giveSalesInfo

What is a static structure?

It is when there is only a fixed structure only when/during the running of the program.

State Diagram

It shows the bahaviour of the object from different processes in the system. CANDIDATES must be able to understand the diagram and name the components. 1). The first circle represents the "entry point" to the system. 2). The arrows represent the "transitions" to and from states. 3). The rounded rectangles represent the "states" that the system can be in. 4). The "states" themselves are 'working' and 'in meeting'. 5). The 'trigger event' is the thing that changes the state of the system, in this case it is visitor arrives. 6). The circle with a dot shows the exit point from the system being described.

Explain, the stages that the system has to go through

Lexical- Compilier scans the whole code and converts it from source code to object code. SOURCE CODE AS INPUT 1). If keyword is found, the keywords would l be replaced with tokens (binary that would replace with letters in the keyword). 2). In this step, the programs would remove spaces and annotations. 3). Variables, data type and restriction with the variable would be stored in a symbol table. It would store in memory where the data and variable is located. -Syntax Analyse- This is the stage that it finds and reports the errors. 1). Keywords are stored as tokens 2). It would compare parse with variable rules and the instruction for the keyword on the look-up table. 3). It will use the look-up table to make its own acceptable line of code and compare it with 4). If it doesn't meet the requirements, then the syntax analyser would list the errors to the programmer and give an explanation alongside it. Code Generation- Once, it has understand what is happening in the program and the rules have been met. It will translate the statements from the high-level language to a low level language. However, it is a one to many relationship, in that one line of high-level language will produce many possible different way of writing the low-level language. -----> The CODE WILL BE LONG Optimization (Considered as part of code generation stage)- Reduces number of instructions and decrease the amount of memory used for the program, by reducing the unnecessary lines of code. CODE CONVERTED TO MACHINE CODE Consequently, it would be more efficient and the program would run quicker and much faster. INCREASES PROCESSING TIME

How to make a ER (Entity Relationship) diagram?

MANY to MANY relationships cannot be normalised. See page. 263 on how to make a ER (Entity Relationship) diagram.

Class Diagrams

Object Orientated Program uses classes. More complex meaning of class is that It is an entity of a given system that provides an encapsulation of functionality of a given entity. Such as student, or form. The Object Orientated program has the class, lists the characteristics of the elements in that class, and the methods to look at the facts in that class. Class are split into different hierarchy and levels. When classes share the same element as another, they would be linked to a class that contains the common material. such as, in a school: there would a class for teachers and students, it would be conjoined by "address" class. Inheritance would be shown by arrow. In UML diagram, it must contain appropriate uppercase and lowercase letter, right positioning of the classes, notation( brackets, colons, etc..). In a class diagram, The ENTITIES must be referred to real things. Each entity is supposed to match the attributes mentioned in the class, E.g. Student 1 Studentid=01342 Studentname=Rose

What is opcode, operand, mnemonics, address labals?

Opcode- Close to machine language, it is the assembley language code that the machine needs to carry out the instruction. Machine language as in only uses binary Operand-It is the other part of the instruction the processor needs to carry out the task. E.g. in ADD 10 The "10" is the operand Can be the data itself, the data address or other instructions. Mnemonics- It is the pseudo code names for the opcode. Near low-level language that humans can understand ! Address labels- These are labels given to the address in assembly language code. E.g. Add X "X" is the Address label It makes it easier to changes to the data in the program. Address labels It basically the process of treating binary addresses with pseudo names much like op-codes. This may be known as symbolic addressing, it is to be noted that computer does not use these labels they are purely for the human programmer. Arithmetic operations - The ALU manipulates any arithmetic operations to be carried out. Data Transfer - Operations like GET, STO, LDA are used to move things to and from memory. Flow Control - The basic principle of flow control is that if you wish for the processor to jump to a different location (perform an unconditional jump) you can just change the value in the PC to the new memory location.

What is a parse?

Parse is a look-through of the program, explaining what it is doing. It first must understand what the program is doing to produce an efficient code. Parse - To divide into smaller components for analysis. In linguistics this might mean going through a sentence and first identifying the different parts (nouns, verbs, adjectives, punctuation). A second parse may then check if those types of words are being used correctly e.g. no adverbs without a verb. In computer science compilers carry out different parses of the code whilst translating. Each parse allows it to sort out another element of the code.

What is the algorithm for quick sort?

QUICK sort is more complex to program. LB= The loweer bound in the subscript and UB=The Upper Bound in the subscript. QuickSort(Vector, LB, UB) IF LB <> UB THEN {There is more than one element in Vector, therefore it needs sorting} Set I = LB {Left pointer} Set J = UB {Right pointer} REPEAT WHILE I <> J AND Vector[I] < Vector[J] DO {Move right pointer left} Make J = J - 1 ENDWHILE IF I<> J THEN swap Vector[I] and Vector[J] WHILE I <> J AND Vector[I] < Vector[J] DO {Move left pointer right} Make I = I + 1 ENDWHILE IF I <> J THEN swap Vector[I] and Vector[J] UNTIL I = J {Value now in correct position} {So sort left sublist} QuickSort(Vector, LB, I - 1) {Now sort right sublist} QuickSort(Vector, I + 1, UB) ENDIF END

State the advantages of both static structure, and dynamic structure:

STATIC structure: Easy to program and notice overflow in memory. It allows random access Dynamic structure: Efficiently uses the memory space Storage not exactly required as it can be used for other things/

State the disadvantages of both static structure, and dynamic structure

Static Structure: Limits and wastes alot of space e.g. a list A list is a set of items each with its own pointer to the next item. The start of the list is found by the Head of list pointer, the final item in the list's pointer will just contain 0 or null. A list is a static data structure, for this reason the memory space has to be declared before use, this causes a problem with needing to know how much information will need to be stored, depending on this certainty its quite possible a compromise will have to be found. It is hard to calculate an appropriate MAX. space, without even wasting memory space. Dynamic Structure: Difficult to program e.g. a linked list A linked list is a dynamic data structure form of a list, each item has a pointer which points to the following item. The list as a whole also has a head of list pointer and a next free space pointer. Due to linked list being a dynamic data structure the memory can be reserved as required. If you want to search for an item through a linked list, you have to search from start to finish, depending on the order of the data and the item you are searching for's position within this order it will take on average the time it takes to search half the items in the linked list, with a couple of thousand items this can become an ineffective/slow search method. To add item c to the list you would place item c in the free space list pointer's memory location, copy the pointer from item b and set item b's pointer so it points to item c's memory location.

How would the fetch execute cycle be written in pseudo code language?

Steps are such: 1. Load the address that is in the program counter (PC) into the memory address register (MAR). 2. Increment the PC by 1. 3. Load the instruction that is in the memory address given by the MAR into the memory data register (MDR). 4. Load the instruction that is now in the MDR into the current instruction register (CIR). 5. Decode the instruction that is in the CIR. 6. If the instruction is a jump instruction then a. Load the address part of the instruction into the PC b. Reset by going to step 1. 7. Execute the instruction. 8. Reset by going to step 1. Fetch is Steps 1-4. Execute 5, 6a. and 7. It would restart the cycle again from stage (1) in the two given situation: 1). Another instruction in order to be implemented. 3). There is a JUMP instruction, which would skip the planned order to another particular instruction. The address of that instruction would be loaded to the PC, before it is reset and started again.

What is the process of BIOS?

Test for BIOS (Basic Input Output Setting) using POST (Power On Self Test). Test the keyboard device, hard disk drive and others. If error is detected and device is absent would display a error message. The BIOS is on the RAM and ROM. Part of the BIOS can be configured and edited by the user. Bootstrap- Connects the System to the Operating System. The BIOS would try and find the bootstrap program, in a pre-set place known as the boot sector, would look in the hard disk drive, CD drive and the The BIOS would transfer the bootstrap program from the disk drive to RAM. The bootstrap program will take over. It will try and find the Operating System and would transfer it to RAM. The Operating System would try and find the boot files, which are files that the user can play around with to what they want.

Explain the process of "inserting in a tree diagram ".

The algorithm of inserting an item into the tree diagram: 1. If tree is empty enter data item at root and stop. 2. Current node = root. 3. Repeat steps 4 and 5 until current node is null. 4. If new data item is less than value at current node go left else go right. 5. Current node = node reached (null if no node). 6. Create new node and enter data. For an example, using the circumstance of add an item when Jack is root of the tree diagram: 1. The tree is not empty so go to the next step. 2. Current node contains Jack. 3. Node is not null. 4. and is less than Jack so go left. 5. Current node is null. 3. Current node is null so exit loop. 6. Create new node and insert and and stop.

What is RISC and CISC?

The more operations the more complex it is for the processor and the more bits that are required. Types of operation and operation codes used in systems are: -RISC(Reduced Instruction Set Character) Some processors are designed to have a reduced number of recognized operations, hence saving space in the operation code lookup table and therefore slightly faster processing due to a smaller lookup table. Any operations which have been removed have to be worked around by clever programming. But a RISC computer should have the same functionality. These are know as RISC's. -CISC(Complex Instruction Set Character) uses more instruction sets. Some processors are designed to carry out more complex operations and hence require more operation codes so that there is 1 code for each operation which can be carried out. This therefore require a larger instruction set. These are known as CISC's Therefore, the advantage of RISC is that: 1). it would run faster 2). frees up the processor space 3). uses more simpler instructions

What is the result of increasing the exponent?

The results of increasing the number of bits for the exponent are: 1 The number of bits for the mantissa goes down. 2 The accuracy that is available is reduced. 3 The range of (size of) numbers that can be stored is increased.

Explain the process of "deleting in a tree diagram".

There are two possible ways of deleting in a tree diagram: 1). Firstly, labeling the item as "deleted". It leaves the data structure unchanged, and in the same order. The system would ignore this item, and continue onto the others. 2). Simple, making the admendant without the deleted item onto another data structure (e.g. stack, queue etc..). Then, inserting it back into th This "(1.)" first method would be used when there is very few deleted item. Else, the second method would be used where there are a load, and many deleted items. Deleting one root, would affect the other items. Alternatively, cutting out parts of this tree diagram. Making admendants---> affect the

...

These pages would be loaded in memory, when it is needed to be processed. When the page has been finished being processed, it is depensed. Pages are loaded from a special type of memory "the virtual memory". The virtual memory is much more high-speed and faster However, when it is loaded in memory it overwrites the original and previous page. A problem arises because when the processor want to attend back to the previous page ----> the processor would have to find the instruction, then retrieve it from the address and lastly overwriting the originial. This problem is called disk threshing. It spends too much time on moving item between the storage and the memory, compared to the actual processing. Paging is preferred as the whole job would not to be loaded. Also, pages don't consume that much memory.

What is the Van Neumann architecture and how is this used in computer systems? What is the fetch execute cycle and the registers in a processor?

Van Nuemann figured out programs and data are indistinguishable, therefore, it only needs one processor and stored in ONE memory. NO MORE than one processor! Programs and data were stored in separate memories. It became very tedious to retrieve and alter these programs. Van Neumann described it as the serial instructions are fetched and then executed before carrying out the next. Register-It is a special place of storage for a specific item(instruction or data). These registers outside the IAS( Immediate Access Storage) are fast to retrieve. The registers inside the processor follow the fetch-decode-execute cycle: 1). Fetch- The Program Counter stores the next instruction or data address that E is supposed to be incremented. The MAR copies the address from the PC. The contents of the address(the data or instruction) are fetched in the register "MDR and the CIR". It increments the next data or instruction address in the PC. 2). Decode- The decode stage is done in the CIR register. Two different types in a instruction: 1).the operation code 2).the address in memory of the data to be used with that operation. The CIR uses a look up table to interpret and explains the instruction. Execute- Once the processor has all the instructions and data needed, it can: - performs a arithmetic calculation in the accumulator (ALU) register - The address part of the instruction would be recorded in the MAR and then content of the address copied to the MDR. The data retrieved is used. - It has a jump instruction, puts the next JUMP instruction address in the PC. MDR acts as a buffer and the PC controls the order in sequences. PC( Program Counter) and CIR( Control instruction Register)- in the Control Unit ALU(Arithimitic Logic Unit) - in the accumulator MAR and MDR outside the accumaltor

Explain the process of "Inserting an Item into a stack".

When a stack pointer attempts to leave the bottom of the reserved memory (read an item when empty) you receive a stack underflow, when the stack point attempts to leave the top of the reserved memory (add an item when full) you receive a stack overflow. A stack follows first come last served. ONLY stack and pointers are NEEDED 1). It has to make sure that the stack isn't empty, else, report an error message. 2). Increment Pointer 3). Add item into the node pointed to by the stack pointer and s

What is a relational database?

Whereas, keeping data on more than one database table is called a relational database. 1). Data is only stored once. In the previous example, the city data was gathered into one table so now there is only one record per city. The advantages of this are: No multiple record changes needed More efficient storage Simple to delete or modify details. All records in other tables having a link to that entry will show the change. 2. Complex queries can be carried out. 3. Better security. 4. Cater for future requirements. Summary - advantages of a relational database over flat file: Avoids data duplication Avoids inconsistent records Easier to change data Easier to change data format Data can be added and removed easily Easier to maintain security.

Activity Diagram

YOU MUST understand the symbols and the digram. Therefore, see UML page 9.-11

What is co-processor?

a additional processor that is used for a speecific task It occurs in a situation where it needs a representation for long floating points of bits. Therefore, the maths co-processor aids the processor by doing it in ONE GO.


Kaugnay na mga set ng pag-aaral

bio psych - ch.3.3 research methods

View Set

MyEconLab Chapter 8 (Gross Domestic Product)

View Set

Government Chapter 04: Civil Liberties

View Set

Management Exam 1 Chapter 1, MGT 3370 Online Quiz 1

View Set

01.01.03 Translate German to English

View Set