PROGRAMMING FORM 5

 

Embed or link this publication

Description

PROGRAMMING FORM 5

Popular Pages


p. 1

LEARNING AREA 5 – PROGRAMMING 5.1 Basic Programming Concepts 5.1.1 Define Program and Programming Language 5.1.1.1 State the definition of program A computer program is a series of organized instructions that directs a computer to perform tasks 5.1.1.2 State the definition of programming language A programming language is a set of words, symbols and codes that enables humans to communicate with computers. 5.1.2 Level and Generation of Programming Languages 5.1.2.1 Identify the generation of low-level programming language with examples. Low Level First Generation – 1GL Description Machine language is a set of instructions and data (written in binary code) that a computer's can execute directly. Assembly language is the human-readable notation for the machine language used to control specific computer operations. Examples Machine language Second Generation – 2 GL Assembly language 5.1.2.2 Identify the generation of high-level programming languages with examples High Level Third Generation language Fourth Generation Language – 4GL Fifth generation _ 5GL (natural language) Description Procedural language uses a series of English-like words, that are closer to human language, to write instructions. Non-procedural language, enables users to access data in a database. Provides a visual or graphical interface, (visual programming environment) Allows people to interact with computers without needing any specialised knowledge. Examples PASCAL, FORTRAN, COBOL, BASIC, C, ADA SQL, NOMAD anf Focus Prolog and Mercury

[close]

p. 2

5.1.3 Programming Language Approaches Programming Approaches STRUCTURED PROGRAMMING Uses a top down design model means that the whole program is broken down into smaller sections that are known as modules. Examples: Ada, Pascal and Fortran OBJECT-ORIENTED Refers to a special type of programming approach that combines data with functions to create objects. Examples: C++ and Java are complete object-oriented languages 5.1.3.3 Differentiate between structured approach and object-oriented approach in programming. Structured Programming o Uses a top-down design modelThe whole program is broken down into smaller section that are known as modules o Always use for organizing and coding computer programs which employ a hierarchy of modules o Control is passed only through the hierarchy o Eg: Ada, Pascal, Fotran Object Oriented Programming o Uses objects o o Combines data with functions to create objects. Every object has relationship with one another Eg: Smalltalk,Java, Visual Basic, C++

[close]

p. 3

5.1.4 Translator 5.1.4.1 Describe the translation method of programming using assembler, interpreter and compiler Low level language Translate to Machine code Using : ASSEMBLER High level language Translate to Using : INTERPRETER Machine code High level language Translate to Object code Translate to Machine code Using : COMPILER Translation Method 1. Assembler Description An assembler is a computer program for translating assembly language — essentially, a mnemonic representation of machine language — into machine language. Example : MACRO-80 Assembler and Microsoft MASM Interpreter is used to interpret and execute program directly from its source without compiling it first. Example: BASIC, Logo and Smalltalk. The source code (in text format) will be converted into machine code which is a file consisting of binary machine code that can be executed on a computer. If the compiler encounters any errors, it records them in the program-listing file. Example: C++, Pascal and COBOL 2. Interpreter 3. Compiler

[close]

p. 4

5.1.4 Basic Elements in Programming 5.1.5.1 Differentiate between constants and variables Constants characteristics Value is not changeable during the course of the program Use constant when you want to declare something that won’t change midway in your program execution. variables Value can be changed anytime during the course of the program Use variable to store data that may or will change during the running of the program. usage 5.1.5.2 Differentiate between data types: Boolean, integer, double, string and date. DATA TYPES Boolean DESCRIPTION consists either a True or False value. Programmers usually use it to store status. DECLARATION Const Input_Status = true or Dim Input_status As Boolen Input Status = False Const year_birth = 1998 or Dim age As Integer Age = 17 Const PI = 3.142 or Dim Marks As Double Marks = 60.5 Const Name = ―CHOO‖ or Dim Address As String Address = ―Kuala Lumpur‖ Example: 7/8/91, 12:28 AM Integer contains any whole number value that does not have any fractional part. Double Any number value that may and could contain a fractional part. String contains a sequence of characters Date Contain date and time value 5.1.5.3 Differentiate between mathematical and logical (Boolean) operators. Operators Mathematical Logical Function Mathematical operators perform mathematical operations such as plus or substract Logical operators perform logical operations such as checking the condition of two Boolean values. Relational operators perform element-by-element comparisons between two arrays (elements).. Examples +, -,*,/ AND, OR , NOT Relational ( Comparison ) =, <, > , < > , <= , >=

[close]

p. 5

5.1.5.4 Differentiate between sequence control structure and selection control structure. Sequence Control Structure Executes statement one by one in linear or consecutive order Use when want to execute code line by line Does not use the decision symbol Flowchart Selection Control Structure Executes different statements for different condition Use when want to implement decision making process in the program Use the decision symbol Execution Flow Usage

[close]

p. 6

5.2 Programming Development 5.2.1 Apply Program Development Phases To Develop A Problem-Solving Program PROBLEM ANALYSIS PHASE DESIGN PHASE CODING PHASE TESTING AND DEBUGGING PHASE DOCUMENTATION PHASE

[close]

p. 7

5.2.2 1. Program Development Phases ANALYSIS PHASE The programmer will interview the client to find out what the client’s needs are. Identify input, processing, output and data component. Ask expert,refer to book and website. Meet with the system analyst and user. For example, the client might be a school that wishes to set up a school registration program. So the school administrator might tell the programmer that they need to record students’ data such as name, date of birth, gender, class, parents’ names, address and contact numbers. 2. PROGRAM DESIGN PHASE The programmer will divide all program activities into program modules Create solution algorithm for each program modules Write an outline of the logic(pseudo code) of the program. Design a flow chart. Design user interface Pseudo code Flow Chart

[close]

p. 8

Elements Terminal (beginning or ending of program) Flow line ( to connect symbols and indicate the sequences of operation) Input/Output (enter data or display information) Process (a process to be carried out) Decision (condition that determines a specified path to follow) Graphical Form Connector (entry from or exit to another part) 3. CODING PHASE Translating the algorithm into programming language.(usually on paper) After finishing the coding process, the programmer will type the programming language code into the computer.(eg.Pascal,C++ and Visual Basic) 4. TESTING AND DEBUGGING PHASE Is to ensure the program runs correctly without any syntax or logic errors. If errors are uncovered during testing, the programmer will proceed to debugging. Debugging involves tracing the source of errors in the program and making the necessary corrections. 5. DOCUMENTATION PHASE Documentation refers to the written material generated throughout all the phases of program development. Thus documentation includes the detailed problem definition, the program plan (flow chart or pseudo code), comments within the source program and testing procedures. A detailed description of the program, clear layouts of input and output records and a program listing.

[close]

p. 9

5.3 Current And Future Developments 5.3.1 5.3.2 5.3.3 Fifth Generation Language Natural Language OpenGL (Graphic Library)

[close]

Comments

no comments yet