This action might not be possible to undo. Are you sure you want to continue?
1 ) A computer program is a set of instructions given to the computer to perform any task. State the definition of programming language ( 184.108.40.206 ) A programming language is a set of words, symbols and codes that enables human to communicate with computers. Example of programming language:Dim number1 as Integer Dim number2 as Integer number1 = 10 number2 = 20 If total = number1 + number2 Then Print “Excellent” Else Print “Please try again” End If
Words (Dim, If, Then, For, Next)
Symbol (=, +, -, *, /)
Levels and Generations Of Programming Languages (5.1.2) Identify the generations of low-level programming languages with examples. (220.127.116.11) Low-level programming languages First Generation Machine Language Second Generation Assembly Language
First Generation: • Language that computers can execute directly. • Instructions in this language are in the form of binary digits 1s and 0s. • Examples : Machine Language 101000010011001101 – Statement for adding two numbers. 101000100011001101 – Statement for subtracting two Second Generation (Assembly language): • Uses symbolic instructions (mnemonics) to represent the instructions in the programs.
• Examples : AUTOCODER, SAP and SPS ADD R1 R2 – Adds two numbers stored in registers R1 and R2. SUB R1 R2 – Is the instruction to subtract two numbers stored in the Identify the generations of high-level programming languages with examples (18.104.22.168) High-level programming languages Third Generation COBOL, BASIC, C, ADA Third Generation Forth Generation SQL, NOMAD, FOCUS, Intellect Fifth Generation Prolog and Mercury
• Uses a series of English words and mathematical symbols for writing programs
to write instructions.
• Example: COBOL, BASIC, C and ADA
Forth Generation • • • A very high-level programming language Non-procedural language enables users to access data in a database. Example: SQL
Fifth Generation • • Visual programming language Provides a visual or graphical visual programming creating source codes. Example: Prolog and Mercury (natural language). interface, called environment, a for
Programming Language Approaches (5.1.3) Programming Languages Approaches Structured Approach Object-Oriented Approach
Define structured approach in programming (22.214.171.124) • uses a top-down design model where developers map out the overall program structure into separate subsections from top to bottom and also known as modules Example : C, Pascal and Fortran
Define object-oriented approach in programming (126.96.36.199) • • Refers to a special type of programming approach that combines data with functions to create objects. Example : C++, Java and Visual Basic
Differentiate between Structured approach and Object-Oriented approach in programming (188.8.131.52)
Structured Approach Top down design model/modules Medium Programming Project C
Differences Model Usage Example
Object-Oriented Approach Objects Large Programming Project C++
Describe the Translation Method of Programming Using Assembler, Interpreter and Compiler (184.108.40.206) Assembler
An assembler is a computer program that translates assembly language into machine language. For example in Intel 80836, the assembly language for the ’no operation’ command is NOP and its machine code representation is 10010000. Examples of assemblers are MACRO-80 Assembler and Microsoft MASM.
An interpreter is a computer program that translates a high-level language into machine language. Translate programming statement of a program into machine language. Translate programming statement line by line and execute it immediately. No object code saves. Interpreter code run slower Examples of interpreter-based language are BASIC, Logo and Smalltalk. Compiler is a program that translates a high-level language into machine language.
• • •
• • •
Compiler translates entire programming statement and executes it later. Save machine language in an object code on the disk. Compiled code run faster. Several programming languages like C++, Pascal and COBOL used compilers as their translators.
Basic Elements in Programming (5.1.5) Differentiate between constants and variables. (220.127.116.11) Constants Value is not changeable during the course of the program. Use constant when you want to declare something that won’t be changed 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.
Differentiate between the data types: Boolean, integer, double, string and date (18.104.22.168) Data type determines the type of data a variable can store, for example a number or a character. Examples of data types are integer, double, string and Boolean. Data type Integer Contains any whole number value that does not have any fractional part. Size 2 bytes Example To declare an integer as constant in VB: Const Year_Birth =2004 To declare an integer as variable in VB: Dim Age As Integer Age =6 Double Any number values that contain a fractional part separated by decimal point. String Non-numerical and is used to 2 bytes To declare a double as constant in VB: Dim Mark As Double Marks =68.5 To declare string as constant in VB: Const Name = “IMRAN”
1 byte per
store characters and words.
character To declare string as variable in VB: Dim Address As String Address = “Alor Setar”
Boolean Value either false or true. Programmers usually use it to store status.
To declare a boolean as constant in VB: Const Input_Status = true To declare a boolean as variable in VB: Dim Input_Status As Boolean Input_Status = true
Long Integer Single-precision point Double-precision point Currency
4 bytes 4 bytes 8 bytes 8 bytes
Dim Loan As Long Dim Price As Single Dim Pi As Double Dim Debt As Currency
Differentiate between mathematical and logical (Boolean) operators (22.214.171.124) Operator is a symbol or notation that tells a computer to perform certain actions or operations. An example: the plus (+) notation will tell the computer to perform the "add" operation. Operato rs Function Mathematical Operators Mathematical operators perform mathematical operations such as plus or subtracts. Logical Operators Logical operators perform logical operations such as checking the condition of two Boolean values. Used to combine two simple statements into a compound statement. Symbol +(plus) -(minus) *(multiply) /(divide) 2 * 5 = 10 AND OR NOT G AND H >(greater than) <(less than) >=(greater or equal) <=(less or equal) G<H Relational Operators Relational operators perform element-byelement comparisons between two arrays.
Differentiate between sequence control structure and selection control structure (126.96.36.199) Aspects Sequence Control Selection Control
• Use to implement code
line by line. • Does not use the decision symbol. • Execute statement one by one in linear or consecutive order.
• Use to implement decision
making process in the program. • Use the decision symbol. • Execute different statement for different conditions.
Notes: Five basic elements in programming are: • Constant • Variable • Data Type • Operators • Control Structures Constant Constant is a data container that stores information. The value will never change (remains constant) at any time during the course of a program. Declare is the official term used in programming to announce to the program the condition of statement in programming. Variable Variable is a data container that stores information. The value inside may change at any time during the course of a program. Data types Data types String Integer Double Example “This is String” 1, 45, 78 1.25, 3.5
Operator Operator is a symbol that tells what action to perform Operator symbol + (plus) -(minus) /(divided) *(multiplied) >(greater than) <(less than) =(equal to) <>(not equal to)
Control structures Control structures allow the programmer to control the flow of a program.
Program Development (5.2) Program Development Phase (5.2.1) Describe the five main phases in programming development (188.8.131.52)
Problem Analysis • Identify input, process, output and data • Refer to book and website, ask expert and meet with system analyst and users
• Example: client need to set up a School registration program. School administrator (user) 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).
Program Design • • • • Create a solution algorithm for each modules (logic structure) A set of specific procedures, which consists of, step by step instructions to solve the problem must be develop.(pseudo code) Design a flow chart (logical sequence) that represents the needs of the client Design user interface
Coding • Coding is the next step after the program logic has been formulated using the appropriate programming language such as C++ and Visual Basic
Testing and Debugging Phase • • The program done will be tested to ensure that is error free. The usual error is the syntax error, logic error and run-time error. Example: Manually testing using sample data. The program is run through a computer using a translator program. Errors will be identified by the translator.
Documentation Phase • Programmer will complete the documentation for the program. Produce a description of the program, layouts of the input and output record and a program listing. Example: User manual
Resources Books 1. Shelly Cashman, (2010). Discovering Computer 2. CD Courseware KPM Websites 1. http://www.bukisa.com/articles/108793_program-development-phase
This action might not be possible to undo. Are you sure you want to continue?
We've moved you to where you read on your other device.
Get the full title to continue listening from where you left off, or restart the preview.