0% found this document useful (0 votes)
12 views

CIE Computer Science Paper 2

The document outlines key concepts in computer science, including abstraction, decomposition, algorithms, and data structures like stacks, queues, and linked lists. It also discusses the software development life cycle, detailing models such as Waterfall, Iterative, and Rapid Application Development (RAD), along with their benefits and drawbacks. Additionally, it covers features of pseudo code, integrated development environments (IDEs), and error types in programming.

Uploaded by

fantasyxcape
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

CIE Computer Science Paper 2

The document outlines key concepts in computer science, including abstraction, decomposition, algorithms, and data structures like stacks, queues, and linked lists. It also discusses the software development life cycle, detailing models such as Waterfall, Iterative, and Rapid Application Development (RAD), along with their benefits and drawbacks. Additionally, it covers features of pseudo code, integrated development environments (IDEs), and error types in programming.

Uploaded by

fantasyxcape
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

CIE Computer Science Paper 2

Abstraction- the process of extracting information that is essential, while


ignoring what is not relevant, for the provision of a solution.
Benefits-
● the time required to develop the program is reduced so the program
can be delivered to the customer more quickly
● the program is smaller in size so takes up less space in memory and
download times are shortened
● customer satisfaction is greater as their requirements are met without
any extraneous features.
● develop clear models for the solution to complex problems.

Decomposition- Decomposition is a problem-solving technique that involves


breaking down a complex problem into smaller, more manageable parts or
modules

Algorithm- solution to a problem expressed as a sequence of defined steps

Stepwise refinement - Stepwise refinement is a top-down design technique


that involves gradually refining a high-level algorithm or problem statement into
detailed steps or subroutines

Stepwise refinement focuses on progressively refining a high-level solution


into detailed steps or subroutines, while decomposition focuses on breaking
down a problem into smaller, self-contained modules.

Purpose of a record structure- composite data structure to hold a set of data of


different data types under one identifier

Index (array) – a numerical indicator of an item of data’s position in an array.


Lower bound – the index of the first element in an array, usually 0 or 1
Upper bound – the index of the last element in an array.

Abstract data type (ADT) – a collection of data and a set of operations on that
data.
Stack – a list containing several items operating on the last in, first out (LIFO)
principle.
Queue – a list containing several items operating on the first in, first out (FIFO)
principle.
Linked list – a list containing several items in which each item in the list points
to the next item in the list.

Uses
Stacks- main memory management, expression evaluation, undo operation and
browser back, the return address to the main program during procedure calls
Queue- Management of files sent to a printer, Buffers used with keyboards,
Scheduling
Linked list- using array to implement a binary tree

Key features
Stack-
Queue
● Each queue element contains one data item
● A Pointer to the front of the queue
● A Pointer to the end of the queue
● Data is added at back
● works on a FIFO basis
● May be circular
Linked list
● Each node contains data and a pointer to the next node
● A Pointer to the start of the list
● Last node in the list has a null pointer
● Data may be added / removed by manipulating pointers (not moving
data)
● Nodes are traversed in a specific sequence
● Unused nodes are stored on a free list // A free-list pointer to the free
list

Implementing a stack
. Declare a (1D) array of data type
. The number of elements in that array corresponds to the size of the
required stack
. Declare an integer / variable for StackPointer
. Declare an integer / variable for the size of the stack
. Use the StackPointer as an index to the array
. Pointers and variables initialised to indicate empty stack
. Store each item on the stack as one array element
. Push and Pop routines need to check for full or empty conditions

Implementing a queue
. Declare a 1D array
. Declare and initialise front and rear pointers
. Items are added to the rear and read from the front
. Once items are added to the last node in the array and queue is not
full, rear become 1
Implementing a linked list
. Define a record type with fields for data and pointer
. Declare one (1D) array of the defined record type
. Declare an integer / variable for StartPointer
. Define appropriate value for null pointer
. Declare an integer / variable for FreeList pointer
.

Adding items to a stack(PUSH)


. Check if stack is full
. If full, display error message and exit
. If not, increase the stack pointer by one
. Store the item in the location pointed by the SP

Removing an item from a stack(POP)


. Check if the stack is empty
. If it is, display error message and exit
. If not, copy the item to a different location
. Decrease the stack pointer by one

Adding items to a queue(Enqueue)


. Check if queue is full
. If full, display error message and exit
. If not, increase the rear pointer by one
. Store the item in the location pointed to by the rear pointer

Removing an item from a queue


. Check if queue is empty
. If empty, display error message and exit
. Otherwise, copy the item pointed to by the front pointer
. Increase the front pointer

Features of pseudo code that make it easier to read and understand


. White space
. Meaningful variable names
. Capitalized keywords
. Indentation
. Comments

Features of IDE
Coding
● Context-sensitive help
● Syntax checking (on entry)
● Automatic indentation
● Type checking (Parameter checking)
● PrettyPrinting
● Highlight structure blocks (e.g. selection, iteration)
● Highlight any undeclared variables
● Highlight any unassigned variables
Functions and Procedures - a set of statements that can be grouped together
and easily called
in a program whenever required, rather than repeating all of the statements
each time.

Parameter – a variable applied to a procedure or function that allows one to


pass in a value for the procedure to use.
Argument – the value passed to a procedure or function
Header (procedure or function) – the first statement in the definition of a
procedure or function, which contains its name, any parameters passed to it,
and, for a function, the type of the return value.
Procedure interface- the term that refers to how the procedure interacts with
the calling program
For procedures its only parameters passed, function interface includes
parameters and values returned

Software development life cycle


purpose of a development life cycle - to set out the formal stages of software
development because development needs to be well ordered and documented

Waterfall model – a linear sequential program development cycle, in which


each stage is completed before the next is begun.
Benefits
easy to manage understand and use
stages do not overlap
works well for smaller programs where requirements are known and
understood
Drawbacks
difficult to change the requirements at a later stage
working program is produced late in the lifecycle
not suitable for long, complex projects

Iterative model – a type of program development cycle in which a simple


subset of the requirements
is developed, then expanded or enhanced, with the development cycle being
repeated until the full system has been developed.
Benefits
some working programs are developed easy in the lifecycle
easier to test and debug smaller programs
more flexible as easier to change requirements
customers involved at each iteration
Drawbacks
whole system needs to be defined at start, so that it can be broken
down into pieces that can be developed at each stage
needs planning at every stage
not suitable for short simple projects
Rapid application development (RAD) – a type of program development cycle
in which different parts
of the requirements are developed in parallel, using prototyping to provide early
user involvement in testing.
Benefits
reduced overall development time
minimal planning
frequent customer feedback
fas parts of the system are developed side by side, modification is
easier because each part must work independently
Drawbacks
system needs to be modular
needs strong team of skilled developers
not suitable for simple short projects

Analysis – a process of investigation, leading to the specification of what a


program is required to do.
Design – it uses the program specification from the analysis stage to show
how the program should be developed.
Coding – the writing of the program or suite of programs.
Testing –the testing of the program to make sure that it works under all
conditions.
Maintenance – the process of making sure that the program continues to work
during use.

Structure chart – a modelling tool used to decompose a problem into a set of


sub-tasks. It shows the hierarchy or structure of the different modules and how
they connect and interact with each other.

Features of structure charts


. Iteration
. Selection
. Sequence
. Hierarchy of modules
. Parameters passed

State-transition diagrams show the conditions needed for an event or events


that will cause a transition to occur, and the outputs or actions carried out as
the result of that transition.

Run-time error – an error found in a program when it is executed; the program


may halt unexpectedly.
Syntax error – an error in the grammar of a source program.
Logic error – an error in the logic of a program.

You might also like