Computers π©πΏβπ» | Algorithms | 7.1 Flashcards
What are the steps in program developing life cycle?
Analysis-Design-Coding-Testing
What is the analysis step in program development?
The step where the user must figure out the problem and decide how to resolve it.
What are the steps of analysing the process?
- Choosing a program
- Abstraction of the problem
- Decomposition of the problem
- Identification of the problem
- Requirementβs specification
What is Abstraction of a problem?
The process of filtering out the characteristics of problems that are not needed in order to concentrate on those that are needed. It allows programmers to have a general idea of a problem and how to solve it.
What is decomposition of a problem?
Analysing a complex problem and breaking it down into smaller more manageable parts that are easier to understand.
What is identification of a problem?
Understanding the problem statement, finding the requirement, and output of problem solution.
What is a problem statement?
A problem statement is usually one or two sentences to explain the problem your process improvement project will address.
What is the requirementβs specification?
A document that captures a complete description on how a system is expected to perform.
What is the designing step of program development?
Various design tools such as
- Decomposition
- Structure diagrams
- Flowcharts
- Pseudocode
are used for program specification
What is the coding step of program development?
When the language of programming is used to write the lines of code based on the program specification obtained from the design stage. The code is the program listing or source code.
What is the testing stage of program development?
In various levels of software testing, the code is tested. It is iterative and tested till free of errors.
What are the methods of testing and debugging a program?
Unit - individual modules tested
System - all modules, the whole system tested
User acceptance - asking someone or another company to test the program.
What is a system?
A combination of the parts or components which work together to control a task or activity.
What are the types of systems?
Natural systems, Abstract systems, Designed systems, Information systems.
What are some natural system examples?
Ecosystems, water cycles
What are some abstract system examples?
Maths equtions, computer programs
What are some designed systems examples?
Cars, internet
What are some information system examples?
Banking system, databases
What are the elements of a system?
- Boundary
- Environment
- Observable mechanisms
- Subsystems
- Control mechanism
What is a boundary in a system?
What separates a system from its environment, often not sharply defined. aka interface.
What is the environment in a system?
Parts of the world which the system can interact with. The system and environment are interrelated.
What are observable interactions in a system?
How the system interacts with the environment. e.g. Inputs and Outputs
What is a subsystem in a system?
It can decompose a system into parts, each part also a system. For each subsystem, the remained of the system is itβs environment. They are interdependent.
What is a control mechanism in a system?
How the behavior of the system is regulated to allow it to endure often natural mechanism.
What is a computer system?
A system made up of software, data, hardware, communications, and people.
What can a system be divided into?
Into sub systems, further sub systems, and modules.
When designing a computer system, what is it referred to?
As a complex problem.
What are the sub systems within a system sometimes referred to?
Sub problems
What is top-down design?
The breaking down of a computer system into sub systems, also broken down until each subsystem performs one action.
What is the method of breaking down a computer system in top-down design called?
Stepwise refinement
What is the process of breaking a problem into smaller parts called?
Decomposition.
What is a module?
An individual section of code that can be used with other programs.
What is the difficulty of looking at a system as a complex problem?
It seems impossible to solve as it is complicated to handle.
What are the benefits of top down design?
- Helps development team to clarify what needs to be done.
- Algorithms can be developed quickly as each designer can be given a separate module to work on, for their area of expertise.
- It is easier to debug
- Structure diagrams showing how modules relate to each other help visualize a program
- Makes it easier for another designer to understand the logic of an algorithm
- Modules can be reused in different programs that require the same structure.
What do we use to show top down design in diagrammatic form?
Structure diagrams.
How does a structure diagram show a top down design?
It shows the design of a system in a hierarchical way, each level giving a more detailed breakdown of the system into subsystem.
What is an algorithm?
A sequence of steps which are considered as a set of instructions to solve a problem or execute a given task.
What are the algorithm design methods?
- Pseudocodes
- Program flowcharts
- Structure diagrams (top down design)
What is an identifier?
A name or label chosen by the programmer to represent an object within a program. It could be a variable, function, procedure, data type, or any other element defined in a program.
What is a variable?
A uniquely named location in memory (RAM), in which a single data item can be held while a program is running. By definition the program can change the value held during the time of the program execution.
What does a variable consist of?
A name, data type, size, and memory location.
What are the rules to declare a variable?
- Reserve words or keywords cannot be taken as variable names (eg INPUT, IF, ENDIF)
- Every variable name should start with alphabets / underscore, not with numeric or special characters.
- Except βunderscoreβ, no other special characters are allowed in the middle of the variable declaration.
- No spaces
- Meaningful names
- Variable names cannot be repeated within same level of scope (program segment)
What are the basic data types used in algorithms?
Integers, Real, Char, Boolean, String, Date
What is Integer data type?
- Positive or negative whole number
- Used with mathematical operator (eg +35, -24)
- Used for counting, whole number addition/subtraction
What is real data type?
Numeric data with decimal numbers
What is char data type?
Holds only a single character, used for codes.
What is Boolean data type?
Represents a logical value: only two
What is string data type?
Consists of 1 or more characters
What is date data type?
Stores date in (dd/mm/yy) format
What is the operator for assignment?
What is the modular function?
It returns the remainder (5 MOD 2 returns 1)
What is the operator for modular function?
MOD
What is the integer function?
It returns the integer value, rounding down (eg 89.9 returns 89)
What is the operator for integer function?
INT
How is a value assigned?
arrow!!
How do we show βLess than or equal toβ, or βMore than or equal toβ in an algorithm?
<=, >=
How do we show βNot equal toβ in an algorithm?
<>
What is a constant?
A data value which can be introduced at the time of program execution.
What are the two kinds of memory?
Primary memory and secondary memory
What does primary memory consist of?
RAM and ROM
What are the types of secondary memory?
Magnetic media, optical media, and solid state
What are examples of magnetic media?
Magnetic tape, floppy disc, hard drive
What are examples of optical media?
CD, DVD, and BluRay
What are examples of solid state memory?
Pendrive and SD card
What is pseudocode?
Pseudocode is a method of representing program instructions using plain English, Mathematical notations, and keywords commonly found in high level languages without being bound by the strict rules of vocabulary and syntax of any popular programming language.
What is a flowchart?
A diagrammatic representation of step by step instruction of a program or problem, showing the workflow or process step by step in symbols.
What is used for starting and stopping in a flowchart?
A rounded rectangle. There can be one start point but more stop points.
What is used for inputs and outputs in flowchart?
A parrerelogram.
What is used for processes in flowcharts?
A square, used for any operation or sequence of instructions that do not involve a decision.
What is used for decisions in a flowchart?
A diamond with two arrows leaving.
What is used as a connector, and what is a connector in a flowchart?
A circle, continuing on the next page to indicate the flowchart continued elsewhere at an identically labelled connector point. To simplify layouts, connector symbols may be used to replace lengthy flow lines or indicate that the flowchart continues on another stage.
What are the 3 basic control structures?
Sequence, selection, repetition/iteration/loop
What is a sequence?
A set of instructions executed in order.
What is a seclection?
A decision made based on some strict condition.
What is a repetition?
A set of actions repeated a number of times.
How can a program execute a series of steps in order?
Program instructions should be written with sequential control, writing one action after another, each action on a line by itself aligned by the same event.