11 ----- ### Table of contentsTable of contents  Data representation in a computerData representation in a computer  Data processingData processing  Elementary programming principlesElementary programming principles  System developmentSystem development ----- 33 ----- ### IntroductionIntroduction  In digital computers, In digital computers, the user inputs is the user inputs is converted and converted and transmitted as transmitted as electrical pulses that electrical pulses that can be represented can be represented by two digits by two digits 1 and 1 and 0 before processing. 0 before processing. These two digits are These two digits are referred to as referred to as **BinaryBinary** digits.digits. ----- #### Sending data via a telephone lineSending data via a telephone line  When a digital signal is to be When a digital signal is to be sent over analog telephone sent over analog telephone lines e.g. elines e.g. e--mail, it has to be mail, it has to be converted to analog signal. converted to analog signal. This is done by connecting a This is done by connecting a device called a modem to the device called a modem to the digital computer. This digital computer. This process of converting a process of converting a digital signal to an analog digital signal to an analog signal is known as signal is known as modulation. On the receiving modulation. On the receiving end, the incoming analog end, the incoming analog signal is converted back to signal is converted back to digital form in a process digital form in a process known as demodulation.known as demodulation. ----- Concepts of data representation in digital computersConcepts of data representation in digital computers  Data and instructions cannot be entered Data and instructions cannot be entered and processed directly into computers and processed directly into computers using human language. Any type of data using human language. Any type of data entered must first be converted into entered must first be converted into **machinemachine--readable form. (Binary form)readable form. (Binary form)** . . Computer together with its peripheral Computer together with its peripheral devices handle data in its electronic devices handle data in its electronic circuits, magnetic media and in optical circuits, magnetic media and in optical devices.devices. ----- ##### Data representation in electronic circuitsData representation in electronic circuits  Electronic Electronic components such as components such as microprocessor are microprocessor are made up of millions of made up of millions of electronic circuits. electronic circuits. Availability of a high Availability of a high voltage (ON) in these voltage (ON) in these circuits is interpreted circuits is interpreted as 1 while a low as 1 while a low voltage (OFF) is voltage (OFF) is interpreted as 0.interpreted as 0. ----- #### Data representation on magnetic mediaData representation on magnetic media  The presence of a The presence of a magnetic field in one magnetic field in one direction on magnetic direction on magnetic media is interpreted media is interpreted as 1 while the as 1 while the absence of magnetic absence of magnetic field is interpreted as field is interpreted as 0.0. ----- #### Data representation on optical mediaData representation on optical media In optical devices, the presence of light is interpreted as 1 In optical devices, the presence of light is interpreted as 1 while its absence is interpreted as 0.while its absence is interpreted as 0.  **BITSBITS**  this is a binary digit, which can either be 0 or this is a binary digit, which can either be 0 or 1. its the basic unit of data or information in digital 1. its the basic unit of data or information in digital computers.computers.  **BYTEBYTE**  a group of 8 bits. It is the basic unit of a group of 8 bits. It is the basic unit of measuring memory size in computers.measuring memory size in computers.  **NIBBLE NIBBLE**  it is a half a byte or a group of 4 bits.it is a half a byte or a group of 4 bits.  **WORDWORD**  its consists of one or more bytes and is the its consists of one or more bytes and is the largest amount of memory that the computer can largest amount of memory that the computer can handle.handle.  **WORD LENGTHWORD LENGTH**  is the number of bits in each is the number of bits in each word of computer.word of computer. ----- ### Reading data on a CDReading data on a CD--ROMROM ----- ### Types of data representationTypes of data representation  Number SystemNumber System  Base conversionBase conversion  Negative NumbersNegative Numbers  Binary AdditionBinary Addition ----- ### Types of number systemsTypes of number systems  Decimal Number SystemDecimal Number System  Binary Number SystemBinary Number System  Octal NotionOctal Notion  Hexadecimal Number SystemHexadecimal Number System ----- ### Decimal Number SystemDecimal Number System  This number system has ten digits ranging from This number system has ten digits ranging from 00--9. A decimal number should be written with a 9. A decimal number should be written with a subscript 10. e.g. 132subscript 10. e.g. 132 . Each digit of a given . Each digit of a given 1010 number in the base has a place value, which is number in the base has a place value, which is influenced by base ten. E.g. number 1234influenced by base ten. E.g. number 1234 1010 ----- ### Binary Number SystemBinary Number System  This number system uses two digits 1 and 0 to This number system uses two digits 1 and 0 to represent numbers. The place value of the digits represent numbers. The place value of the digits of a base two number is influenced by two (the of a base two number is influenced by two (the base/radix). e.g. the place values of the 1010base/radix). e.g. the place values of the 1010 22 are illustrated beloware illustrated below ----- ### Octal NotationOctal Notation  The octal number system consists of eight digits The octal number system consists of eight digits running from 0running from 0--7. each digit of a number in base 7. each digit of a number in base eight has its place value determined by eight. eight has its place value determined by eight. E.g. 2163E.g. 2163 can be expressed as.can be expressed as. 88 ----- ### Hexadecimal Number SystemHexadecimal Number System  This number system consists of sixteen digits ranging This number system consists of sixteen digits ranging from 0from 0--9 and letters A9 and letters A--F where A is equivalent to 10, B F where A is equivalent to 10, B to 11 up to F which is equivalent to 15, in base ten to 11 up to F which is equivalent to 15, in base ten systems. Each digit of a number in base sixteen has systems. Each digit of a number in base sixteen has its place value expressed in terms of sixteen. For its place value expressed in terms of sixteen. For example, the value 12A3 can be expressed as;example, the value 12A3 can be expressed as; ----- ### Base conversionBase conversion  Decimal to BinaryDecimal to Binary  Binary to Decimal NumberBinary to Decimal Number  Decimal to OctalDecimal to Octal  From Octal to DecimalFrom Octal to Decimal  Converting Octal to BinaryConverting Octal to Binary  From Decimal to HexadecimalFrom Decimal to Hexadecimal  Hexadecimal to DecimalHexadecimal to Decimal  Hexadecimal to BinaryHexadecimal to Binary ----- ### Decimal to Binary 1Decimal to Binary 1  To convert a number from base 10 to base 2, the To convert a number from base 10 to base 2, the number in base 10 is repeatedly divided by 2 unit the number in base 10 is repeatedly divided by 2 unit the divided is zero on each division the remainder is noted. The remainders are copied bottom up wise to give the The remainders are copied bottom up wise to give the binary equivalent of the decimal number.binary equivalent of the decimal number. ----- ### Decimal to Binary 2Decimal to Binary 2  For fractional numbers For fractional numbers the number is divided into the number is divided into two parts. The whole two parts. The whole number part and the number part and the fraction part. The whole fraction part. The whole number is repeatedly number is repeatedly divided by 2 while the divided by 2 while the fraction is repetitively fraction is repetitively multiplied by 2 until the multiplied by 2 until the fraction becomes zero or fraction becomes zero or starts recurring. starts recurring. (Repeating it self)(Repeating it self) ----- ### Binary to Decimal Number 1Binary to Decimal Number 1  StepsSteps 1.1. First write the place First write the place values starting from values starting from the right hand side.the right hand side. 2.2. Write each digit Write each digit under its place value.under its place value. 3.3. Multiply each digit by Multiply each digit by its corresponding its corresponding place value.place value. 4.4. Sum up the products.Sum up the products. -----  For fraction number, For fraction number, the whole number is the whole number is converted to decimal converted to decimal as above. The as above. The fraction part digits are fraction part digits are divided by multiples of divided by multiples of two starting from the two starting from the decimal point.decimal point. ----- ### Decimal to octal 1Decimal to octal 1  To convert a number To convert a number from base 10 to base from base 10 to base 8, the number in base 8, the number in base 10 is repeatedly 10 is repeatedly divided by 8, until the divided by 8, until the dividend is zero each dividend is zero each division the remainder division the remainder is noted.is noted. ----- ### Decimal to octal 2Decimal to octal 2  To convert fractional To convert fractional decimal to octal the decimal to octal the procedure is same as procedure is same as for fractional decimal for fractional decimal to binary, but the to binary, but the multiplication is by 8 multiplication is by 8 instead of 2.instead of 2. ----- ### Form Octal to DecimalForm Octal to Decimal  The procedure is same The procedure is same as from binary to decimal, as from binary to decimal, but the weights as but the weights as assigned in terms of 8s.assigned in terms of 8s.  The fractional number are The fractional number are converted to decimal converted to decimal using the same using the same procedure as that of procedure as that of converting fractional converting fractional binary to decimal, but binary to decimal, but divisions is by multiplies divisions is by multiplies of eight.of eight. ----- ### Converting Octal to BinaryConverting Octal to Binary  Each digit is Each digit is represented by 3 represented by 3 binary digits. E.g. 7 is binary digits. E.g. 7 is represented as 111represented as 111 22 ----- ### From Decimal to Hexadecimal 1From Decimal to Hexadecimal 1  The procedure is The procedure is same as from decimal same as from decimal to binary though to binary though divisions are by 16divisions are by 16 ----- ### From Decimal to Hexadecimal 2From Decimal to Hexadecimal 2 ----- ### Hexadecimal to DecimalHexadecimal to Decimal  The same procedure The same procedure as from Binary to as from Binary to Decimal is used with Decimal is used with the weights assigned in the weights assigned in terms of 16s.terms of 16s.  For fractional For fractional hexadecimal values. hexadecimal values. The division is by 16 The division is by 16 and the procedure is and the procedure is the same as the binary the same as the binary fraction to decimal.fraction to decimal. ----- ### Hexadecimal to BinaryHexadecimal to Binary ----- #### Examples of hexadecimal to binaryExamples of hexadecimal to binary ----- ### Negative numbersNegative numbers  Both positive and negative numbers can Both positive and negative numbers can be represented in the computer memory be represented in the computer memory during processing. various methods are during processing. various methods are used to represent negative numbers in used to represent negative numbers in the computer. These methods arethe computer. These methods are:: i.i. Ones complimentOnes compliment ii.ii. Twos complimentTwos compliment The negative numbers are used to carry The negative numbers are used to carry out subtraction in the computer out subtraction in the computer arithmetic operations.arithmetic operations. ----- ### Ones complement (1c method)Ones complement (1c method) ----- ### Twos complement (2c method)Twos complement (2c method) ----- ### Signed magnitudeSigned magnitude  In decimal numbers, signed number has a prefix In decimal numbers, signed number has a prefix + for a positive number e.g. +32+ for a positive number e.g. +32 and and -- for a  for a 1010 negative number e.g. negative number e.g. --3232 . in binary, a negative . in binary, a negative 1010 number may be represented by prefixing a digit number may be represented by prefixing a digit 1 to the number while a positive number may be 1 to the number while a positive number may be represented by prefixing a digit 0.represented by prefixing a digit 0. i.e. 17i.e. 17  1000110001 (unsigned)(unsigned) 1010 2 2 --1717  To indicate its a negative number we To indicate its a negative number we 1010 add an extra bit (1) 10001add an extra bit (1) 10001 22 +17+17  To indicate its positive we add an extra To indicate its positive we add an extra 1010 bit (0) 10001bit (0) 10001 22 ----- ### Advantages of twos complimentAdvantages of twos compliment  There are no two ways of representing a There are no two ways of representing a zero as in ones compliment and signed zero as in ones compliment and signed magnitude.magnitude.  Effective addition and subtraction can be Effective addition and subtraction can be done even with numbers that are done even with numbers that are represented with a sign bit.represented with a sign bit. ----- ### Binary arithmeticsBinary arithmetics  Binary additionBinary addition  Binary subtractionBinary subtraction  Binary multiplicationBinary multiplication -----  Binary addition rulesBinary addition rules A+BA+B sumsum++ carrycarry 0+00+0 00 00 0+10+1 11 00 1+01+0 1 1 00 1+11+1 00 11 1+1+1 11+1+1 1 11 -----  Binary subtraction Binary subtraction rulerule AA--BB differencedifference borrowborrow 00--00 00 00 00--11 11 11 11--00 11 11 11--11 00 00 ----- #### Subtraction using ones complementsSubtraction using ones complements ----- #### Subtraction using twos complimentSubtraction using twos compliment ----- ### Binary multiplicationBinary multiplication Multiplication ruleMultiplication rule ProductProduct A A * B* B 00 0 * 00 * 0 00 0 * 10 * 1 00 1 * 11 * 1 11 ----- #### Examples of binary multiplicationExamples of binary multiplication ----- Symbolic representation using coding systemSymbolic representation using coding system  Binary Coded Decimal (BCD)Binary Coded Decimal (BCD)  Extended BCD code / standard BCD codeExtended BCD code / standard BCD code  Extended Binary Coded Decimal Extended Binary Coded Decimal Interchange Code (EBCDIC)Interchange Code (EBCDIC)  American Standard Code for Information American Standard Code for Information Interchange (ASCII)Interchange (ASCII) ----- ### Binary Coded Decimal (BCD)Binary Coded Decimal (BCD)  BCD is a 4 bit code used to represent BCD is a 4 bit code used to represent numeric data only. For example, a number numeric data only. For example, a number like 3 can be represented using binary like 3 can be represented using binary coded decimal as 0011coded decimal as 0011 . BCD is mostly . BCD is mostly 22 used in simple electronics devices like used in simple electronics devices like calculators etc.calculators etc. ----- Extended BCD code / standard BCD codeExtended BCD code / standard BCD code  This standard binary coded decimal is an This standard binary coded decimal is an enhanced format of binary coded decimal enhanced format of binary coded decimal (BDC) its a 7(BDC) its a 7--bit representation scheme bit representation scheme which can represent non numeric which can represent non numeric characters. This allows 64 characters to characters. This allows 64 characters to be represented. For example letter A is be represented. For example letter A is represented as 110001represented as 110001 using standard using standard 22 BCD code.BCD code. ----- Extended Binary Coded Decimal Interchange Code (EBCDIC)Extended Binary Coded Decimal Interchange Code (EBCDIC)  EBCDIC is an 8EBCDIC is an 8--bit character coding bit character coding scheme used primarily in IBM computers. scheme used primarily in IBM computers. A total of 256 (2A total of 256 (2 [88] ) characters can be ) characters can be coded using this scheme. For example coded using this scheme. For example letter A is represented as 11000001letter A is represented as 11000001 in in 22 EBCDIC code.EBCDIC code. ----- American Standard Code for Information Interchange (ASCII)American Standard Code for Information Interchange (ASCII)  ASCII is a 7ASCII is a 7--bit code, which means that bit code, which means that only 128 characters can be represented. only 128 characters can be represented. There is an 8There is an 8 [thth] bit to this coding scheme bit to this coding scheme which can provide for 256 characters. The which can provide for 256 characters. The 88 [thth] bit coding scheme is referred to as an bit coding scheme is referred to as an 99--bit ASCII for example letter A is bit ASCII for example letter A is represented asrepresented as 10000011000001 in ASCII codein ASCII code 22 ----- ### Review questions 1Review questions 1 1.1. Differentiate between analog and digital data.Differentiate between analog and digital data. 2.2. Define the following terms:Define the following terms: a.a. AmplitudeAmplitude b.b. FrequencyFrequency c.c. Periodic timePeriodic time 3.3. Explain the role of a modem in communication.Explain the role of a modem in communication. 4.4. State the reasons for use of binary in digital technology.State the reasons for use of binary in digital technology. 5.5. Using illustration, explain how data is represented:Using illustration, explain how data is represented: a.a. In electronic circuitsIn electronic circuits b.b. On magnetic mediaOn magnetic media c.c. On CDOn CD--ROMROM 6.6. Distinguish between:Distinguish between: a.a. A byte and a nibbleA byte and a nibble b.b. Word and word lengthWord and word length ----- ### Answer of review questions 1Answer of review questions 1--11 1.1. Analog data is a type of data that is continuous in nature Analog data is a type of data that is continuous in nature while digital data is in discrete form.while digital data is in discrete form. 2.2. a). Amplitude is the maximum.a). Amplitude is the maximum. b). Frequency is the number of cycles per second.b). Frequency is the number of cycles per second. c). Periodic time is the time taken by a signal to complete c). Periodic time is the time taken by a signal to complete a cycle.a cycle. 3.3. A modem converts (modulates) data to be transmitted A modem converts (modulates) data to be transmitted over the telephone line from digital signal to analog form. over the telephone line from digital signal to analog form. At the receiving end, the modem attached to the At the receiving end, the modem attached to the receiving computer converts (demodulates) the analog receiving computer converts (demodulates) the analog signal to original digital form.signal to original digital form. 4.4. Devices designed using binary logic are simple, more Devices designed using binary logic are simple, more reliable and consume less energy.reliable and consume less energy. ----- ### Answer of review questions 1Answer of review questions 1--22 5.5. a). In electronic circuits a). In electronic circuits  availability of high voltage on is availability of high voltage on is interpreted as a 1 while low voltage off is interpreted as a interpreted as a 1 while low voltage off is interpreted as a 0.0. b). On magnetic media, arrangement of magnetic dipoles of b). On magnetic media, arrangement of magnetic dipoles of iron oxide in one direction is interpreted as 1s while those iron oxide in one direction is interpreted as 1s while those that face in the opposite direction are interpreted as 0s.that face in the opposite direction are interpreted as 0s. c). On the shiny surface of the CD are pits and lands. When a c). On the shiny surface of the CD are pits and lands. When a laser beam falls on the shinny surface, it is reflected and laser beam falls on the shinny surface, it is reflected and interpreted as a 1. On the other hand, when the laser beam interpreted as a 1. On the other hand, when the laser beam takes on the pit or bump, there is no reflection and this is takes on the pit or bump, there is no reflection and this is interpreted as a 0 bit.interpreted as a 0 bit. 6.6. a). A byte is made up of seven or eight bits while a nibble is a). A byte is made up of seven or eight bits while a nibble is made up of four bits i.e. it is half of a byte.made up of four bits i.e. it is half of a byte. b). A word consists of two or more bytes while a word length b). A word consists of two or more bytes while a word length is used as a measure of the number of bits in each word.is used as a measure of the number of bits in each word. ----- ### Review questions 2Review questions 2  Convert the following base two numbers Convert the following base two numbers into denary (base 10) numbers.into denary (base 10) numbers. a.a. 01010101 22 b.b. 11111111 22 c.c. 1010110111010101101110 22 d.d. 1011111110111111 22 e.e. 10110111011011 22 f.f. 111000111111000111 22 ----- ### Answer of review questions 2Answer of review questions 2 a.a. 55 1010 b.b. 1515 1010 c.c. 13901390 1010 d.d. 191191 1010 e.e. 8989 1010 f.f. 455455 1010 ----- ### Review questions 3Review questions 3  Using the place value and log division Using the place value and log division methods convert each of the following methods convert each of the following base 10 numbers to their binary base 10 numbers to their binary equivalents.equivalents. a.a. 1010 1010 b.b. 4343 1010 c.c. 365365 1010 d.d. 512512 1010 e.e. 143143 f.f. 954954 1010 ----- ### Answer of review questions 3Answer of review questions 3 a.a. 10101010 22 b.b. 101011101011 22 c.c. 101101101101101101 22 d.d. 10000000001000000000 22 e.e. 1000111110001111 22 f.f. 11101110101110111010 22 ----- ### Review questions 4Review questions 4 1.1. Convert the Convert the following binary following binary numbers to their numbers to their decimal equivalents.decimal equivalents. a.a. 0.100110.10011 22 b.b. 0.00100.0010 22 c.c. 0.101010.10101 22 d.d. 11.011011.0110 22 e.e. 101.11110101.11110 22 f.f. 100.110100.110 22 2.2. Convert the Convert the following decimal following decimal numbers into their numbers into their binary equivalents.binary equivalents. a.a. 0.6350.635 1010 b.b. 0.4500.450 1010 c.c. 2.5002.500 1010 d.d. 5.16255.1625 1010 e.e. 7.18757.1875 1010 f.f. 0.3500.350 1010 ----- ### Answer of review questions 4Answer of review questions 4 1.1. Convert the binary Convert the binary numbers to their numbers to their decimal equivalents.decimal equivalents. a.a. 0.593750.59375 1010 b.b. 0.1250.125 1010 c.c. 0.656250.65625 1010 d.d. 3.3753.375 1010 e.e. 5.93755.9375 1010 f.f. 4.754.75 1010 2.2. Convert the decimal Convert the decimal numbers into their numbers into their binary equivalents.binary equivalents. a.a. 0.1010.101 22 b.b. 0.011100.01110 22 c.c. 10.100010.1000 22 d.d. 101.001010011101.001010011 e.e. 111.0011111.0011 22 f.f. 110101.0101110110101.0101110 22 ----- ### Review questions 5Review questions 5  Convert the following octal numbers to decimal Convert the following octal numbers to decimal numbers.numbers. a.a. 7777 88 b.b. 6464 88 c.c. 102102 88 d.d. 12001200 88 e.e. 10001000 88 f.f. 173173 88 g.g. 123123 88 h.h. 777777 88 i.i. 345345 88 j.j. k.k. 166166 34583458 88 ----- ### Answer of review questions 5Answer of review questions 5 a.a. 6363 1010 b.b. 5252 1010 c.c. 6666 1010 d.d. 640640 1010 e.e. 512512 1010 f.f. 123123 1010 g.g. 8383 1010 h.h. 511511 1010 i.i. 229229 1010 j.j. 118118 1010 ----- ### Review questions 6Review questions 6  Convert the following octal numbers to their Convert the following octal numbers to their binary equivalents.binary equivalents. a.a. 244244 88 b.b. 247247 88 c.c. 162162 88 d.d. 565565 88 e.e. 222222 88 f.f. 33703370 88 g.g. 14131413 88 h.h. 13311331 88 i.i. 63476347 88 j.j. 4665346653 88 ----- ### Answer of review questions 6Answer of review questions 6 a.a. 1010010010100100 22 b.b. 1010011110100111 22 c.c. 11100101110010 22 d.d. 101110101101110101 22 e.e. 1001001010010010 22 f.f. 1101111100011011111000 22 g.g. 1100001101111000011011 22 h.h. 10110110011011011001 22 i.i. 110011100111110011100111 22 j.j. 100110110101011100110110101011 22 ----- ### Review questions 7Review questions 7  Convert the following hexadecimal numbers Convert the following hexadecimal numbers into decimal numbers.into decimal numbers. a.a. 3232 1616 b.b. CCDCCD 1616 c.c. EFEEFE 1616 d.d. 119119 1616 e.e. 328328 1616 f.f. ABDABD 1616 g.g. 10AFFD10AFFD 1616 h.h. DDFF34DDFF34 1616 i.i. 11ABDF11ABDF 1616 j.j. CDFF31CDFF31 1616 ----- ### Answer of review questions 7Answer of review questions 7 a.a. 5050 1010 b.b. 32773277 1010 c.c. 38383838 1010 d.d. 281281 1010 e.e. 808808 1010 f.f. 954954 1010 g.g. 10936291093629 1010 h.h. 1454878814548788 1010 i.i. 11581111158111 1010 j.j. 1350020913500209 1010 ----- ### Review questions 8Review questions 8  Convert the following hexadecimal numbers into binary Convert the following hexadecimal numbers into binary formform a.a. 2941629416 b.b. 2471624716 c.c. EFD16EFD16 d.d. 9071690716 e.e. BAD16BAD16 f.f. CBDF16CBDF16 g.g. 585C16585C16 h.h. ABCD16ABCD16 i.i. 55C3A1655C3A16 j.j. 33111CF1633111CF16 k.k. Convert 1111000110111 to its hexadecimal equivalent.Convert 1111000110111 to its hexadecimal equivalent. ----- ### Answer of review questions 8Answer of review questions 8 a.a. 10100101001010010100 22 b.b. 10010001111001000111 22 c.c. 11101111111011110111111101 22 d.d. 100100000111100100000111 22 e.e. 101110101101101110101101 22 f.f. 11001011110111111100101111011111 22 g.g. 101100001011100101100001011100 22 h.h. 10101011110011011010101111001101 22 i.i. 10101011100001111010101110000111 010010 22 j.j. 11001100010001001100110001000100 01110011110111001111 22 k.k. IE37IE37 1616 ----- ### Review questions 9Review questions 9 ----- ### Answer of review questions 9Answer of review questions 9 1.1. 1000110001 22 2.2. 1011010110 22 3.3. 1100111001 22 4.4. 110011110011 22 5.5. 10110011011001 22 6.6. 1010110101 22 7.7. 10001111000111 22 8.8. 111111111111 22 9.9. 10000001000000 22 10.10. 1100101111001011 22 11.11. 10010111001011 22 12.12. 11110011111001 22 ----- ### Review questions 10Review questions 10 ----- ### Answer of review questions 10Answer of review questions 10 1.1. 11111111 22 2.2. 001001 22 3.3. 1010010100 22 4.4. 10011001 22 5.5. 110101110101 22 1.1. 1111111111 22 2.2. 1010 22 3.3. 10100101010010 22 4.4. 1100011011000110 22 5.5. 1000110001 22 ----- ### Review questions 11Review questions 11 1.1. Convert the decimal number Convert the decimal number --7 to 87 to 8--bit binary using bit binary using ones and twos complement.ones and twos complement. 2.2. Using 8Using 8--bits length, find the twos complement of the bits length, find the twos complement of the following decimal numbers.following decimal numbers. A)A) --3131 1010 B)B) --2828 1010 C)C) --55 1010 3.3. Using ones and twos complement perform the following Using ones and twos complement perform the following arithmetic operations.arithmetic operations. A)A) 1414 1010  77 1010 B)B) 2828 1010  1212 1010 C)C) 3434 1010  3333 1010 D)D) 100100 1010  5050 1010 E)E) 102102 1010  6464 1010 ----- ### Answer the review questions 11Answer the review questions 11 1.1. 1111100111111001 22 2.2. A). 11100001A). 11100001 22 B). 11100100B). 11100100 22 C). 11111011C). 11111011 22 3.3. A). 111A). 111 22 B). 10000B). 10000 22 C). 1C). 1 22 D). 110010D). 110010 22 E). 0100112E). 0100112 22 ----- ### Revision questions 1Revision questions 1 1.1. Explain the two types of Explain the two types of data signals.data signals. 2.2. Differentiate betweenDifferentiate between 4.4. Convert the following Convert the following A)A) Octal and decimal Octal and decimal number systems.number systems. B)B) Binary and hexadecimal Binary and hexadecimal number systems.number systems. 3.3. Convert the following binary Convert the following binary numbers to their decimal numbers to their decimal equivalents.equivalents. 1.1. 101110101110 22 2.2. 101011101011 22 3.3. 01100110 22 4.4. 1010110101 22 decimal numbers to their decimal numbers to their decimal binary decimal binary equivalents.equivalents. A)A) 789789 1010 B)B) 570570 1010 C)C) 4242 1010 D)D) 3030 1010 5.5. Find the sum of the Find the sum of the following binary numbers.following binary numbers. A)A) 11101110 22 + 1111+ 1111 22 == B)B) 001001 22 + 100+ 100 22 == C)C) 11011101 22 + 1011+ 1011 22 + 100+ 100 22 == D)D) 10101010 22 + 101+ 101 22 == E)E) 111111 22 + 11+ 11 22 == ----- ### Answer of revision questions 1Answer of revision questions 1 1.1. Analog and digitalAnalog and digital 2.2. A). Octal number system is a base 8 system while the A). Octal number system is a base 8 system while the decimal number system is a base 10 system.decimal number system is a base 10 system. B). Binary number system is a base 2 system while B). Binary number system is a base 2 system while hexadecimal number system is a base 16 system.hexadecimal number system is a base 16 system. 3.3. A). 46A). 46 1010 B). 43B). 43 1010 C). 6C). 6 1010 D). 22D). 22 1010 4.4. A). 1100010101A). 1100010101 22 B). 1000111010B). 1000111010 22 C). 101010C). 101010 22 D). 11110D). 11110 22 ----- ### Revision questions 2Revision questions 2 1.1. Work out the following binary Work out the following binary subtraction using direct, ones subtraction using direct, ones and twos complement and twos complement methods.methods. A)A) 11001 11001  11011101 B)B) 1000 1000  101101 C)C) 100011 100011  111111 D)D) 10101110 10101110  10001101000110 E)E) 10001000110 10001000110  101101 2.2. Find the ones and twos Find the ones and twos complement of the following complement of the following decimal number in binary form.decimal number in binary form. A)A) --7575 1010 B)B) --8080 1010 C)C) --100100 1010 3.3. Determine the value of X in the Determine the value of X in the equations:equations: A)A) 0.100100.10010 22 B)B) 101.11101.11 22 C)C) 11.10111.101 22 D)D) 0.0010.001 22 5.5. Work out the decimal equivalents Work out the decimal equivalents of the following binary numbers.of the following binary numbers. A)A) 0.350.35 1010 B)B) 2.502.50 1010 C)C) 0.200.20 1010 D)D) 7.1257.125 1010 A)A) 100110100110 22  XX 22 = 001010= 001010 22 B)B) XX 22 + 1101+ 1101 22 = 70= 70 1010 4.4. Work out the decimal equivalents Work out the decimal equivalents of the following binary numbersof the following binary numbers.. ----- ### Answer of revision questions 2Answer of revision questions 2 1.1. A). 10101A). 10101 22 B). 101B). 101 22 C). 11100C). 11100 22 D). 1111D). 1111 22 E). 1010E). 1010 22 2.2. A). 1100A). 1100 22 B). 011B). 011 22 C). 11100C). 11100 22 D). 1101000D). 1101000 22 E). 10001000001E). 10001000001 22 3.3. A). 11100A). 11100 22 B). 111001B). 111001 22 1.1. A). 0.562510A). 0.562510 B). 5.7510B). 5.7510 C). 3.62510C). 3.62510 D). 0.12510D). 0.12510 2.2. A). 0.0101102A). 0.0101102 B). 10.12B). 10.12 C). 0.00112C). 0.00112 D). 111.0012D). 111.0012 ----- ### Revision questions 3Revision questions 3 1.1. Write down the character represented by the following Write down the character represented by the following codes:codes: A)A) ASCIIASCII i.i. 01100000110000 ii.ii. 01101110110111 iii.iii. 10000111000011 iv.iv. 10110011011001 B)B) EBCDICEBCDIC 1.1. 1111000011110000 2.2. 1111011111110111 3.3. 1100000111000001 4.4. 0101110101011101 ----- ### Answer of revision questions 3Answer of revision questions 3 |Col1|ASCII|Char acter|EBCDIC|Char acter| |---|---|---|---|---| |A).|0110000|0|11110000|0| |B).|0110111|7|11110111|7| |C).|1000011|C|11000001|A| |D).|1011001|Y|01011101|)| |Col1|Num ber|1s complement|2s https://Teacher.co.ke/ complement Visit rs| |---|---|---|---| |A)|-75|0110100|Pape 0110101 Past and Exams, Notes,| |B)|-80|0101111|KCSE 0110000 free For| |C)|-100|0011011|0011100| ----- 7777 ----- ### Definition of TermsDefinition of Terms  Data Data  this is a collection of raw facts (figures, letters, this is a collection of raw facts (figures, letters, characters etc) that convey little meaning by characters etc) that convey little meaning by themselves.themselves.  Information Information  this refers to data that has undergone this refers to data that has undergone processing and is meaningful to the user when he/she processing and is meaningful to the user when he/she need it, in the form he needs and at the time he/she need it, in the form he needs and at the time he/she need it.need it.  Data processing Data processing  refers to the process of refers to the process of transforming raw facts into meaningful output transforming raw facts into meaningful output (information)(information)  Data processing cycle Data processing cycle  refers to input process output refers to input process output stages that data goes through to be transformed into stages that data goes through to be transformed into information.information. ----- ### Data processing cycleData processing cycle Data collectionData collection ----- ### Stages of data processing cycleStages of data processing cycle 1.1. Data collection Data collection  this involves looking for or getting this involves looking for or getting the data from its point of origin for processing the data from its point of origin for processing purpose.purpose. 2.2. Data input Data input  this is the process where the collected this is the process where the collected data is converted from human readable form to data is converted from human readable form to machine machine  readable form.readable form. 3.3. Processing Processing  this is transformation of input data by this is transformation of input data by the central processing unit to a more meaningful the central processing unit to a more meaningful output.output. 4.4. Output Output  this is the final activity of data processing this is the final activity of data processing cycle which produces the desired output cycle which produces the desired output (information). The information is then distributed to (information). The information is then distributed to the target groups.the target groups. ----- ### Methods of data collectionMethods of data collection  InterviewInterview  QuestionnaireQuestionnaire  ObservationObservation  Record inspectionRecord inspection ----- ### Stages of data collectionStages of data collection  Depending on the method of data Depending on the method of data collection used, the process of data collection used, the process of data collection may involve the following stages.collection may involve the following stages.  Data creationData creation  Data transmissionData transmission  Data preparationData preparation  Media conversionMedia conversion  Input validationInput validation  SortingSorting ----- ### Data creationData creation  This is the process of putting together This is the process of putting together facts in an organised format. This may be facts in an organised format. This may be in form of manually prepared documents in form of manually prepared documents or captured from the source using data or captured from the source using data capture devices. E.g. scanners, digital capture devices. E.g. scanners, digital camera etc.camera etc. ----- ### Data transmissionData transmission  This refers to the transfer of data from the This refers to the transfer of data from the point of collection (source) of the point point of collection (source) of the point where processing is to be done. where processing is to be done. Transmission can be electronically through Transmission can be electronically through computer computer  to to  computer, physically by computer, physically by the post office etc.the post office etc. ----- ### Data preparationData preparation  This refers to conversion of data from This refers to conversion of data from source document to machine source document to machine  readable readable form. Data collected using devices that form. Data collected using devices that capture data in digital form do not require capture data in digital form do not require transcription conversion.transcription conversion. ----- ### Media conversionMedia conversion  Data may need to be converted from one Data may need to be converted from one medium to another. E.g. from a compact medium to another. E.g. from a compact disk to hard disk for faster input.disk to hard disk for faster input. ----- ### Input validationInput validation  Data entered into the computer is Data entered into the computer is subjected to validity and verification subjected to validity and verification checks before processing.checks before processing.  Verification Verification  this involves checking that what this involves checking that what is on input document is exactly the same as is on input document is exactly the same as what is entered into the computer.what is entered into the computer.  Validation Validation  this is identification and removal this is identification and removal of errors by the computer through the control of errors by the computer through the control of the program.of the program. ----- ### Sorting Sorting  The source documents are arranged in a The source documents are arranged in a particular order for easy and faster entry.particular order for easy and faster entry. ----- #### Description of errors in data processingDescription of errors in data processing  The accuracy of the data entered in the The accuracy of the data entered in the computer determines the accuracy of the computer determines the accuracy of the information given out.information given out. ----- ### Types of data processing errorsTypes of data processing errors  Transcription errors Transcription errors  these errors occurs during these errors occurs during data entry. These errors includes misreading data entry. These errors includes misreading errors and transposition errors.errors and transposition errors.  Computational errors Computational errors  they occur when an they occur when an arithmetic operation does not produce the arithmetic operation does not produce the expected results. They include overflow errors, expected results. They include overflow errors, truncation errors and rounding errors.truncation errors and rounding errors.  Algorithm or logical errors Algorithm or logical errors  these errors occurs these errors occurs as a result of wrong algorithm design.as a result of wrong algorithm design. ----- ### Misreading errorsMisreading errors  They are brought about by incorrect They are brought about by incorrect reading of source document by the user reading of source document by the user and hence entering wrong values. This and hence entering wrong values. This may be caused by bad hand writing or may be caused by bad hand writing or confusion on source document. E.g. the confusion on source document. E.g. the number 5 can be typed as s or letter 0 number 5 can be typed as s or letter 0 typed as Zero.typed as Zero. ----- ### Transposition errorsTransposition errors  These errors occurs as a result of These errors occurs as a result of incorrect arrangement of characters. i.e. incorrect arrangement of characters. i.e. putting characters in the wrong order. E.g. putting characters in the wrong order. E.g. the user may enter 542 instead of 542. the user may enter 542 instead of 542. transcription errors can be eliminated by transcription errors can be eliminated by use of data capture devices.use of data capture devices. ----- ### Overflow errorsOverflow errors  This errors occurs if the result from a This errors occurs if the result from a calculation is too large to be stored in the calculation is too large to be stored in the allocated memory space. E.g. if the allocated memory space. E.g. if the memory space can accommodate an 8memory space can accommodate an 8--bit bit number and the results from arithmetic is number and the results from arithmetic is 99--bit number.bit number. ----- ### Truncation errorsTruncation errors  This result from having real numbers that This result from having real numbers that have a long fractional part which cannot fit have a long fractional part which cannot fit in the allocated memory space. The in the allocated memory space. The computer cut off the extra characters from computer cut off the extra characters from the fraction part. E.g. a number like the fraction part. E.g. a number like 0.854692 can be truncated to four digits as 0.854692 can be truncated to four digits as 0.854.0.854. ----- ### Rounding errorsRounding errors  This results from a raising or lowering a This results from a raising or lowering a digit in a real number to the required digit in a real number to the required rounded number. E.g. a number 3.59 can rounded number. E.g. a number 3.59 can be rounded to 3.6.be rounded to 3.6. ----- ### Data integrityData integrity  Data integrity refers to the accuracy and Data integrity refers to the accuracy and completeness of data entered in a completeness of data entered in a computer or received from the information computer or received from the information system.system. ----- #### Factors that determine data integrityFactors that determine data integrity  AccuracyAccuracy  TimelinessTimeliness  RelevanceRelevance  AudibilityAudibility ----- ### Accuracy Accuracy  This refers to whether information/data is This refers to whether information/data is accurate accurate  true or untrue. As long as the true or untrue. As long as the correct instructions and data are entered, correct instructions and data are entered, computers produce accurate results computers produce accurate results efficiently.efficiently. ----- ### TimelinessTimeliness  This refers to whether the information is This refers to whether the information is available when it is needed, and if its available when it is needed, and if its outdated when it is received or when it is outdated when it is received or when it is used. If information is not available when used. If information is not available when needed or its outdated by the time its used needed or its outdated by the time its used then has little or no value in decision then has little or no value in decision making.making. ----- ### Relevance Relevance  The data entered must be pertinent to the The data entered must be pertinent to the proce3ssing needs at hand and must meet proce3ssing needs at hand and must meet the requirements of the processing cycle.the requirements of the processing cycle. ----- ### Audibility Audibility  Audit ability also refers to as verifiability. Audit ability also refers to as verifiability. This is the ability of users to check the This is the ability of users to check the accuracy and completeness of information.accuracy and completeness of information. ----- ### Threats to data integrityThreats to data integrity  Threats to data integrity can be minimised Threats to data integrity can be minimised through the following;through the following;  Using error detection and correction software when Using error detection and correction software when transmitting data.transmitting data.  Design user interfaces that minimizes chances of Design user interfaces that minimizes chances of invalid data entry.invalid data entry.  Using devices that capture data directly from source Using devices that capture data directly from source e.g. scanners etc.e.g. scanners etc.  Control access to data by enforcing security Control access to data by enforcing security measures.measures.  Back up data preferably on external storage media.Back up data preferably on external storage media. ----- ### Data processing methodsData processing methods  Data can be processed using one of the Data can be processed using one of the following methods.following methods.  MechanicallyMechanically  ManuallyManually  ElectronicallyElectronically ----- ### Manual data processingManual data processing  In this method staff in an In this method staff in an organisation uses the laid organisation uses the laid down procedures and rules down procedures and rules to collect data, process and to collect data, process and distribute information to distribute information to relevant departments for relevant departments for use. The tasks are done use. The tasks are done manually with a pen and a manually with a pen and a paper. No machines are paper. No machines are used to process data used to process data instead they use simple instead they use simple tools like tables and rulers.tools like tables and rulers. ----- ### Mechanical data processingMechanical data processing  Mechanical systems Mechanical systems are those where staff are those where staff use various use various mechanical machines mechanical machines like calculators, like calculators, typewriters, cash typewriters, cash registers duplicating registers duplicating machines etc to machines etc to perform operations.perform operations. ----- ### Electronic data processingElectronic data processing  In this system, data is In this system, data is manipulated using electronic manipulated using electronic machines to produce machines to produce information. This method is information. This method is faster and more accurate than faster and more accurate than the manual and mechanical the manual and mechanical where large volumes of data where large volumes of data are to be processed. This are to be processed. This method involves the use of method involves the use of computers and other computers and other electronic machine like mobile electronic machine like mobile phones, washing machines, phones, washing machines, modern digital TVs etc.modern digital TVs etc. ----- Factors determining the methods of data processingFactors determining the methods of data processing  Size and type of businessSize and type of business  Timing aspectsTiming aspects  Link between applicationLink between application ----- ### Computer filesComputer files  A file is a collection of related records that A file is a collection of related records that give a complete set of information about a give a complete set of information about a certain item or entity. A file can be stored certain item or entity. A file can be stored manually in a file cabinet or electronically manually in a file cabinet or electronically in a computer storage device.in a computer storage device. ----- Advantages of computerized filling systemAdvantages of computerized filling system  Information takes up less space than the Information takes up less space than the manual system.manual system.  Enhance data integrity and reduces Enhance data integrity and reduces duplication.duplication.  Offers faster access and retrieval of data.Offers faster access and retrieval of data.  Its much easier to update or modify Its much easier to update or modify information.information. ----- ### Elements of a computer fileElements of a computer file  A computer file is made up 3 elements.A computer file is made up 3 elements.  Characters Characters  this is the smallest element in a this is the smallest element in a computer file and refer to a letter, number, symbol computer file and refer to a letter, number, symbol that can be entered, stored and output by a computer.that can be entered, stored and output by a computer.  Field Field  a field is a single character or a collection of a field is a single character or a collection of characters that represents a single piece of data. For characters that represents a single piece of data. For example in employees record, the name of employee example in employees record, the name of employee is a field.is a field.  Records Records  is a collection of related fields that is a collection of related fields that represents a single entity. For example in employees represents a single entity. For example in employees record, details of each employee in a row. E.g. Name, record, details of each employee in a row. E.g. Name, IDNO, sex, Department etc make up a record. IDNO, sex, Department etc make up a record. Computer files can be viewed in two ways.Computer files can be viewed in two ways. ----- ### Logical fileLogical file  This is the way the user views the file in This is the way the user views the file in terms of its contents and the processing to terms of its contents and the processing to be carried upon them.be carried upon them. ----- ### Physical filePhysical file  This is the actual arrangement of the file This is the actual arrangement of the file contents into the storage media surface contents into the storage media surface and how the processing operations are and how the processing operations are made possible.made possible. ----- #### Types of computer processing filesTypes of computer processing files  Master fileMaster file  Transaction file (movement file)Transaction file (movement file)  Reference fileReference file  Sort fileSort file  Back Back  up fileup file  Report fileReport file ----- ### Master fileMaster file  This is the main file that contains This is the main file that contains permanent records about a particular item permanent records about a particular item or entries. The master file contains both or entries. The master file contains both static and dynamic fields. For example a static and dynamic fields. For example a payroll system might keep a master file payroll system might keep a master file containing employees personal details containing employees personal details (name, address, date of birth, sex etc) (name, address, date of birth, sex etc) which rarely change (static fields) and data which rarely change (static fields) and data describing the earnings and deductions describing the earnings and deductions which frequently change (dynamic fields).which frequently change (dynamic fields). ----- ### Transaction file (movement file)Transaction file (movement file)  This file includes input and output files for This file includes input and output files for holding temporary incoming or outgoing holding temporary incoming or outgoing data. It contains data about an data. It contains data about an organisation activities taking place for organisation activities taking place for some period of time. This file is used to some period of time. This file is used to update dynamic data on master files.update dynamic data on master files. ----- ### Reference fileReference file  They are permanent or semi permanent They are permanent or semi permanent and are used for reference or look up and are used for reference or look up purposes. They contain records that are purposes. They contain records that are fairly static. E.g. price, lists, Pay As You fairly static. E.g. price, lists, Pay As You Earn etc.Earn etc. ----- ### Sort fileSort file  These files are created from existing These files are created from existing transaction or master files. They are used transaction or master files. They are used where data is to be processed where data is to be processed sequentially. Data or records are first sequentially. Data or records are first sorted in a particular format for example sorted in a particular format for example they are arranged in ascending or they are arranged in ascending or descending order of the key field and descending order of the key field and stored in the sort file.stored in the sort file. ----- ### Back Back  up fileup file  These files are duplicate copies of existing These files are duplicate copies of existing files. They are used to supplement the files. They are used to supplement the operational files in case of loss by any operational files in case of loss by any reason. They are created any time and reason. They are created any time and update is carried out on the master file.update is carried out on the master file. ----- ### Report fileReport file  They contain sets of records extracted They contain sets of records extracted from data in the master files. They are from data in the master files. They are used to prepare reports that can be printed used to prepare reports that can be printed at a later date, for example, list of at a later date, for example, list of absentees, overtime etc.absentees, overtime etc. ----- ### File processing activitiesFile processing activities 11  Updating Updating  refers to changing data in refers to changing data in master file to reflect the current status.master file to reflect the current status.  Referencing Referencing  happens when it is made to happens when it is made to particular records to ascertain what is particular records to ascertain what is contained therein. The activity does not contained therein. The activity does not alter the contents of master file from a file.alter the contents of master file from a file.  Sorting Sorting  this entails arranging of file this entails arranging of file contents into some pre contents into some pre  determined determined sequence of the key field, which occupy sequence of the key field, which occupy the same position on the records.the same position on the records. ----- ### File processing activitiesFile processing activities 22  Merging Merging  the process that combines the the process that combines the contents of two or more input files into one contents of two or more input files into one output files.output files.  Matching Matching  the input files records are the input files records are matched/compared to ensure that records exist matched/compared to ensure that records exist in both the files.in both the files.  Summarizing Summarizing  the records of interest from the the records of interest from the file are accumulated to form a record in the file are accumulated to form a record in the output file.output file.  Searching Searching  it entails looking for the record of it entails looking for the record of interests from the file.interests from the file. ----- ### File updating 1 File updating 1  Hit rate Hit rate  hit rate is used to describe the hit rate is used to describe the rate of processing of a master file in terms rate of processing of a master file in terms of its active records. For example, if 600 of its active records. For example, if 600 transactions are processed each day transactions are processed each day against a master file of 12,000 records, against a master file of 12,000 records, then the hit rate is said to be 5% i.e. then the hit rate is said to be 5% i.e. **100 ----- ### File updating 2File updating 2  Volatility Volatility  this is the frequency with which this is the frequency with which records are added to the file or deleted records are added to the file or deleted from it. If the frequency is high, then the from it. If the frequency is high, then the file is said to be volatile otherwise static.file is said to be volatile otherwise static.  Size Size  refers to the amount of data stored refers to the amount of data stored in the file. Its expressed in terms of the in the file. Its expressed in terms of the total number of records in the file.total number of records in the file.  Growth Growth  files will always grow as new files will always grow as new records are added to it.records are added to it. ----- ### File organisation methodsFile organisation methods  File organisation is the arrangements of File organisation is the arrangements of records within a particular file. There are records within a particular file. There are four methods of storing files and retrieving four methods of storing files and retrieving them from secondary storage devices.them from secondary storage devices. ----- ### Sequential file organisationSequential file organisation  In this organisation records are stored and In this organisation records are stored and accessed in a particular order sorted using accessed in a particular order sorted using key field. The key field is used to search key field. The key field is used to search for a particular record. Searching for a particular record. Searching commences at the beginning of the file commences at the beginning of the file and proceeds to the tail of the file until the and proceeds to the tail of the file until the record is reached. Mainly used with record is reached. Mainly used with magnetic tapes.magnetic tapes. ----- ### Advantages of sequential fileAdvantages of sequential file  Simple to understand the approach.Simple to understand the approach.  Easy to organise, maintain and Easy to organise, maintain and understand.understand.  Reading a record requires only the key Reading a record requires only the key field.field.  Inexpensive input/output media and Inexpensive input/output media and devices are used.devices are used. ----- ### Disadvantages of sequential fileDisadvantages of sequential file  Entire file must be accessed even when Entire file must be accessed even when the activity rate is very low.the activity rate is very low.  Random enquires are impossible to Random enquires are impossible to handle.handle.  Data redundancy is typically high.Data redundancy is typically high. ----- #### Random or direct file organisationRandom or direct file organisation  In this organisation records are stored In this organisation records are stored randomly but accessed directly. To access randomly but accessed directly. To access a file stored randomly, a record key is a file stored randomly, a record key is used to determine where a record is used to determine where a record is stored on the storage media. Used in stored on the storage media. Used in magnetic and optical disks.magnetic and optical disks. ----- #### Advantages of random or direct fileAdvantages of random or direct file  Records are quickly accessed.Records are quickly accessed.  File update is easily achieved.File update is easily achieved.  They do not require the use of indexes.They do not require the use of indexes. ----- #### Disadvantages of random or direct fileDisadvantages of random or direct file  Data may be accidentally erased or over Data may be accidentally erased or over written. Unless special precaution taken.written. Unless special precaution taken.  Expensive hardware and software Expensive hardware and software resources are required.resources are required.  Relative complexity of programming.Relative complexity of programming.  System design around it is complex and System design around it is complex and costly.costly. ----- ### Serial file organisationSerial file organisation  The records are laid out The records are laid out contiguously one after the contiguously one after the other in no particular other in no particular sequence. The records sequence. The records are stored one after the are stored one after the other in the same order other in the same order they come into the file they come into the file and there exists no and there exists no relationship between relationship between contiguous records. Used contiguous records. Used with magnetic tapes.with magnetic tapes. ----- #### Indexed sequential file organisationIndexed sequential file organisation  This method is similar to sequential This method is similar to sequential method, only that an index is used to method, only that an index is used to enable the computer to locate individual enable the computer to locate individual records on the storage media. Used with records on the storage media. Used with magnetic disk.magnetic disk. ----- #### Advantages of indexed sequential fileAdvantages of indexed sequential file  Records can be accessed sequentially or Records can be accessed sequentially or randomly.randomly.  Records are not duplicated.Records are not duplicated.  Accessing of records can be fast if done Accessing of records can be fast if done randomly.randomly. ----- #### Disadvantages indexed sequential fileDisadvantages indexed sequential file  Storage medium is rather expensive.Storage medium is rather expensive.  Accessing records sequentially is time Accessing records sequentially is time consuming.consuming.  Processing records sequentially may Processing records sequentially may introduce redundancy.introduce redundancy. ----- #### Electronic data processing modesElectronic data processing modes  OnOn--line processingline processing  Time sharing processingTime sharing processing  Real time processingReal time processing  MultiMulti--programming / multiprogramming / multi--taskingtasking  Distributed processingDistributed processing  Batch processingBatch processing  MultiMulti--processingprocessing  Interactive processingInteractive processing ----- ### OnOn--line processingline processing  In this processing the result of data In this processing the result of data processing is available immediately. All processing is available immediately. All the computer peripherals and equipments the computer peripherals and equipments are under the direct control of the central are under the direct control of the central processor. As soon as the input processor. As soon as the input transactions are available, they are transactions are available, they are processed to produce the required processed to produce the required information. The user can interact with the information. The user can interact with the system at any time of processing using system at any time of processing using input/output facilities.input/output facilities. ----- #### Application of onApplication of on--line processingline processing  BankingBanking  Stock exchangeStock exchange  Stock controlStock control  Water/electricity billingWater/electricity billing ----- #### Advantages of onAdvantages of on--line processingline processing  Files are maintained up to date.Files are maintained up to date.  Information is readily available for current Information is readily available for current decisions.decisions.  File enquiries possible through the File enquiries possible through the terminals (work station)terminals (work station) ----- #### Disadvantages of onDisadvantages of on--line processingline processing  System are complex to develop.System are complex to develop.  Are costly in terms of hardware, software, Are costly in terms of hardware, software, storage media etc.storage media etc. ----- ### Time sharing processingTime sharing processing  In this mode the central processor serves two or more users In this mode the central processor serves two or more users with different processing requirements (tasks). The central with different processing requirements (tasks). The central computer is available to a variety of uses, connected to the computer is available to a variety of uses, connected to the central computer via communication links who may wish to central computer via communication links who may wish to process their data and receive information. The processor time process their data and receive information. The processor time is divided out appropriately among the user task is into time is divided out appropriately among the user task is into time slices. Control is switched from one job to another, under the slices. Control is switched from one job to another, under the influence of the operating system. The time slice is equal for all influence of the operating system. The time slice is equal for all jobs and its assigned to jobs waiting in a queue. In one turn, jobs and its assigned to jobs waiting in a queue. In one turn, only one slice is allocated to the job. The jobs in the queue are only one slice is allocated to the job. The jobs in the queue are assigned the time slice from the head of the queue towards the assigned the time slice from the head of the queue towards the tail. Jobs that require more time slices are chained to the tail tail. Jobs that require more time slices are chained to the tail queue. New jobs into the queue are added at the tail of the queue. New jobs into the queue are added at the tail of the queue. The wholly processed jobs output results. The queue. The wholly processed jobs output results. The incomplete jobs go back to the tail of the queue to await their incomplete jobs go back to the tail of the queue to await their next turn.next turn. ----- #### Application of time sharing processingApplication of time sharing processing  BureauBureau  Learning institutions.Learning institutions.  Companies.Companies. ----- #### Advantages of time sharing processingAdvantages of time sharing processing  Better services to the users, for the Better services to the users, for the information/output is fast.information/output is fast.  Files enquiries is possible since files are Files enquiries is possible since files are held onheld on--line.line.  User interaction is possible through User interaction is possible through terminals.terminals. ----- ###### Disadvantages of time sharing processingDisadvantages of time sharing processing  User has no control over the central User has no control over the central computer.computer.  Not reliable with regard to data security.Not reliable with regard to data security.  Response time is slow where there are Response time is slow where there are many tasks.many tasks. ----- ### Real time processingReal time processing  In this mode, computer processes the In this mode, computer processes the incoming data as soon as it occurs, incoming data as soon as it occurs, updates the transactions file and gives an updates the transactions file and gives an immediate response that would affect the immediate response that would affect the events as they happen. The main purpose events as they happen. The main purpose of a real time processing is to provide of a real time processing is to provide accurate, up to date information hence accurate, up to date information hence better services based on a real situation.better services based on a real situation. ----- #### Application of real time processingApplication of real time processing  Air reservationAir reservation  Hotel reservationHotel reservation  Chemical plant processingChemical plant processing ----- #### Advantages of real time processingAdvantages of real time processing  Information is readily available for instant Information is readily available for instant decision.decision.  Provides immediate control / information.Provides immediate control / information.  Its fast and reliable.Its fast and reliable. ----- #### Disadvantages of real time processingDisadvantages of real time processing  Requires complex and expensive Requires complex and expensive operating system.operating system.  They are not easy to develop.They are not easy to develop.  Require Front End Processors (FEPS) to Require Front End Processors (FEPS) to relieve the ventral processor.relieve the ventral processor. ----- #### MultiMulti--programming / multiprogramming / multi--taskingtasking  In this processing more than one program In this processing more than one program are executed apparently at the same time are executed apparently at the same time by a single central processing unit. The by a single central processing unit. The operating system allocated each program operating system allocated each program a time slice and decides what order they a time slice and decides what order they will be executed.will be executed. ----- Advantages of multiAdvantages of multi--programming / multiprogramming / multi--taskingtasking  Increases the productivity of the computer Increases the productivity of the computer by reducing CPU idle time.by reducing CPU idle time.  Reduces the incidence of peripheral Reduces the incidence of peripheral bound operations.bound operations. ----- Disadvantages of multiDisadvantages of multi--programming / multiprogramming / multi--taskingtasking  Requires more expensive CPUs.Requires more expensive CPUs.  Operating system is complex and more Operating system is complex and more difficult to operate.difficult to operate. ----- ### Distributed processingDistributed processing  This processing refers to dividing This processing refers to dividing (distributing) processing tasks to two or (distributing) processing tasks to two or more computers that are located on more computers that are located on physically separate sites but connected by physically separate sites but connected by data transmission media. For example, a data transmission media. For example, a distributed database will have different distributed database will have different tables of the same database residing on tables of the same database residing on separate computers and processed there separate computers and processed there as need arises.as need arises. ----- #### Application of distributed processingApplication of distributed processing  Banks where customers can be served Banks where customers can be served from different branches but information is from different branches but information is updated at the head branch.updated at the head branch. ----- #### Advantages of distributed processingAdvantages of distributed processing  Less risk to system breakdown.Less risk to system breakdown.  In case of data loss, only a small portion of In case of data loss, only a small portion of the data is lost.the data is lost.  Reduction of the load on the host. Reduction of the load on the host. computer hence faster processing.computer hence faster processing. ----- ##### Disadvantages of distributed processingDisadvantages of distributed processing  Expensive due to extra communication Expensive due to extra communication costs.costs.  More sophisticated software required to More sophisticated software required to maintain data integrity.maintain data integrity. ----- ### Batch processingBatch processing  This is processing mode where the This is processing mode where the transactions are accumulated over a transactions are accumulated over a period of time and then proce3ssed at a period of time and then proce3ssed at a prepre--specified time to produce a batch of specified time to produce a batch of output. The data to be processed e.g. daily, output. The data to be processed e.g. daily, weekly, monthly etc then processed at weekly, monthly etc then processed at once.once. ----- ### Application of batch processingApplication of batch processing  Payroll processing.Payroll processing. ----- ### Advantages of batch processingAdvantages of batch processing  Simple to develop.Simple to develop.  Timing reports is not a necessity.Timing reports is not a necessity.  The unit cost of processing is low.The unit cost of processing is low. ----- #### Disadvantages of batch processingDisadvantages of batch processing  Time lag between origination of the Time lag between origination of the transactions and the information transactions and the information availability.availability.  Late information is not suitable in Late information is not suitable in situations where instant decisions are situations where instant decisions are requires.requires.  Its difficult to provide the desired priority Its difficult to provide the desired priority scheduling.scheduling. ----- ### MultiMulti--processingprocessing  This refers to the processing of more one This refers to the processing of more one task at the same time on different task at the same time on different processors of the same computer. In such processors of the same computer. In such systems, a computer may contain more systems, a computer may contain more than one independent central processing than one independent central processing unit which works together in a coordinated unit which works together in a coordinated way. At a given time the processor may way. At a given time the processor may execute instructions from two or more execute instructions from two or more different programs or from different parts different programs or from different parts of one program simultaneously.of one program simultaneously. ----- ### Interactive processingInteractive processing  In this processing, there is continuous In this processing, there is continuous dialogue between the user and the dialogue between the user and the computers. As the program executes, it computers. As the program executes, it keeps on prompting the user to provide keeps on prompting the user to provide input or respond to prompts displayed on input or respond to prompts displayed on the screen.the screen. ----- Factor to consider in selecting the data processing mode Factor to consider in selecting the data processing mode  The need for direct information retrieval The need for direct information retrieval and/or file interrogation.and/or file interrogation.  The control over the resources e.g. files, The control over the resources e.g. files, input/output devices.input/output devices.  The cost of acquiring the relevant The cost of acquiring the relevant hardware, software, media etc.hardware, software, media etc.  The optimization of the processing time.The optimization of the processing time.  The time factor of the information for The time factor of the information for decision making by mangers.decision making by mangers. ----- ### Review questions 1Review questions 1 1.1. Define the following terms:Define the following terms: A)A) Data processing.Data processing. B)B) Data processing style.Data processing style. 2.2. Using an illustration, describe the four primary stages of the Using an illustration, describe the four primary stages of the data processing cycle.data processing cycle. 3.3. Outline the stages of data collection.Outline the stages of data collection. 4.4. You may have come across the term Garbage In Garbage Out You may have come across the term Garbage In Garbage Out (GIGO). What is its relevance to errors in data processing.(GIGO). What is its relevance to errors in data processing. 5.5. Explain the two types of transcription errors.Explain the two types of transcription errors. 6.6. State three types of computational errors.State three types of computational errors. 7.7. Define the term data integrity.Define the term data integrity. 8.8. Give three factors that determine the integrity of data.Give three factors that determine the integrity of data. 9.9. State at least five ways of minimising threats to data integrity.State at least five ways of minimising threats to data integrity. ----- ### Answer of review questions 1Answer of review questions 1--11 1.1. A). Data processing refers to the transformation of raw A). Data processing refers to the transformation of raw data into meaningful output (information).data into meaningful output (information). B). Data processing cycle are the stages that data goes B). Data processing cycle are the stages that data goes through during its transformation into information. The through during its transformation into information. The output may be used later as input to another processing output may be used later as input to another processing task.task. 2.2. Data collection Data collection   data input data input   data processing data processing   output.output. 3.3. A). Data creation.A). Data creation. B). Data transmission.B). Data transmission. C). Data preparation.C). Data preparation. D). Media conversion.D). Media conversion. E). Input validation.E). Input validation. F). Sorting.F). Sorting. ----- ### Answer of review questions 1Answer of review questions 1--22 4.4. The accuracy of data entry determines the accuracy of The accuracy of data entry determines the accuracy of the output.the output. 5.5. A). Wrong entry due to misreading the source data e.g. A). Wrong entry due to misreading the source data e.g. entering C instead of G (transcription error).entering C instead of G (transcription error). B). Transposition B). Transposition  interchanging values e.g. 396 interchanging values e.g. 396 instead of 369.instead of 369. 6.6. Overflow and underflow.Overflow and underflow. Truncation.Truncation. Rounding.Rounding. 7.7. A). Data integrity refers to accuracy and completeness A). Data integrity refers to accuracy and completeness of data.of data. B). Accuracy, timeliness and relevance.B). Accuracy, timeliness and relevance. C). Banking up, enforcing security, using input devices C). Banking up, enforcing security, using input devices that capture data directly from the source etc.that capture data directly from the source etc. ----- ### Revision questionsRevision questions 1.1. Distinguish between data and information.Distinguish between data and information. 2.2. Describe types of data processing methods.Describe types of data processing methods. 3.3. State at least four advantages of storing data in State at least four advantages of storing data in computer files over the manual filing system.computer files over the manual filing system. 4.4. State elements that make up a computer file.State elements that make up a computer file. 5.5. Differentiate between a logical file and physical file.Differentiate between a logical file and physical file. 6.6. Explain at least six types of computer files.Explain at least six types of computer files. 7.7. Distinguish betweenDistinguish between A)A) Sequential and serial file organisation methods.Sequential and serial file organisation methods. B)B) Random and indexedRandom and indexed--sequential file organisation methods.sequential file organisation methods. 8.8. Describe at least five types of electronic data Describe at least five types of electronic data processing modes.processing modes. ----- ### Answer of revision questions 1Answer of revision questions 1 1.1. Data refers to raw facts that do Data refers to raw facts that do not have much meaning while not have much meaning while information refers to the information refers to the meaningful output after meaningful output after processing.processing. 2.2. Data processing methods: Data processing methods: manual, mechanical and manual, mechanical and electronic.electronic. 3.3. A). Takes up less space.A). Takes up less space. B). Easier to update or modify.B). Easier to update or modify. C). Faster access and retrieval.C). Faster access and retrieval. D). Enhances integrity.D). Enhances integrity. 4.4. A). Characters.A). Characters. B). Field.B). Field. C). Record.C). Record. 5.5. A logical file is viewed in terms A logical file is viewed in terms of what data items and of what data items and processing operation may be processing operation may be performed on the data while a performed on the data while a physical file is viewed in terms physical file is viewed in terms how data is stored and how it how data is stored and how it is to be processed.is to be processed. 6.6. A). Master file.A). Master file. B). Transaction file.B). Transaction file. C). Reference file.C). Reference file. D). Backup file.D). Backup file. E). Report file.E). Report file. F). Sort file.F). Sort file. ----- ### Answer of revision questions 2Answer of revision questions 2 1.1. In sequential file organisation, records are stored in a sorted order using a In sequential file organisation, records are stored in a sorted order using a key field while in serial file organisation, records are not sorted in any way.key field while in serial file organisation, records are not sorted in any way. 2.2. In random file organisation, records are stored randomly but accessed In random file organisation, records are stored randomly but accessed directly. On the other hand, in indexeddirectly. On the other hand, in indexed--sequential, records are stored sequential, records are stored sequentially but accessed directly using an index.sequentially but accessed directly using an index. 3.3. OnOn--line distributed line distributed  the data being processed is accessed, processed the data being processed is accessed, processed and updated in real time.and updated in real time. 4.4. TimeTime--sharingsharing--competing computers are allocated time slots to use competing computers are allocated time slots to use computer resources.computer resources. 5.5. Batch processing Batch processing  all the available jobs are processed in bulk all at once.all the available jobs are processed in bulk all at once. 6.6. Interactive processing Interactive processing  the computer presents the user with input the computer presents the user with input screens / the user inputs data as processing continues.screens / the user inputs data as processing continues. 7.7. Real time Real time  data being processed is updated online and the results data being processed is updated online and the results thereof affect current processing logic.thereof affect current processing logic. 8.8. MultiMulti--tasking tasking  several computer programs / tasks run concurrently at the several computer programs / tasks run concurrently at the same time sharing resources in shifts.same time sharing resources in shifts. 9.9. Multiprocessing Multiprocessing  several programs / tasks run concurrently on different several programs / tasks run concurrently on different processors.processors. ----- 168168 ----- ### IntroductionIntroduction  Human beings have evolved Human beings have evolved from the stone age to a highly from the stone age to a highly sophisticated and advanced sophisticated and advanced society by inventing things like society by inventing things like the wheel, fire, transistors and the wheel, fire, transistors and todays ultra modern devices todays ultra modern devices like computers. The idea of like computers. The idea of computers started way back in computers started way back in the nineteenth century. The first the nineteenth century. The first generation computers called generation computers called Electronic Numeric Integrator Electronic Numeric Integrator And Calculator (ENIAC 1) were And Calculator (ENIAC 1) were operated by plugging wires into operated by plugging wires into a control panel that resembles a control panel that resembles the old telephone switchboards.the old telephone switchboards. ----- ### Computer programmingComputer programming  A program A program  is an organised list of statements is an organised list of statements (instructions) that when executed, causes the (instructions) that when executed, causes the computer to behave in a predetermined manner computer to behave in a predetermined manner or carry out a defined task.or carry out a defined task.  Programming Programming  refers to the process of refers to the process of developing computer (instructions) programs developing computer (instructions) programs used to solve a particular task.used to solve a particular task.  A computer program A computer program  is designed using a is designed using a particular programming language. Each particular programming language. Each language has a special sequence or order of language has a special sequence or order of writing characters usually referred to as syntax.writing characters usually referred to as syntax. ----- ### Terms used in programmingTerms used in programming  Source programSource program  Object codeObject code  TranslatorTranslator  AssemblerAssembler  InterpreterInterpreter  CompilerCompiler ----- ### Source programSource program  This refers to the program code that the This refers to the program code that the programmer enters in the program editor programmer enters in the program editor window that is not yet translated into window that is not yet translated into machinemachine--readable form.readable form. ----- ### Object codeObject code  This refers to the program code that is in This refers to the program code that is in machinemachine--readable. i.e. a source code that readable. i.e. a source code that has been translated into machine has been translated into machine language.language. ----- ### Translator Translator  These are programs that These are programs that translates/convert the source program into translates/convert the source program into object code. E.g. assemblers, compliers, object code. E.g. assemblers, compliers, interpreters etc.interpreters etc. ----- ### Assembler Assembler  An assembler translates a program written An assembler translates a program written in assembly language into machine in assembly language into machine language,language, ----- ### Interpreter Interpreter  This translates the source program lineThis translates the source program line- byby--line, allowing the CPU to execute one line, allowing the CPU to execute one line before translating the next. The line before translating the next. The translated line is not stored in the translated line is not stored in the computer memory, hence every time the computer memory, hence every time the program is executed, it has to be program is executed, it has to be translated.translated. ----- ### Complier Complier  This translates the entire source program This translates the entire source program into object code. The compiler translates into object code. The compiler translates each higheach high--level instruction into several level instruction into several machine code instructions in a process machine code instructions in a process called COMPILATION and produces a called COMPILATION and produces a complete independent program that can complete independent program that can be run by the computer as often as be run by the computer as often as required without the original source required without the original source program being present.program being present. ----- Difference between the interpreters and compilersDifference between the interpreters and compilers |Interpreters|Compilers acher.co.ke/| |---|---| |Translates the source program one statement at a time.|https://Te Translates the entire source Visit code at once before execution. Papers| |Translates the program each time it is run hence slower than compiling.|Past Compiled program (object and Exams, code) can be saved on a Notes, storage media and run as KCSE required, hence executes free For faster than interpreted programs.| |Interpreted object code takes less memory compared to compiled program.|Compiled programs require more memory as the object file are larger.| ----- #### Level of programming languagesLevel of programming languages  There are 2 major levels namely;There are 2 major levels namely;  LowLow--level languages.level languages.  HighHigh--level languages.level languages. ----- ### LowLow--level languageslevel languages  These languages are classified as low These languages are classified as low because they can be easily understood by because they can be easily understood by the computer directly or they require little the computer directly or they require little effort to translate into computer effort to translate into computer understandable form. These languages understandable form. These languages are hardware oriented and therefore they are hardware oriented and therefore they are not portable. i.e. a program written for are not portable. i.e. a program written for one computer cannot be installed and one computer cannot be installed and used on another.used on another. ----- ### HighHigh--level languageslevel languages  These languages are very close to the These languages are very close to the human language (Englishhuman language (English--like) and they like) and they can be read and understood even by can be read and understood even by people who are not experts in people who are not experts in programming. These languages are programming. These languages are machine independent. This means that a machine independent. This means that a programmer concentrates on problem programmer concentrates on problem solving during a programming session solving during a programming session rather than how a machine operates.rather than how a machine operates. ----- ### Types of low level languagesTypes of low level languages  Machine language (First generation Machine language (First generation languages).languages).  Assembly languages (Second generation Assembly languages (Second generation languages)languages) ----- #### Machine languageMachine language (First generation languages)(First generation languages)  In this language, instructions are written using binary In this language, instructions are written using binary logic. Given that data and instructions are in binary logic. Given that data and instructions are in binary form, many lines of codes are needed to accomplish form, many lines of codes are needed to accomplish even a simple task like adding two numbers i.e. a even a simple task like adding two numbers i.e. a program written in this language look like this.program written in this language look like this. 11100110 00000011 1999999111100110 00000011 19999991 00001111 1000110100001111 10001101 10001111 11111111 1000001110001111 11111111 10000011 The program code is hard for human to understand The program code is hard for human to understand but its easily understood by computers.but its easily understood by computers. ----- #### Assembly languagesAssembly languages (Second generation languages)(Second generation languages)  This language is close to the machines vocabulary This language is close to the machines vocabulary rather than human beings vocabulary. It was rather than human beings vocabulary. It was developed in order to overcome the difficulties of developed in order to overcome the difficulties of understanding and using machine language. This understanding and using machine language. This language helps the programmers to write programs as language helps the programmers to write programs as a set of symbolic operation codes called Mnemonics. a set of symbolic operation codes called Mnemonics. Mnemonics are basically shortened two or three letter Mnemonics are basically shortened two or three letter words. A sample program written in Assembly words. A sample program written in Assembly language.language. MOVMOV AX,AX, 1515 (move 15 to register Ax)(move 15 to register Ax) SUBSUB AX,AX, 1010 (Subtract 10 from the value Ax)(Subtract 10 from the value Ax) Programs written in this language require an Programs written in this language require an assembler to convert them into machine language.assembler to convert them into machine language. ----- ### Classes of high level languagesClasses of high level languages  Third generation languages (3GLS)Third generation languages (3GLS)  Forth generation languages (5GLs)Forth generation languages (5GLs)  Fifth generation languages (5GLs)Fifth generation languages (5GLs)  Object Oriented Programming Language Object Oriented Programming Language (OOP)(OOP)  Web scripting languagesWeb scripting languages ----- #### Third generation languages (3GLS)Third generation languages (3GLS)  This generation languages is also called This generation languages is also called structured or procedural languages. A structured or procedural languages. A procedural language makes it possible to procedural language makes it possible to break a program into components called break a program into components called modules. Each performing a particular modules. Each performing a particular task. Structured programming has task. Structured programming has advantages because its flexible, easier to advantages because its flexible, easier to read and modify.read and modify. ----- Examples of third generation programming languageExamples of third generation programming language  Pascal Pascal  was developed to help in the teaching and learning of was developed to help in the teaching and learning of structured programming.structured programming.  Fotran Fotran  was developed for mathematics, scientists of was developed for mathematics, scientists of programs with mathematical expressions.programs with mathematical expressions.  Cobol Cobol  was designed for developing programs that solve was designed for developing programs that solve business problems.business problems.  Basic Basic  developed to enable students to easily learn developed to enable students to easily learn programming.programming.  C C  used for developing system software e.g. the operation used for developing system software e.g. the operation systems. Its very powerful high level language because of its systems. Its very powerful high level language because of its ability to provide programmer with powerful aspects/features of ability to provide programmer with powerful aspects/features of low level.low level.  Ada Ada  this language is suitable for developing military, industrial this language is suitable for developing military, industrial and real and real  time systems.time systems. ----- #### Forth generation languages (4GLs)Forth generation languages (4GLs)  This generation make programming an even This generation make programming an even easier task than the third generation language easier task than the third generation language because they present the programmer with more because they present the programmer with more programming tools. Examples of such tools are programming tools. Examples of such tools are command buttons, forms etc. the 4 GLs are easy command buttons, forms etc. the 4 GLs are easy to learn and understand because they are user to learn and understand because they are user based. The languages syntax (grammar) is based. The languages syntax (grammar) is natural, near English language and use menus natural, near English language and use menus to prompts to guide a nonto prompts to guide a non--specialist or retrieve specialist or retrieve data with ease.data with ease. ----- ### Examples of 4GLsExamples of 4GLs  Visual BasicVisual Basic  Delphi PascalDelphi Pascal  Visual CobolVisual Cobol  C++C++ ----- #### Fifth generation languages (5GLs)Fifth generation languages (5GLs)  These languages are designed around the These languages are designed around the concept of solving problems by enabling concept of solving problems by enabling the computer to depict human like the computer to depict human like intelligence. These programs are designed intelligence. These programs are designed to make the computer solve the problem to make the computer solve the problem for the programmer rather than for the programmer rather than programmer spending a lot of time to programmer spending a lot of time to come up with the solution.come up with the solution. ----- ### Examples of 5GLsExamples of 5GLs  PROLOGPROLOG  MERCURYMERCURY  LISPLISP  OCCAMOCCAM ----- Object Oriented Programming Language (OOP)Object Oriented Programming Language (OOP)  The concept behind OOP languages is to look at The concept behind OOP languages is to look at a program as having various objects interacting a program as having various objects interacting to make up a whole. Each object has a specific to make up a whole. Each object has a specific data values that are unique to it (called state) data values that are unique to it (called state) and a set of the things it can accomplish called and a set of the things it can accomplish called (functions or behaviour). This process of having (functions or behaviour). This process of having data and functions that operate on the data data and functions that operate on the data within an object is called within an object is called **EncapsulationEncapsulation** . . Several objects can then be linked together to Several objects can then be linked together to form a complete program. OOP has greatly form a complete program. OOP has greatly contributed to development of contributed to development of **Graphical user Graphical user** **interface operation system interface operation system** and and **application application** **programs.programs.** ----- ### Examples of OOPExamples of OOP  JavaJava  SimulaSimula  Small talkSmall talk ----- ### Web scripting languagesWeb scripting languages  These languages are used to develop or add functionalities on These languages are used to develop or add functionalities on web pages. Web pages are hypertext documents created in a web pages. Web pages are hypertext documents created in a language called language called **HyperText Markup Language HyperText Markup Language** (HTML). The (HTML). The languages consist of markup tags that tell the Internet browser languages consist of markup tags that tell the Internet browser that the file contains HTMLthat the file contains HTML--code information and is code information and is distinguished by a file extension of HTML. The markup tags distinguished by a file extension of HTML. The markup tags define the various components of a World Wide Web document define the various components of a World Wide Web document such as heading, tables, paragraphs, lists etc. HTML does not such as heading, tables, paragraphs, lists etc. HTML does not have the declaration part and control structures, hence its not have the declaration part and control structures, hence its not considered as a true programming language. Due to its considered as a true programming language. Due to its simplicity, it has many limitations and cannot be used alone simplicity, it has many limitations and cannot be used alone when developing functional websites. Some special blocks of when developing functional websites. Some special blocks of codes called codes called **ScriptsScripts** may be inserted in HTML pages using may be inserted in HTML pages using scripting languages like JavaScript, VBScript etc in order to add scripting languages like JavaScript, VBScript etc in order to add functionality to HTML pages.functionality to HTML pages. ----- Examples of HTML tags and their meaningsExamples of HTML tags and their meanings |Tag|Meaning acher.co.ke/| |---|---| |<HTML> </HTML>|https://Te Marks the beginning and end of a HTML document. All other tags and text fall between these two tags. Visit| |<HEAD></HEAD>|Papers Marks the header part of the document. Past d| |<TITLE> </TITLE>|an Gives title of te web page. Text between this tags appears in the title bar when the Exams, page is browsed. tes,| |<BODY></BODY>|No Marks the body part of the document. KCSE free| |<CENTER></CENTER >|For Centres text and objects on the web page.| |<B></B>|Bolds the text on the web page.| |<I></I>|Italicise the text.| |<H1> </H1>|Sets size of text on the web page with H6 displaying the smallest and H1 the largest size.| ----- #### Creating a script using Javascript 1Creating a script using Javascript 1  Javascript is a popular scripting language. Javascript is a popular scripting language. Before writing your HTML program with a Before writing your HTML program with a script inserted, make sure that you have script inserted, make sure that you have the latest browser software installed on the latest browser software installed on your computer. Older browsers may not your computer. Older browsers may not have support for Javascript. If you are have support for Javascript. If you are using Internet Explorer, it should be using Internet Explorer, it should be version 5.0 and above.version 5.0 and above. ----- #### Creating a script using Javascript 2Creating a script using Javascript 2  Open Notepad and key in the following program. Do not Open Notepad and key in the following program. Do not write the numbers to the left of each line of code.write the numbers to the left of each line of code. 1.1. <HTML><HTML> 2.2. <HEAD><HEAD> 3.3. <TITLE>Scripting Example</TITLE><TITLE>Scripting Example</TITLE> 4.4. </HEAD></HEAD> 5.5. <BODY><BODY> 6.6. <HI><CENTER><B>we are the world</B></CENTER><HI><HI><CENTER><B>we are the world</B></CENTER><HI> 7.7. <SCRIPT>LANGUAGE=JavaScript><SCRIPT>LANGUAGE=JavaScript> 8.8. document.write(My name is strongman);document.write(My name is strongman); 9.9. alert(congratulations for succeeding to run this script);alert(congratulations for succeeding to run this script); 10.10. </SCRIPT></SCRIPT> 11.11. </BODY></HTML></BODY></HTML> ----- #### Creating a script using Javascript 3Creating a script using Javascript 3  After typing the entire After typing the entire program, save your file program, save your file on the desktop as on the desktop as Example.html and then Example.html and then close the notepad. Notice close the notepad. Notice that the icon to your file that the icon to your file on the desktop look like on the desktop look like that of the default web that of the default web browser in your computer.browser in your computer.  To view the web page, To view the web page, double click the icon of double click the icon of the file Example.html on the file Example.html on the desktop. Figure right the desktop. Figure right shows as open webpage.shows as open webpage. ----- ### Explanations of JavaScriptExplanations of JavaScript ----- #### Advantages of lowAdvantages of low--level languageslevel languages  The CPU understands machine language The CPU understands machine language directly without translation.directly without translation.  They are stable and hardly crash or They are stable and hardly crash or breakdown once written.breakdown once written.  Running a program is fast, no compilation Running a program is fast, no compilation is needed.is needed.  They are economical in terms of the They are economical in terms of the amount of memory they use.amount of memory they use. ----- #### Disadvantages of lowDisadvantages of low--level languageslevel languages  They are difficult and cumbersome to use They are difficult and cumbersome to use and learn.and learn.  Require highly trained experts to both Require highly trained experts to both develop and maintain programs.develop and maintain programs.  Debugging programs is difficult.Debugging programs is difficult.  They are machine dependent.They are machine dependent.  The programs are long.The programs are long. ----- #### Advantages of highAdvantages of high--level languageslevel languages  The programs are portable (not machine The programs are portable (not machine dependent).dependent).  They are user friendly and easy to use and They are user friendly and easy to use and learn.learn.  They are more flexible.They are more flexible.  They are easy to debug.They are easy to debug.  They provide better documentation.They provide better documentation.  Require less time to code.Require less time to code. ----- #### Disadvantages of highDisadvantages of high--level languageslevel languages  Program executed more slowly.Program executed more slowly.  Require larger CPU storage capacity for Require larger CPU storage capacity for compilation.compilation.  They have to be translated to machine They have to be translated to machine readable form before readable form before ----- ### Program developmentProgram development  There are six stages of program There are six stages of program development. They include:development. They include: |Problem recognition Problem definition Program design Program coding Program testing Program implemetation|Problem recognition| |---|---| ||Program implemetation| ||| ----- ### Problem recognitionProblem recognition  This refers to the understanding and This refers to the understanding and interpretation of a particular problem. To interpretation of a particular problem. To understand a problem one has to look for understand a problem one has to look for key words such as compute, evaluate, key words such as compute, evaluate, compare etc. a programmer identifies compare etc. a programmer identifies problems in the environment and seeks to problems in the environment and seeks to solve them by writing a computer program solve them by writing a computer program that would provide the solution.that would provide the solution. ----- #### Circumstances that can cause the Circumstances that can cause the programmer to identify a problemprogrammer to identify a problem  Opportunity to improve the current Opportunity to improve the current program.program.  A new directive given by the management A new directive given by the management requiring a change in the status quo.requiring a change in the status quo.  Problems or undesirable situations that Problems or undesirable situations that prevent an individual or organisation from prevent an individual or organisation from achieving their purpose.achieving their purpose. ----- ### Problem definitionProblem definition  At this stage the programmer tries to determine At this stage the programmer tries to determine or define the likely input, processing and or define the likely input, processing and expected output using the keywords outlined at expected output using the keywords outlined at the problem recognition stage. The boundaries the problem recognition stage. The boundaries of the expected program are established and if of the expected program are established and if several methods to solve the same problem are several methods to solve the same problem are identified the best alternatives should be identified the best alternatives should be chosen. At the end of the stage requirement chosen. At the end of the stage requirement documentation for the new program is written.documentation for the new program is written. ----- ### Program designProgram design  This is the actual development of the programs processing or This is the actual development of the programs processing or problem solving logic called problem solving logic called **algorithm.algorithm.** (A limited number of (A limited number of logical steps that a program follows in order to solve a problem). The programmer comes up with an algorithm after analysing The programmer comes up with an algorithm after analysing the requirements specifications. Some of the programs are the requirements specifications. Some of the programs are made up of one large block code. i.e. they are Monolithic while made up of one large block code. i.e. they are Monolithic while others are made of several units called modules which work others are made of several units called modules which work together to from the whole program. In modular programming, together to from the whole program. In modular programming, each module performs a specific task. This approach makes a each module performs a specific task. This approach makes a program flexible, easier to read and debug. This phase enable program flexible, easier to read and debug. This phase enable the programmer to come up with models of the expected the programmer to come up with models of the expected program. The model show the flow of events and data program. The model show the flow of events and data throughout the entire program from input of a program.throughout the entire program from input of a program. ----- ### Monolithic and modular programMonolithic and modular program ----- ### Program codingProgram coding  This is the actual process of converting a This is the actual process of converting a design model into its equivalent program. design model into its equivalent program. This is done by creating the program using This is done by creating the program using a particular programming language. The a particular programming language. The end result of this stage is a source end result of this stage is a source program that can be translated into program that can be translated into machine readable form for the computer to machine readable form for the computer to execute and solve the target problem.execute and solve the target problem. ----- ### Program in Pascal and C++Program in Pascal and C++ |Program in Pascal|Program in C++ acher.co.ke/| |---|---| |Program AreaCircle (input, output); Const Pi = ; Var Radius, Area: real; Begin WriteIn (Enter the radius); ReadIn (radius); Area: = Pi *Radius *Radius; WriteIn (The area is, Area) End.|https://Te #include<iostream.h> Visit double radius, area; Papers double pi = ; Past and main () Exams, { Notes, KCSE cout<<Enter the radius; free For cin>>radius; area = pi *radius *radius cout<<The area is, area; return 0; }| ----- ### Explain the program codes 1Explain the program codes 1 |Pascal code|C++ code|Explanation eacher.co.ke/| |---|---|---| |Program Areacircle (input, output);|#include<iostream.h>|https://T The header of the Visit programs. The statements Papers in () and <> shows that Past the user inputs data via and Exams, the keyboard and the Notes, program display KCSE information on the screen. free For| |Const Pi = 3.142;|double pi = 3.142;|A constant has been declared with a name pi and value 3.142.| |Var Radius, area:real|double area, radius;|Real variables with fractional part have been declared.| ----- ### Explain the program codes 2Explain the program codes 2 |Pascal code|C++ code|Explanation eacher.co.ke/| |---|---|---| |Begin|{|https://T Marks the beginning of the program body or Visit Papers executable statements. Past and ,| |WtiteIn|cout<<Enter radius:|Exams Display on the screen the Notes, string between inverted KCSE commas. free For| |ReadIn (Radius)|cin>>radius;|Displays a blinking cursor that tells the user that an input is needed before the program can continue.| ----- ### Explain the program codes 3Explain the program codes 3 |Pascal code|C++ code|Explanation eacher.co.ke/| |---|---|---| |Area: = Pi * Radius * Radius|area = pi * radius * radius;|https://T Calculates the area. Notice Visit the assignment statement in Papers Pascal is : = while in C++ it is Past = and ams,| |WriteIn (The area is, Area);|cout<<The area is, Area<<n;|Ex Display the value stored in Notes, the variable Area. KCSE free For| |End.|return 0; }|Marks the end of the program| ----- #### Program Testing and DebuggingProgram Testing and Debugging  After coding the program has to be tested After coding the program has to be tested and the errors detected and corrected. and the errors detected and corrected. Debugging refers to detection and Debugging refers to detection and correction of errors that may exist in the correction of errors that may exist in the program. Program testing involves program. Program testing involves creating test data designed to produce creating test data designed to produce predictable output. They are two types of predictable output. They are two types of errors (bugs) that can be encountered errors (bugs) that can be encountered when testing.when testing. ----- ### Types of errors (bugs)Types of errors (bugs)  Syntax errors Syntax errors  they occur as a result of they occur as a result of improper use of language rules. E.g. improper use of language rules. E.g. grammar mistakes, punctuation, improper grammar mistakes, punctuation, improper naming of variables etc. these errors are naming of variables etc. these errors are detectable by translator and must be detectable by translator and must be corrected before the program runs.corrected before the program runs.  Logical errors Logical errors  they are not detectable by they are not detectable by the translator. The program rules but gives the translator. The program rules but gives wrong out put or halts during execution.wrong out put or halts during execution. ----- ### Methods of errors detectionMethods of errors detection  Desk checking / dry Desk checking / dry  run.run.  Using Debugging utilities.Using Debugging utilities.  Using Test Data.Using Test Data.  Implementation and maintenance Implementation and maintenance Implementation.Implementation.  Review and maintenance.Review and maintenance.  Program documentation.Program documentation. ----- ### Desk checking / dry Desk checking / dry  runrun  It involves going through the program It involves going through the program while still on paper before entering it in the while still on paper before entering it in the program editor.program editor. ----- ### Using Debugging utilitiesUsing Debugging utilities  In the program editor, you can run the In the program editor, you can run the debugging utilities during translation to debugging utilities during translation to detect syntax errors. detect syntax errors. ----- ### Using Test DataUsing Test Data  The programmer carries out trial runs of The programmer carries out trial runs of the new program. At each run he enters the new program. At each run he enters various data variations and extremes various data variations and extremes including data with errors to test whether including data with errors to test whether the system will grid to a halt. A good the system will grid to a halt. A good program should not crash due to incorrect program should not crash due to incorrect data entry but should inform the user data entry but should inform the user about the anomaly.about the anomaly. ----- #### Implementation and Implementation and maintenance implementationmaintenance implementation  This is the actual delivery and installation This is the actual delivery and installation of the new program ready for use, creating of the new program ready for use, creating data files and train people to use the data files and train people to use the system. The new system will change the system. The new system will change the way things are done hence it should be way things are done hence it should be reviewed and maintained.reviewed and maintained. ----- ### Review and maintenanceReview and maintenance  This stage is important because of the This stage is important because of the errors that may be encountered after errors that may be encountered after implementation. A program may fail due to implementation. A program may fail due to poor use, hence proper training and post poor use, hence proper training and post implementation support of users will implementation support of users will reduce chances of having them entering reduce chances of having them entering invalid data that crash the program.invalid data that crash the program. ----- ### Program documentationProgram documentation  This is writing of support materials This is writing of support materials explaining how the program can be used explaining how the program can be used by users, installed by operators or by users, installed by operators or modified by other programmers. All stages modified by other programmers. All stages of program development should be of program development should be documented in order to help during future documented in order to help during future modification of the program.modification of the program. ----- ### Types of documentationTypes of documentation  User oriented documentation User oriented documentation  these type enables these type enables the user to learn how to use the program as quickly the user to learn how to use the program as quickly as possible and with little help from programmer.as possible and with little help from programmer.  Operator oriented documentation Operator oriented documentation  meant for meant for computer operators. E.g. Technician. It helps them computer operators. E.g. Technician. It helps them to install and maintain the program.to install and maintain the program.  Programmer oriented documentation Programmer oriented documentation  written for written for skilled programmers. It provides necessary skilled programmers. It provides necessary technician information to help in future modification technician information to help in future modification of program.of program. ----- ### Development of algorithmsDevelopment of algorithms  **AlgorithmsAlgorithms**  refers to a limited number of refers to a limited number of logical steps that a program follows in logical steps that a program follows in order to solve a problem.order to solve a problem.  **PseudocodePseudocode**  refers to a set of refers to a set of statements written in a readable language statements written in a readable language (English (English  like) but expressing the like) but expressing the processing logic of a program.processing logic of a program. ----- Guidelines for designing a good pseudocodeGuidelines for designing a good pseudocode  The statements must be short, clear and The statements must be short, clear and readable.readable.  Pseudocode lines should be clearly Pseudocode lines should be clearly outlined and indented clearly.outlined and indented clearly.  It should show clearly the start and stop of It should show clearly the start and stop of executable statements and control executable statements and control structures.structures.  Statements must not have more than one Statements must not have more than one meaning.meaning. ----- ### Examples of Pseudo codeExamples of Pseudo code ***SolutionSolution*** **STARTSTART** **Print Enter two numbersPrint Enter two numbers** **Input x,yInput x,y** **Sum Sum  x x + y+ y** **Average = sum / 2Average = sum / 2** **PRINT sumPRINT sum** **PRINT AveragePRINT Average** **STOPSTOP**  Write of Pseudo code Write of Pseudo code that can be used to that can be used to prompt the user to prompt the user to enter two numbers, enter two numbers, calculate the sum and calculate the sum and average of the two average of the two numbers and then numbers and then display the output on display the output on the screenthe screen ----- ### Program flowchartsProgram flowcharts  A flowchart is a diagrammatic A flowchart is a diagrammatic representation of a program in algorithms. representation of a program in algorithms. It uses statements and symbols that have It uses statements and symbols that have specific meaning. The symbols are of specific meaning. The symbols are of different standard shapes linked to show different standard shapes linked to show the order of processing. Each shape the order of processing. Each shape contains note stating what the operation is.contains note stating what the operation is. ----- #### Most common program flowchartsMost common program flowcharts  Ellipse: denotes the beginning and end of the Ellipse: denotes the beginning and end of the program algorithm.program algorithm.  Parallelogram: used to denote an input or output Parallelogram: used to denote an input or output operation. For example, READ A,B, PRINT SUM operation. For example, READ A,B, PRINT SUM =A+B=A+B  Rectangle: indicates that a processing or data Rectangle: indicates that a processing or data transformation is taking place. For example SUM transformation is taking place. For example SUM =A+B.=A+B.  Rhombus: used to specify a condition. A condition Rhombus: used to specify a condition. A condition must evaluate to a boolean value (True or false) for must evaluate to a boolean value (True or false) for the program to execute the next instructions.the program to execute the next instructions.  Connector: used as a connecting point or interface Connector: used as a connecting point or interface for arrows coming from different directions.for arrows coming from different directions.  Arrow: used to indicate the direction of flow of the Arrow: used to indicate the direction of flow of the program logic.program logic.Start/StopInput/outputProcessDecisionConnector ----- #### Guidelines for drawing a flowchartGuidelines for drawing a flowchart  There should be only one entry and one There should be only one entry and one exit point of a program algorithm.exit point of a program algorithm.  Use correct symbol at each stage in the Use correct symbol at each stage in the flowchart.flowchart.  Avoid crossed flow lines.Avoid crossed flow lines.  Be as neat and tidy in drawing as possible.Be as neat and tidy in drawing as possible.  General direction of flow in any flowchart General direction of flow in any flowchart is from top to bottom, left to right.is from top to bottom, left to right. ----- ### Examples of flowchartExamples of flowchart ***SolutionSolution***  Draw a flowchart for a Draw a flowchart for a program used to program used to prompt the user to prompt the user to enter two numbers. enter two numbers. The program should The program should find the sum, and find the sum, and average then display average then display the output.the output. ----- ### Types of flowchartTypes of flowchart  System flowchart System flowchart  its a chart that depicts its a chart that depicts the systems as a whole with only the systems as a whole with only subsystems or major elements shown,subsystems or major elements shown,  Program flowchart Program flowchart  this chart shows the this chart shows the sequence of operations as carried out by a sequence of operations as carried out by a computer program.computer program. ----- ### Advantages of flowchartAdvantages of flowchart  Gives programmer good visual reference of Gives programmer good visual reference of what the program will do.what the program will do.  Serves as a program or system Serves as a program or system documentation.documentation.  Its easy to trace through from the start to Its easy to trace through from the start to find the action resulting from a set of find the action resulting from a set of condition.condition.  Allows programmers to test alternative Allows programmers to test alternative solutions to a problem without over coding solutions to a problem without over coding the program.the program. ----- ### Disadvantages of flowchartDisadvantages of flowchart  There are so many different ways to draw There are so many different ways to draw them.them.  its difficult to remain neat and uncluttered its difficult to remain neat and uncluttered if the logic is complex.if the logic is complex.  Constructing a flowchart is time Constructing a flowchart is time consuming.consuming.  They take up considerable space.They take up considerable space.  They are difficult to amend without They are difficult to amend without redrawing.redrawing. ----- Comparison between a pseudocode and a flowchartComparison between a pseudocode and a flowchart ----- ### Program control structuresProgram control structures  They are blocks of statements that They are blocks of statements that determine how statements are to be determine how statements are to be executed. There are three control executed. There are three control structures namely.structures namely.  SequenceSequence  Selection decisionSelection decision  Iteration (looping) repetitionIteration (looping) repetition ----- ### Sequence Sequence  In this control structure, the computer In this control structure, the computer reads instructions from a program file reads instructions from a program file starting from the first top line and starting from the first top line and proceeding downwards one by one to the proceeding downwards one by one to the end. Hence sequential program execution end. Hence sequential program execution enables the computer to perform tasks enables the computer to perform tasks that are arranged consecutively one after that are arranged consecutively one after another in the code.another in the code. ----- #### Example of how a sequential Example of how a sequential programs code executeprograms code execute TheThe program fileprogram file readerreader readsreads Begin Begin {Procedure name}{Procedure name} sequentially sequentially Action 1Action 1 statementstatement Action 2Action 2 byby Action nAction n statementsstatements End End {Procedure name}{Procedure name} to the endto the end of the fileof the file ----- ### Selection/decisionSelection/decision  This structure is used to branch, depending on whether This structure is used to branch, depending on whether the condition returns a value of True of False (Yes or No).the condition returns a value of True of False (Yes or No). For exa m ple IF < Condition >IF < Condition > Then Action 1Then Action 1 Else Action 2Else Action 2 Endif.Endif.  There are 4 types of selection controls used in highThere are 4 types of selection controls used in high--level level programming.programming.  IF.THENIF.THEN  IFTHENELSEIFTHENELSE  Nested IFNested IF  CASE SELECTIONCASE SELECTION ----- ### IF.THENIF.THEN ***General formatGeneral format*** IF < condition > ThenIF < condition > Then Statement:Statement: EndIfEndIf If Mark > = 80 thenIf Mark > = 80 then Print RewardPrint Reward EndIfEndIf  This is used if only one This is used if only one option is available. All option is available. All other options are ignored. other options are ignored. For example if a school For example if a school wants to reward only the wants to reward only the students who have mean students who have mean mark of 80 and above, it mark of 80 and above, it will be reward only those will be reward only those students who have students who have attained 80% and above attained 80% and above and ignore the rest.and ignore the rest. ----- ### IF.THEN.ELSEIF.THEN.ELSE ***General FormatGeneral Format*** IF < Condition > THENIF < Condition > THEN Statements 1Statements 1 ELSEELSE Statements 2Statements 2 EndIfEndIf ***The algorithem will be:The algorithem will be:--*** IF fault = Serious THENIF fault = Serious THEN Print RED CARDPrint RED CARD ELSEELSE Print yellow CardPrint yellow Card EndIfEndIf  Used when there are two Used when there are two available options. For available options. For example in a football example in a football match a player is given a match a player is given a RED CARD if he does a RED CARD if he does a very serious mistake very serious mistake otherwise he is given a otherwise he is given a Yellow Card.Yellow Card. ----- ### Nested IFNested IF  This is used where two or more options This is used where two or more options have to be considered to make a selection. have to be considered to make a selection. For example, to award grades according For example, to award grades according to the marks as followsto the marks as follows a.a. 80 marks80 marks Grade AGrade A b.b. 60 marks60 marks Grade BGrade B c.c. 50 marks50 marks Grade CGrade C d.d. 40 marks40 marks Grade DGrade D ----- ### General format of Nested IFGeneral format of Nested IF ***General FormatGeneral Format*** IF <Conditions> ThenIF <Conditions> Then StatementStatement ELSEELSE IF <Condition> ThenIF <Condition> Then StatementStatement ELSEELSE IF <Condition>ThenIF <Condition>Then StatementStatement EndifEndif EndifEndif EndEnd ***The pseudo code segment will be:The pseudo code segment will be:--*** If Marks = 80 THENIf Marks = 80 THEN Grade = AGrade = A ELSEELSE If Marks = 60 THENIf Marks = 60 THEN Grade = BGrade = B ELSEELSE If marks = 50 THENIf marks = 50 THEN Grade = DGrade = D EndifEndif EndifEndif EndifEndif EndifEndif EndEnd ----- ### CASE SELECTIONCASE SELECTION ***General formatGeneral format*** CASECASEx ofx of Label 1 : Statement1Label 1 : Statement1 Label 2 : Statement2Label 2 : Statement2 Label n : Statement nLabel n : Statement n--11 ELSEELSE Statement n Statement n End caseEnd case ***Example:Example:--*** CASECASE average OFaverage OF 80100:80100: Grade=AGrade=A 7079:7079: Grade=BGrade=B 6069:6069: Grade=CGrade=C 4049:4049: Grade=EGrade=E ELSEELSE Grade=FGrade=F End CaseEnd Case  Its an alternative to Its an alternative to the nested IF. This the nested IF. This selection is preferred selection is preferred to the Nested if in to the Nested if in order to reduce the order to reduce the many line s of codes. many line s of codes. Case selection can Case selection can only be expressed only be expressed using integers and using integers and alphabetic characters alphabetic characters only. The Boolean only. The Boolean expression should be expression should be CASE integer OF or CASE integer OF or CASW char OFCASW char OF ----- ### Iteration (looping) repetitionIteration (looping) repetition  This is designed to execute the same This is designed to execute the same block of code again and again until a block of code again and again until a certain condition is fulfilled. Iteration is certain condition is fulfilled. Iteration is important in situations where the same important in situations where the same operation has to be carried out on a set of operation has to be carried out on a set of data many times. There are three main data many times. There are three main looping controls.looping controls.  THETHE--WHILEWHILE--DO LOOPDO LOOP  REPEAT.UNTIL LOOPREPEAT.UNTIL LOOP  The FOR LOOPThe FOR LOOP ----- ### THETHE--WHILEWHILE--DO LOOPDO LOOP  This repetitive structure tests the condition This repetitive structure tests the condition first before executing the successful code first before executing the successful code if and only if the Boolean expression if and only if the Boolean expression returns a true value.returns a true value. ***Example*** To withdraw money using an ATM a To withdraw money using an ATM a customer must have a balance in his/her customer must have a balance in his/her account.account. ----- General format of THEGeneral format of THE--WHILE DO LOOPWHILE DO LOOP ***FlowchartFlowchart*** ***General formatGeneral format*** While <condition> DoWhile <condition> Do StatementStatement End whileEnd while ***Pseudo code segmentPseudo code segment*** While balance >0 doWhile balance >0 do Withdraw cashWithdraw cash Update accountUpdate account End whileEnd while |Col1|Withdraw cash update account| |---|---| ||| ----- ### REPEAT.UNTIL LOOPREPEAT.UNTIL LOOP  In this structure the code is executed before In this structure the code is executed before testing the condition. The repeat loop stops testing the condition. The repeat loop stops when the Boolean statement returns a value. For when the Boolean statement returns a value. For example in the case of ATM discussed above example in the case of ATM discussed above the client can withdraw money until balance is the client can withdraw money until balance is zero.zero. ***Example*** Pseudo code segment.Pseudo code segment. REPEATREPEAT Withdraw cashWithdraw cash Update accountUpdate account < Until balance Until balance <0;0; ----- General format of REPEATUNTIL LOOPGeneral format of REPEATUNTIL LOOP ***Flow chartFlow chart*** ***General formatGeneral format*** REPEATREPEAT StatementStatement UNTIL <condition>UNTIL <condition>Exit loop ----- ### The FOR LOOPThe FOR LOOP  This structure is used where execution of This structure is used where execution of the chosen statements has to be repeated the chosen statements has to be repeated a predetermined number of times. For a predetermined number of times. For example if a program is to calculate the example if a program is to calculate the sum of ten numbers provided by the user. sum of ten numbers provided by the user. The FOR LOOP can be used to prompt The FOR LOOP can be used to prompt the user to enter the 10 numbers at most the user to enter the 10 numbers at most ten times. Once the numbers are entered ten times. Once the numbers are entered the program calculates and displays the the program calculates and displays the sum.sum. ----- ### Pseudo code of the FOR LOOPPseudo code of the FOR LOOP ***Pseudo codePseudo code*** FORFOR count = 1 to 10 DOcount = 1 to 10 DO writeln Enter a number (N)writeln Enter a number (N) ReadlnReadln NN Sum = sum + NSum = sum + N End FOREnd FOR Display SumDisplay Sum The counter has to be set to a start value and The counter has to be set to a start value and sometimes to an end value.sometimes to an end value. ----- #### General format of the FOR LOOPGeneral format of the FOR LOOP ***General formatGeneral format*** 1.1. format for the FOR LOOP that counts from lower limit.format for the FOR LOOP that counts from lower limit. **For loop variables = lower limit To upper limit DoFor loop variables = lower limit To upper limit Do** **StatementsStatements** **EndForEndFor** 2.2. Format for the For loop that counts from upper limit Format for the For loop that counts from upper limit down to lower limitdown to lower limit **For loop variable = Upper limit Down To Lower For loop variable = Upper limit Down To Lower** **Limit DoLimit Do** **StatementsStatements** **EndForEndFor** ----- Flowchart for a For Loop that counts upwardFlowchart for a For Loop that counts upwardCondition? |Col1|o.ke/| |---|---| ||Teacher.co| |https:// Lower limit = Loop Visit variable + 1 Papers st|| ----- Flowchart for a For Loop that counts downwardsFlowchart for a For Loop that counts downwardsCondition? |Col1|o.ke/| |---|---| ||Teacher.co| |https:// Upper limit = Loop Visit variable - 1 Papers st|| ----- #### Examples of complex pseudo codes 1Examples of complex pseudo codes 1  Ushirika Society pays 5% interest on shares Ushirika Society pays 5% interest on shares exceeding Kshs 10,000 and 3% on shares that exceeding Kshs 10,000 and 3% on shares that do not meet this target. However no interest is do not meet this target. However no interest is paid on deposits in the members bank account. paid on deposits in the members bank account. Design a pseudo code for a program that Design a pseudo code for a program that would:would: a.a. Prompt the user for shares and deposit of a Prompt the user for shares and deposit of a particular member.particular member. b.b. Calculate the interest and total savings.Calculate the interest and total savings. c.c. Display the interest and total savings on the screen Display the interest and total savings on the screen for a particular member.for a particular member. ----- ### Pseudo code of examples 1Pseudo code of examples 1 ***Pseudo codePseudo code*** StartStart Input Name, share, DepositInput Name, share, Deposit If share > 10000 THENIf share > 10000 THEN Interest = 0.05*sharesInterest = 0.05*shares ELSEELSE Interest=0.03*sharesInterest=0.03*shares EndifEndif Total savings = deposits + Interest + sharesTotal savings = deposits + Interest + shares Print Name, Totalsaving, InterestPrint Name, Totalsaving, Interest StopStop ----- ### Flowchart of example 1Flowchart of example 1 ----- #### Examples of complex pseudo codes 2Examples of complex pseudo codes 2  Botswana has a population of 3,000,000 Botswana has a population of 3,000,000 but this is falling by 4% each year. The but this is falling by 4% each year. The island of Reunion has a population of island of Reunion has a population of 95,000 but this is increasing by 9% each 95,000 but this is increasing by 9% each year.year. a.a. Draw a flowchart that predicts the year in Draw a flowchart that predicts the year in which the population of reunion will be which the population of reunion will be greater than that of Botswana if the trend greater than that of Botswana if the trend continues.continues. ----- ### Solution of example 2Solution of example 2 ----- ### Pseudo code of example 2Pseudo code of example 2 ***Pseud*** ***o*** ***code*** StartStart Bts: = 3,000,000Bts: = 3,000,000 1R: = 95,0001R: = 95,000 Year: = 0Year: = 0 REPEATREPEAT Bts = Bts Bts = Bts -- (Bts * (4 / 100))(Bts * (4 / 100)) 1R = 1R + (1R * (9 / 100))1R = 1R + (1R * (9 / 100)) Year = year + 1Year = year + 1 UNTIL 1R > BtsUNTIL 1R > Bts Print yearPrint year StopStop ----- #### Examples of complex pseudo codes 3Examples of complex pseudo codes 3  Write a program that will allow the input of name of Write a program that will allow the input of name of student marks obtained in 5 subjects (maths, English, student marks obtained in 5 subjects (maths, English, Kiswahili, computer, biology). The program should Kiswahili, computer, biology). The program should calculate the total and average marks for each student calculate the total and average marks for each student and assign the grades depending on the average marks and assign the grades depending on the average marks obtained as follows.obtained as follows. 80 80  100100 AA 70 70  7979 BB 60 60  6969 CC 50 50  5959 DD Below 50Below 50 EE The program should then display each students name, The program should then display each students name, total marks and average grade.total marks and average grade. ----- ### Pseudo code of example 3Pseudo code of example 3 ***Pseudo codePseudo code*** STARTSTART REPEATREPEAT Print Enter name and subject marksPrint Enter name and subject marks Input Name, maths, English, Kiswahili, Input Name, maths, English, Kiswahili, G> G< If (AV If (AVG >60) AND (AV 60) AND (AVG <69) THEN69) THEN Grade = CGrade = C G> G< If (AV If (AVG >50) AND (AV 50) AND (AVG <59) THEN59) THEN Grade = DGrade = D ELSEELSE Grade = EGrade = E EndifEndif EndifEndif EndifEndif EndifEndif Print Name, Sum, AVG, GradePrint Name, Sum, AVG, Grade Until count = Number of studentsUntil count = Number of students StopStop Computer, BiologyComputer, Biology Sum =Sum = Maths + English + Kiswahili + Maths + English + Kiswahili + Computer + BiologyComputer + Biology AVG = sum / 5AVG = sum / 5 G> G< If (AV If (AVG >80) AND (AV 80) AND (AVG <100) THEN100) THEN Grade = AGrade = A G> G< If (AV If (AVG >70) AND (AV 70) AND (AVG <79) THEN79) THEN Grade = BGrade = B ----- ### Flowchart of example 3Flowchart of example 3 ----- ### Practical activity 1Practical activity 1--11 1.1. Open a text editor program on your computer like NotePad or Open a text editor program on your computer like NotePad or WordPad.WordPad. 2.2. Type the following program exactly the way it is in the editor.Type the following program exactly the way it is in the editor. <HTML><HTML> <HEAD><TITLE>This is my first a webpage</TITLE></HEAD><HEAD><TITLE>This is my first a webpage</TITLE></HEAD> <BODY bgcolor = red><BODY bgcolor = red> <H1><CENTER><B>Hello World</B></CENTER></H1><H1><CENTER><B>Hello World</B></CENTER></H1> </BODY></BODY> </HTML></HTML> 3.3. Save your work as webpage.html on the desktop. Make sure Save your work as webpage.html on the desktop. Make sure that the that the *Save As TypeSave As Type* box reads All Files before clicking the box reads All Files before clicking the save button in order to avoid saving a text file with two save button in order to avoid saving a text file with two extensions i.e. webpage.html.txt.extensions i.e. webpage.html.txt. ----- ### Practical activity 1Practical activity 1--22 4.4. Close your text editor. Notice Close your text editor. Notice that your file on the desktop that your file on the desktop has the icon of the default web has the icon of the default web browser installed on your browser installed on your computer. Double click it to computer. Double click it to view the web page! Figure right view the web page! Figure right shows a sample of the display shows a sample of the display expected when the file is expected when the file is loaded to the browser. If you loaded to the browser. If you have a colour monitor, it should have a colour monitor, it should look as below only that it will look as below only that it will have black bold text on a red have black bold text on a red background!background! 5.5. Check your program and Check your program and change your background to change your background to blue, save then click the blue, save then click the refresh button. What happens?refresh button. What happens? ----- ### Review questions 1Review questions 1 1.1. Define the term computer program.Define the term computer program. 2.2. What is programming?What is programming? 3.3. State three advantages of high level languages over low level languages.State three advantages of high level languages over low level languages. 4.4. List four examples of languages and for each, state its most appropriate List four examples of languages and for each, state its most appropriate application area.application area. 5.5. Why is an executable file unique when compared to any other file?Why is an executable file unique when compared to any other file? 6.6. Differentiate between a compiler and an interpreter. Why did early Differentiate between a compiler and an interpreter. Why did early computers work well with interpreters?computers work well with interpreters? 7.7. List the various examples of programming languages per generation.List the various examples of programming languages per generation. 8.8. State one advantage of machine language over the other languages.State one advantage of machine language over the other languages. 9.9. Write the following in fullWrite the following in full A)A) HTMLHTML B)B) OOPOOP 10.10. Distinguish between source program and object code in programming.Distinguish between source program and object code in programming. 11.11. Define the term encapsulation as used in object oriented programming.Define the term encapsulation as used in object oriented programming. ----- ### Answer of review questions 1Answer of review questions 1--11 1.1. A computer program is a set of instructions that directs a computer on how A computer program is a set of instructions that directs a computer on how to process a particular task.to process a particular task. 2.2. Programming is the writing of computer programs.Programming is the writing of computer programs. 3.3. A). Easier to learn and use.A). Easier to learn and use. B). Portable.B). Portable. C). Flexible.C). Flexible. D). Easier to correct errors.D). Easier to correct errors. 4.4. A). FORTRAN A). FORTRAN  used for developing business oriented programs.used for developing business oriented programs. B). COBOL B). COBOL  designed for developing business oriented programs.designed for developing business oriented programs. C). Pascal C). Pascal  mostly used as a teaching tool in structured programming.mostly used as a teaching tool in structured programming. D). C D). C  mostly used to create system software such as operating systems.mostly used to create system software such as operating systems. E). Ada E). Ada  suitable for developing realsuitable for developing real--time and industrial systems.time and industrial systems. 5.5. It is the main file that is used to start the program.It is the main file that is used to start the program. 6.6. A complier translates the entire source program into machine readable form A complier translates the entire source program into machine readable form while an interpreter translates the source program to machine language linewhile an interpreter translates the source program to machine language line-byby--line. Interpreters were used on early computers due to memory line. Interpreters were used on early computers due to memory limitations.limitations. ----- ### Answer of review questions 1Answer of review questions 1--22 7.7. A). First generation A). First generation  machine languages.machine languages. B). Second generation B). Second generation  assembly languages.assembly languages. C). Third generation C). Third generation  Pascal, C, COBOL, BASIC, FOTRAN, Ada Pascal, C, COBOL, BASIC, FOTRAN, Ada etc.etc. D). Fourth generation D). Fourth generation  Visual Basic, Delphi Pascal, Visual COBOL Visual Basic, Delphi Pascal, Visual COBOL etc.etc. E). Fifth generation languages E). Fifth generation languages  PROLOG, Mercury, LISP, OCCAM PROLOG, Mercury, LISP, OCCAM etc.etc. 8.8. A). The processor executes them faster.A). The processor executes them faster. B). They are more stable.B). They are more stable. 9.9. A). HTML A). HTML  Hypertext Markup Language.Hypertext Markup Language. B). OOP B). OOP  Object Oriented Programming languageObject Oriented Programming language 10.10. Source program refers to a program that is not yet translated while Source program refers to a program that is not yet translated while object code refers to the program code that is in machine readable object code refers to the program code that is in machine readable form.form. 11.11. Encapsulation refers to the process of joining data and instruction Encapsulation refers to the process of joining data and instruction together to form an object.together to form an object. ----- ### Review questions 2Review questions 2 1.1. Give one advantage of compiling a program Give one advantage of compiling a program rather than interpreting it.rather than interpreting it. 2.2. Outline at least six stages of program Outline at least six stages of program development in their respective order.development in their respective order. 3.3. Highlight two advantages of monolithic programs.Highlight two advantages of monolithic programs. 4.4. State two advantages of modular programming.State two advantages of modular programming. 5.5. In what stage of the development does program In what stage of the development does program documentation fall? Justify your answer.documentation fall? Justify your answer. 6.6. Differentiate between a flowchart and pseudocode.Differentiate between a flowchart and pseudocode. 7.7. What is a program bug?What is a program bug? 8.8. Explain why it is important to test a program Explain why it is important to test a program before implementing it.before implementing it. ----- ### Answer of review questions 2Answer of review questions 2--11 1.1. A). Interpreters translate the source program one statement at a A). Interpreters translate the source program one statement at a time while compilers translate the entire source code at once before time while compilers translate the entire source code at once before execution.execution. B). Interpreters translate the program each time it runs hence B). Interpreters translate the program each time it runs hence slower than compiling. Compiled programs can be saved on a slower than compiling. Compiled programs can be saved on a storage media. This means that it does not require any further storage media. This means that it does not require any further transaction every time the program is run hence executes faster transaction every time the program is run hence executes faster than interpreted programs.than interpreted programs. C). Interpreters translation takes less memory while compiled C). Interpreters translation takes less memory while compiled programs require more memory as the object code files are larger.programs require more memory as the object code files are larger. 2.2. A). Problem recognition.A). Problem recognition. B). Problem definition.B). Problem definition. C). Program design.C). Program design. D). Program coding.D). Program coding. E). Program testing and debugging.E). Program testing and debugging. F). Implementation.F). Implementation. ----- ### Answer of review questions 2Answer of review questions 2--11 3.3. A). They are difficult to test and debug.A). They are difficult to test and debug. B). They are difficult to modify or upgrade.B). They are difficult to modify or upgrade. 4.4. A). They are easy to test and debug.A). They are easy to test and debug. B). They are easy to modify and upgrade.B). They are easy to modify and upgrade. 5.5. Documentation is done at all stages of program Documentation is done at all stages of program development.development. 6.6. A flowchart is a graphical representation of stepA flowchart is a graphical representation of step--byby-step processing logic of a program while a pseudocode step processing logic of a program while a pseudocode is a set of structuredis a set of structured--English like statements that English like statements that describe the stepdescribe the step--byby--step processing logic of a program.step processing logic of a program. 7.7. Bugs refers to program errors.Bugs refers to program errors. 8.8. To correct any syntax or logical errors.To correct any syntax or logical errors. ----- ### Review questions 3Review questions 3 1.1. State the factors you would consider whenState the factors you would consider when A)A) Writing a pseudocodeWriting a pseudocode B)B) Drawing a flowchartDrawing a flowchart 2.2. Using illustrations, explain at least six symbols used in Using illustrations, explain at least six symbols used in flowchart design.flowchart design. 3.3. Give one advantage of pseudocodes over flowcharts.Give one advantage of pseudocodes over flowcharts. 4.4. Write a pseudocode for a program that would be used Write a pseudocode for a program that would be used to solve the equationto solve the equation E = MCE = MC [22] 5.5. Draw a flowchart that would be used to classify animals Draw a flowchart that would be used to classify animals according to sex. If a letter M is input the program according to sex. If a letter M is input the program should display Male otherwise it should display should display Male otherwise it should display Female.Female. ----- ### Answer of review questions 3Answer of review questions 3--11 1.1. A). PseudocodeA). Pseudocode 1). Statements must be short 1). Statements must be short and clear.and clear. 2). Statements should be 2). Statements should be unambiguous.unambiguous. 3). Should shoe start and stop.3). Should shoe start and stop. 4). Words used should be 4). Words used should be suggestive such as READ, suggestive such as READ, PRINT, OUTPUT etc.PRINT, OUTPUT etc. B). FlowchartB). Flowchart 1). A flowchart should have 1). A flowchart should have one entry and one exit point.one entry and one exit point. 2). Use correct symbols.2). Use correct symbols. 3). The flow should be clearly 3). The flow should be clearly indicated using arrows.indicated using arrows. 2.2. Decision Decision  used to represent used to represent a decision construct.a decision construct. Connector Connector  connects logic connects logic flows.flows. Process Process  indicates a indicates a transformation of data.transformation of data. Input/output Input/output  shows shows program input/output.program input/output. Ellipse Ellipse  indicates start/stop indicates start/stop of algorithm.of algorithm. ----- ### Answer of review questions 3Answer of review questions 3--22 3.3. Pseudocodes are Pseudocodes are easier to write and easier to write and understand.understand. 4.4. StartStart Enter values form Enter values form M and CM and C E=M*C*CE=M*C*C Display EDisplay E StopStop ----- ### Review questions 4Review questions 4 1.1. Define the term selection in relation to program Define the term selection in relation to program control structures.control structures. 2.2. State three types of control structures used in State three types of control structures used in programming.programming. 3.3. Differentiate between looping and selection.Differentiate between looping and selection. 4.4. In what circumstance does looping depend on In what circumstance does looping depend on decision?decision? 5.5. List four selection controls used in writing a List four selection controls used in writing a program.program. ----- ### Answer of review questions 4Answer of review questions 4 1.1. Selection refers to a situation where further program execution Selection refers to a situation where further program execution depend one making a decision from two more alternatives.depend one making a decision from two more alternatives. 2.2. Sequence, decision and iteration.Sequence, decision and iteration. 3.3. Looping refers to a situation where the same block of code is Looping refers to a situation where the same block of code is executed repeatedly until a certain condition is fulfilled, while executed repeatedly until a certain condition is fulfilled, while selection refers to a situation where further program execution selection refers to a situation where further program execution depends on making a decision from two or more alternatives.depends on making a decision from two or more alternatives. 4.4. Looping may depend on decision if a condition has to be met Looping may depend on decision if a condition has to be met before the looping terminates or continues.before the looping terminates or continues. 5.5. A). IFTHENA). IFTHEN B). IF.THENELSEB). IF.THENELSE C). Nested IFC). Nested IF D). CaseD). Case ----- ### Revision questions 1Revision questions 1 1.1. State three reasons why high level languages are better than low level State three reasons why high level languages are better than low level languages.languages. 2.2. Explain why HTML is not true programming language.Explain why HTML is not true programming language. 3.3. List three examples of forth generation programming languages.List three examples of forth generation programming languages. 4.4. Describe the term structured programming.Describe the term structured programming. 5.5. Define the term structured programming.Define the term structured programming. 6.6. A). State two reasons for documenting all the stages of program A). State two reasons for documenting all the stages of program development.development. B). Give three types of program documentation in reference to B). Give three types of program documentation in reference to programming.programming. 7.7. Write HTML code that would display a green background, with the words Write HTML code that would display a green background, with the words Hello on the screen.Hello on the screen. 8.8. Draw a flowchart showing the general flow of the following:Draw a flowchart showing the general flow of the following: A)A) The nested IF selection.The nested IF selection. B)B) The FOR loop.The FOR loop. C)C) REPEAT.UNTIL loop.REPEAT.UNTIL loop. ----- #### Answer of revision questions 1Answer of revision questions 1--11 1.1. A). They are portableA). They are portable B). They are user friendlyB). They are user friendly C). They are more flexibleC). They are more flexible D). They are easier to debugD). They are easier to debug 2.2. HTML is not a true programming language because it does not have HTML is not a true programming language because it does not have a true format of a programming language. For example, it does not a true format of a programming language. For example, it does not have a declaration part and control structures.have a declaration part and control structures. 3.3. A). Visual BasicA). Visual Basic B). Delphi PascalB). Delphi Pascal C). Visual COBOLC). Visual COBOL 4.4. Fifth generation programming languages are designed in a way that Fifth generation programming languages are designed in a way that enables programmers design programs that emulate human enables programmers design programs that emulate human intelligence.intelligence. 5.5. In structured programming, a program is broken down into In structured programming, a program is broken down into components called modules each performing a particular task.components called modules each performing a particular task. ----- #### Answer of revision questions 1Answer of revision questions 1--22 6.6. A). Reasons for documenting A). Reasons for documenting i.i. There may rise a need to revise or modify it.There may rise a need to revise or modify it. ii.ii. Other people may think of ways of improving your program by Other people may think of ways of improving your program by studying at the documentation.studying at the documentation. B). B). Types of documentationTypes of documentation i.i. UserUser--oriented.oriented. ii.ii. OperatorOperator--oriented.oriented. iii.iii. ProgrammerProgrammer--oriented.oriented. 7.7. <HTML><HTML> <HEAD><TITLE>Hello program </TITLE></HEAD><HEAD><TITLE>Hello program </TITLE></HEAD> <BODY bgcolour = blue><BODY bgcolour = blue> <H3><CENTRE><B>Hello</B></CENTER></H3><H3><CENTRE><B>Hello</B></CENTER></H3> </BODY></BODY> </HTML></HTML> ----- #### Answer of revision questions 1Answer of revision questions 1--33 ----- #### Answer of revision questions 1Answer of revision questions 1--44 ----- ### Revision questions 2Revision questions 2 1.1. Write a program algorithm that would enable the user Write a program algorithm that would enable the user to enter student marks. The program should then to enter student marks. The program should then determine whether the mark entered is a pass or fail determine whether the mark entered is a pass or fail given that the pass mark is 50.given that the pass mark is 50. 2.2. Draw a flowchart for a program that is to prompt for N Draw a flowchart for a program that is to prompt for N numbers, accumulate the sum and then find the numbers, accumulate the sum and then find the average. The output is the accumulated totals and the average. The output is the accumulated totals and the average.average. 3.3. Write a pseudocode that reads temperature for each Write a pseudocode that reads temperature for each day in a week, in degree Celsius, converts the Celsius day in a week, in degree Celsius, converts the Celsius into Fahrenheit's and then calculate the average into Fahrenheit's and then calculate the average weekly temperatures. The program should output the weekly temperatures. The program should output the calculated average in degrees Fahrenheit's.calculated average in degrees Fahrenheit's. ----- #### Answer of revision questions 2Answer of revision questions 2--11 ----- #### Answer of revision questions 2Answer of revision questions 2--22 3.3. STARTSTART Input temperature in Input temperature in  et initial day to 0et initial day to 0 WHILE initial day 6 DOWHILE initial day 6 DO Input temperature in Input temperature in  F=32+(9C/5)F=32+(9C/5) Initial day=initial day + 1Initial day=initial day + 1 Cummulative = cummulative + FCummulative = cummulative + F END WHILEEND WHILE Average weekly temperatureAverage weekly temperature = cummulative/7= cummulative/7 Print AveragePrint Average STOPSTOP ----- ### Revision questions 3Revision questions 3 1.1. A lady deposits 2,000 shillings in a Microfinance A lady deposits 2,000 shillings in a Microfinance company at an interest rate of 20% per annum. At the company at an interest rate of 20% per annum. At the end of each year, the interest earned is added to the end of each year, the interest earned is added to the deposit and the new amount becomes the deposit for deposit and the new amount becomes the deposit for that year. Write an algorithm for a program that would that year. Write an algorithm for a program that would track the growth of the deposits over a period of seven track the growth of the deposits over a period of seven years.years. 2.2. Mukumu took a loan of Ksh 400,000 from a local bank Mukumu took a loan of Ksh 400,000 from a local bank at an interest rate of 10% payable in four years. at an interest rate of 10% payable in four years. Assuming you wish to develop a computer program Assuming you wish to develop a computer program that will keep track of monthly repayments:that will keep track of monthly repayments: A)A) Identify the input, processing and output Identify the input, processing and output requirements for such a program.requirements for such a program. B)B) Design the algorithm for the program using a simple Design the algorithm for the program using a simple flowchart and pseudocode.flowchart and pseudocode. ----- #### Answer of revision questions 3Answer of revision questions 3--11 1.1. STARTSTART Input initial depositInput initial deposit Input interest rateInput interest rate Set deposit to initial depositSet deposit to initial deposit Set year to 0Set year to 0 < WHILE year WHILE year < 7 DO7 DO Interest = Deposit * interest rateInterest = Deposit * interest rate Total = Deposit + interestTotal = Deposit + interest Deposit = TotalDeposit = Total Year = Year + 1Year = Year + 1 END WHILEEND WHILE PRINT Deposit, YearPRINT Deposit, Year STOPSTOP ----- #### Answer of revision questions 3Answer of revision questions 3--22 2.2. A). A). Inputs Inputs  initial amount borrowedinitial amount borrowed -- Interest rateInterest rate -- Number of yearsNumber of years Processing Processing  the equation to calculate the equation to calculate monthly repayments.monthly repayments. Output Output  monthly repayments calculated monthly repayments calculated by the processby the process ----- #### Answer of revision questions 3Answer of revision questions 3--33 2.2. B). B). STARTSTART Input initial loan borrowedInput initial loan borrowed Input interest rateInput interest rate Input number of yearsInput number of years Calculate yearly Calculate yearly repaymentsrepayments Monthly repaymentsMonthly repayments = yearly repayments/12= yearly repayments/12 Display monthly Display monthly repaymentsrepayments STOPSTOP ----- 289289 ----- ### A systemA system  Is a set of items linked together to carry Is a set of items linked together to carry out a given task in order to achieve one or out a given task in order to achieve one or more objectives. A system is described as more objectives. A system is described as being either soft or hard.being either soft or hard. ----- ### Soft systems and hard systemsSoft systems and hard systems  Soft systems Soft systems  human activity are said to be human activity are said to be soft systems. They are said to be soft soft systems. They are said to be soft because:because:  Their boundaries may be fluid or keep on changing.Their boundaries may be fluid or keep on changing.  Their goals and objectives conflict.Their goals and objectives conflict.  Its difficult to precisely define exact measures of Its difficult to precisely define exact measures of performance for them.performance for them.  Hard systems Hard systems  these are systems whose these are systems whose goals and objectives are clearly defined and goals and objectives are clearly defined and the outcomes from the systems processes are the outcomes from the systems processes are predictable and can be modeled accurately.predictable and can be modeled accurately. ----- ### System classificationSystem classification  Deterministic system Deterministic system  these are systems whose these are systems whose output are known precisely by their inputs e.g. a output are known precisely by their inputs e.g. a computer system.computer system.  Probabilistic system Probabilistic system  these are systems whose these are systems whose output can only be predicted but not knows output can only be predicted but not knows precisely e.g. business and economic system precisely e.g. business and economic system organisation.organisation.  Cybernetic systems Cybernetic systems  these are self controlling these are self controlling systems which adapt to the environment and systems which adapt to the environment and regulate their own behaviour by accessing the regulate their own behaviour by accessing the feedback. They access their output and adjust feedback. They access their output and adjust the input e.g. human beings, plants systemsthe input e.g. human beings, plants systems ----- ### Characteristic of systemsCharacteristic of systems 1.1. Holistic thinkingHolistic thinking 2.2. Sub systemsSub systems 3.3. ProcessorProcessor 4.4. Objectives/purposeObjectives/purpose 5.5. EnvironmentEnvironment 6.6. BoundariesBoundaries 7.7. InterdependenceInterdependence 8.8. FeedbackFeedback 9.9. ControlControl 10.10. Inputs and OutputsInputs and Outputs 11.11. System EntropySystem Entropy ----- #### Holistic thinking and sub systemsHolistic thinking and sub systems  Holistic thinking Holistic thinking  in this, a system is considered in this, a system is considered as a whole. A combination of various as a whole. A combination of various components that makes up a system creates a components that makes up a system creates a complex whole whose overall goals are more complex whole whose overall goals are more sophisticated than those of the individual sophisticated than those of the individual components.components.  Sub systems Sub systems  a system is made up of different a system is made up of different components (subsystem). Therefore a system components (subsystem). Therefore a system does not exist in solitude but it may be a does not exist in solitude but it may be a component of a large system.component of a large system. ----- #### Processor and objectives/purposeProcessor and objectives/purpose  Processor Processor  this is an element of a system this is an element of a system that does the actual transformation of input that does the actual transformation of input into output.into output.  Objectives/purpose Objectives/purpose  objectives of a objectives of a system may be real or stated. An system may be real or stated. An organization should state one objective organization should state one objective and operate to achieve another user must and operate to achieve another user must know the major objective of a system.know the major objective of a system. ----- ### Environment and boundariesEnvironment and boundaries  Environment Environment  the environment is the the environment is the system within an organisation operates. system within an organisation operates. Environment provides a reason for the Environment provides a reason for the existence of the system.existence of the system.  Boundaries Boundaries  system boundaries are the system boundaries are the external element whose changes in external element whose changes in attitudes, behaviour and property affect attitudes, behaviour and property affect their state and are affected respectively i.e. their state and are affected respectively i.e. its the limit of system.its the limit of system. ----- ### Interdependence and feedbackInterdependence and feedback  Interdependence Interdependence  for a system to be for a system to be effective and efficient, its components or effective and efficient, its components or subsystems must be coordinated and subsystems must be coordinated and linked together.linked together.  Feedback Feedback  a feedback is a check within a a feedback is a check within a system to see whether predetermined system to see whether predetermined goals are being met. The checks are goals are being met. The checks are conducted on a system to determine conducted on a system to determine deviation.deviation. ----- ### Control and inputs and outputsControl and inputs and outputs  Control Control  this is the this is the process by which the process by which the system adapts to system adapts to changes in the changes in the environment in order to environment in order to give the expected level.give the expected level.  Inputs and outputs Inputs and outputs  a a system communicates system communicates with its environment by with its environment by receiving inputs and receiving inputs and giving outputs.giving outputs. ----- ### System EntropySystem Entropy  Entropy means decay. System decay Entropy means decay. System decay naturally over time, hence it slowly naturally over time, hence it slowly becomes useless to the user either due to becomes useless to the user either due to improvement in technology, new improvement in technology, new management or change in user management or change in user requirements. Therefore it must be requirements. Therefore it must be reviewed in order to improve it or develop reviewed in order to improve it or develop a new one.a new one. ----- ### Open and closed systemOpen and closed system  An open system receives input from and An open system receives input from and gives output to the environment while a gives output to the environment while a closed system does not interact with the closed system does not interact with the environment.environment. ----- ### Information systemInformation system  This is a set of persons, procedures and This is a set of persons, procedures and technologies and other resources that technologies and other resources that collects, transforms and disseminates collects, transforms and disseminates information in the system e.g. organisation.information in the system e.g. organisation. ----- ### Purpose of information systemPurpose of information system  To provide the people within an To provide the people within an organisation with information to assist in organisation with information to assist in decision making process.decision making process.  To provide responsive service to meet To provide responsive service to meet user needs.user needs.  To enable sharing of information.To enable sharing of information.  To facilitate interaction and dissemination To facilitate interaction and dissemination of data throughout the various level of of data throughout the various level of organisation.organisation. ----- #### Why develop new information system?Why develop new information system?  New changes in organisation New changes in organisation  management management can introduce new changes, and they have to be can introduce new changes, and they have to be implement to meet the needs of the organisation.implement to meet the needs of the organisation.  Problems in the current system Problems in the current system  the the undesirable circumstances in the current system undesirable circumstances in the current system that prevent the organisation from meeting its that prevent the organisation from meeting its goal.goal.  New opportunities New opportunities  if an opportunity presents if an opportunity presents itself that can enable the organisations improve itself that can enable the organisations improve its services.its services. ----- #### Theories of system developmentTheories of system development  The most common theories include:The most common theories include:  Traditional Approach.Traditional Approach.  Rapid Application Development (RAD).Rapid Application Development (RAD).  The Structured Approach.The Structured Approach. ----- ### Traditional ApproachTraditional Approach  This approach relies mostly on the skills This approach relies mostly on the skills and experience of individual staff and experience of individual staff members carrying out of the project. In this members carrying out of the project. In this approach, the manual system is replaced approach, the manual system is replaced with a computerized one without change in with a computerized one without change in overall structure of the former system. overall structure of the former system. Hence the weakness of the former system Hence the weakness of the former system are not addressed, they are forwarded to are not addressed, they are forwarded to the new system.the new system. ----- #### Rapid Application Development (RAD)Rapid Application Development (RAD)  RAD model evolved from the theory that RAD model evolved from the theory that business today heavily rely on information business today heavily rely on information technology, hence, development and technology, hence, development and implementation of information system implementation of information system needs to be quick enough for the needs to be quick enough for the organisation to maintain a competitive organisation to maintain a competitive advantage in the market place.advantage in the market place. ----- ### Structured ApproachStructured Approach  In this approach a system development In this approach a system development defines a set of stages that should be defines a set of stages that should be followed when developing a system.followed when developing a system. ----- ### Stage of system developmentStage of system development  Problem recognition Problem recognition and definitionand definition  Information gatheringInformation gathering  Requirements Requirements specificationspecification  System designSystem design  System constructionSystem construction  System System implementationimplementation ----- #### Problem recognition and definitionProblem recognition and definition  Problem recognition is the initial stage where the analyst Problem recognition is the initial stage where the analyst decides if the project is really necessary to look into, and if its decides if the project is really necessary to look into, and if its necessary to start a new project. In problem definition, the necessary to start a new project. In problem definition, the problem must be thoroughly defined. A through survey of the problem must be thoroughly defined. A through survey of the problem is undertaken by identifying the problem, problem is undertaken by identifying the problem, understanding it, and finding out of there is a possibility of understanding it, and finding out of there is a possibility of getting a solution. Before a new system is designed, a special getting a solution. Before a new system is designed, a special study will be carried out to establish the costs and benefits of a study will be carried out to establish the costs and benefits of a new system. The study is called new system. The study is called **feasibility study.feasibility study.** Feasibility Feasibility study of a system is accessed in four ways.study of a system is accessed in four ways.  Operational feasibilityOperational feasibility  Technical feasibilityTechnical feasibility  Economic feasibilityEconomic feasibility  Schedule feasibilitySchedule feasibility ----- Operational feasibility and technical feasibilityOperational feasibility and technical feasibility  Operational feasibility Operational feasibility  this establishes this establishes the extend to which the users are the extend to which the users are comfortable or happy with the proposed or comfortable or happy with the proposed or new system.new system.  Technical feasibility Technical feasibility  this establishes this establishes whether the technology available is whether the technology available is sufficient or can be upgraded for the new sufficient or can be upgraded for the new system.system. ----- Economic feasibility and schedule feasibilityEconomic feasibility and schedule feasibility  Economic feasibility Economic feasibility  it establishes it establishes whether the technology available is whether the technology available is sufficient or can be upgraded for the new sufficient or can be upgraded for the new system.system.  Schedule feasibility Schedule feasibility  it establishes it establishes whether the development of the proposed whether the development of the proposed system will be accomplished within the system will be accomplished within the available time.available time. ----- ### Information gatheringInformation gathering  The system analyst gathers data about the The system analyst gathers data about the current system and the users needs from current system and the users needs from both internal and external sources. Some both internal and external sources. Some of the methods used to collect or gather of the methods used to collect or gather data include:data include:  Record inspectionRecord inspection  InterviewInterview  QuestionnairesQuestionnaires ----- ### Record inspection and interviewRecord inspection and interview  The documents maintained The documents maintained in connection to the system in connection to the system are referenced. This forms a are referenced. This forms a good starting point for the good starting point for the analyst to gain an overall analyst to gain an overall insight of the existing system.insight of the existing system.  Interview Interview  this is a face to this is a face to face communication between face communication between the analysts as the the analysts as the interviewer and the affected interviewer and the affected personnel as interviewee. personnel as interviewee. The questions are geared to The questions are geared to getting the information getting the information needed by the analysts.needed by the analysts. ----- ### Advantages of interviewAdvantages of interview  The analysts is accessible to first class The analysts is accessible to first class information.information.  Make interviewee feel as part of the Make interviewee feel as part of the system.system.  Give adequate opportunity for interviewee, Give adequate opportunity for interviewee, an opportunity to put forward opinions.an opportunity to put forward opinions. ----- ### Disadvantages of interviewDisadvantages of interview  Make the interviewee feel they are being Make the interviewee feel they are being summoned by the analysts.summoned by the analysts.  Some interviewees give answers which Some interviewees give answers which are not actually proven facts but opinions.are not actually proven facts but opinions.  The interviewee may not fully open on The interviewee may not fully open on some issues that may be personal.some issues that may be personal.  The interviewee may be suspicious of the The interviewee may be suspicious of the intentions of the proposed system for fear intentions of the proposed system for fear of being displaced by new system.of being displaced by new system. ----- ### Questionnaires Questionnaires  A questionnaire is a A questionnaire is a document containing a document containing a number of standard number of standard questions set to be asked questions set to be asked to a larger number of to a larger number of people in order to gather people in order to gather information from them. The information from them. The analyst is able to collect analyst is able to collect information from several information from several key people in the key people in the organisation who may be organisation who may be affected by the current affected by the current proposed system.proposed system. ----- ### When the use questionnaireWhen the use questionnaire  When limited amount of information is When limited amount of information is required from a large number of people.required from a large number of people.  There is a large number of people involved There is a large number of people involved in the system project.in the system project.  The people you need to gather information The people you need to gather information from are vastly despersed.from are vastly despersed. ----- ### Advantages of questionnairesAdvantages of questionnaires  Answers filled in less tense environment.Answers filled in less tense environment.  Since they are filled and returned in Since they are filled and returned in privacy, more sincere responses are privacy, more sincere responses are possible.possible.  Questionnaire provides many people with Questionnaire provides many people with the opportunity to provide input and the opportunity to provide input and suggestion.suggestion.  Questionnaire saves time especially where Questionnaire saves time especially where respondents are geographically scattered.respondents are geographically scattered. ----- #### Disadvantages of questionnairesDisadvantages of questionnaires  Its a slow way of facts gathering.Its a slow way of facts gathering.  Designing questionnaires requires Designing questionnaires requires expertise.expertise.  Some questions can be easily Some questions can be easily misunderstood hence ambiguous replies misunderstood hence ambiguous replies will be received.will be received.  Analysis of questionnaires requires a lot of Analysis of questionnaires requires a lot of time.time. ----- ### Observation Observation  This requires the observer to participate or This requires the observer to participate or watch closely as a person performs watch closely as a person performs activities in order to learn about the activities in order to learn about the system. This method gives the analysts system. This method gives the analysts first hand experience about the problems first hand experience about the problems and expenses to the system requirements.and expenses to the system requirements. ----- ### Advantages of observationAdvantages of observation  Concepts that are too difficult for nonConcepts that are too difficult for non- technical staff to explain can be observed.technical staff to explain can be observed.  It helps the analysts become acquainted It helps the analysts become acquainted with operational personnel.with operational personnel.  It helps the analysts acquire know how It helps the analysts acquire know how needed to assist in changes that have needed to assist in changes that have been recommended.been recommended.  Can correct hazy understanding or Can correct hazy understanding or erroneous impressions.erroneous impressions. ----- ### Disadvantages of observationDisadvantages of observation  Its costly and time consuming.Its costly and time consuming.  Staff members are not comfortable when Staff members are not comfortable when they are being watched.they are being watched. ----- ### Automated methodAutomated method  This is mostly used when actual data is This is mostly used when actual data is required but difficult to get through required but difficult to get through interviews, observation or questionnaires. interviews, observation or questionnaires. Such data is collected using devices that Such data is collected using devices that automatically capture data from the source. automatically capture data from the source. E.g. video, cameras, tape recorders etc.E.g. video, cameras, tape recorders etc. ----- ### Requirements specificationRequirements specification  The system analyst must come with the The system analyst must come with the detailed requirements for the new system. detailed requirements for the new system. The requirements specifications include:The requirements specifications include:  Output specificationOutput specification  Input specificationInput specification  File/data storesFile/data stores  Hardware and software requirementsHardware and software requirements ----- ### Output specificationOutput specification  The output specifications entails activities The output specifications entails activities like generation of reports used to facilitate like generation of reports used to facilitate decision making. The output can be in the decision making. The output can be in the form of reports either in hardcopy or form of reports either in hardcopy or softcopy. The quality of those reports is softcopy. The quality of those reports is important. Formality of reports is important important. Formality of reports is important so that good quality reports are produced so that good quality reports are produced for easy understanding.for easy understanding. ----- ### Input specificationInput specification  The input to the system in necessary The input to the system in necessary because the contents of the input are used because the contents of the input are used to maintain the master files. The following to maintain the master files. The following should be considered in input specification.should be considered in input specification.  The contents and volume of input.The contents and volume of input.  The mode and devices of input selected.The mode and devices of input selected.  Layout and sequence of input.Layout and sequence of input. ----- ### File/data storesFile/data stores  File requirement involves making an File requirement involves making an informed decision on file required to store informed decision on file required to store data and information in the system. The data and information in the system. The analyst should identify the number of files analyst should identify the number of files that will be needed by the system and that will be needed by the system and determine the structure of each file.determine the structure of each file. ----- #### Hardware and software requirementsHardware and software requirements  System analyst should specify all System analyst should specify all hardware and software requirements for hardware and software requirements for the new system. He/she should consider:the new system. He/she should consider:  Economic factors e.g. priceEconomic factors e.g. price  Operational factors e.g. reliabilityOperational factors e.g. reliability  User friendliness.User friendliness. ----- ### System designSystem design  This involves detailing the physical design This involves detailing the physical design of the system, its the how of the process. of the system, its the how of the process. Once the logical design is put lined during Once the logical design is put lined during system analysis, the analyst determines system analysis, the analyst determines the physical design, which describes the the physical design, which describes the hardware, software and operating hardware, software and operating procedures required to make system procedures required to make system operational. Several tools are used for operational. Several tools are used for designing an information system. designing an information system. Examples are flowchart, data flow diagram, Examples are flowchart, data flow diagram, requirements.requirements. ----- ### System constructionSystem construction  This refers to coding, installation and This refers to coding, installation and testing of the modules and their testing of the modules and their components such as outputs, inputs and components such as outputs, inputs and files. The purpose of the construction is to files. The purpose of the construction is to develop and test a functional system that develop and test a functional system that fulfills the business and design fulfills the business and design requirements.requirements. ----- ### Testing the systemTesting the system  The system is tested by entering some The system is tested by entering some test data to find out whether its output are test data to find out whether its output are as expected. The system is tested using as expected. The system is tested using the requirements specifications and the the requirements specifications and the design specification to find out whether it design specification to find out whether it meets all requirements specified.meets all requirements specified. ----- ### System implementation System implementation  This involves installing the system in the This involves installing the system in the users computers, testing the installed users computers, testing the installed system, converting from old system to the system, converting from old system to the new one and training the users. System new one and training the users. System implementation involves:implementation involves:  File creation and conversion.File creation and conversion.  Change over.Change over.  Staff trainingStaff training ----- ### File creation and conversionFile creation and conversion  This involves setting up of the master files This involves setting up of the master files that are to be used in the support of the that are to be used in the support of the new system. The setting can be either new system. The setting can be either from scratch or just to convert the files that from scratch or just to convert the files that were employed in old system.were employed in old system. ----- ### Training staffTraining staff  The training aim at:The training aim at:  Convincing the staff of the user department Convincing the staff of the user department on the effectiveness of the new system.on the effectiveness of the new system.  Remove fear of change from them.Remove fear of change from them.  Enabling the staff to cope with processing Enabling the staff to cope with processing task of the new system.task of the new system. ----- ### Methods of trainingMethods of training  DemonstrationDemonstration  Film showFilm show  Manual referenceManual reference  Group discussionGroup discussion  VisitsVisits ----- ### Changeover Changeover  This is the process of changing over from This is the process of changing over from old system to the new system.old system to the new system.  Type of changeoverType of changeover  Direct changeoverDirect changeover  Parallel changeoverParallel changeover  Phase changeoverPhase changeover ----- ### Direct changeoverDirect changeover  In this approach the new system commence live In this approach the new system commence live operation and immediately the old system is operation and immediately the old system is abandoned.abandoned.  Advantage of direct changeoverAdvantage of direct changeover  Its a cheap methodIts a cheap method  Disadvantages of direct changeoverDisadvantages of direct changeover  Extremely riskyExtremely risky  Places an organization in a do or die situation.Places an organization in a do or die situation. ----- ### Parallel changeoverParallel changeover  In this changeover the operation of the old In this changeover the operation of the old system and the new system run alongside each system and the new system run alongside each other.other.  Advantages of parallel changeoverAdvantages of parallel changeover  Provides a method of training in the new system.Provides a method of training in the new system.  Personnel become familiar with the new system prior Personnel become familiar with the new system prior to actual changeover.to actual changeover.  Disadvantages of parallel changeoverDisadvantages of parallel changeover  Costly to run two systemsCostly to run two systems  Cross checking is difficultCross checking is difficult  Requires more staff hence more training required for Requires more staff hence more training required for additional staffadditional staff ----- ### Phase changeoverPhase changeover  In this approach implementation is done only In this approach implementation is done only one part of the new system at one time or a step one part of the new system at one time or a step by step.by step.  Advantages of phase changeoverAdvantages of phase changeover  Allow the system to be implemented quicklyAllow the system to be implemented quickly  Less costlyLess costly  Failures of the system are limitedFailures of the system are limited  Causes minimal disruptionCauses minimal disruption  Disadvantage of phase changeoverDisadvantage of phase changeover  Problems on ensuring that the first phase is Problems on ensuring that the first phase is implemented and converted.implemented and converted. ----- #### System review and maintenanceSystem review and maintenance  System maintenance is the adjustment System maintenance is the adjustment and enhancement or correction of errors and enhancement or correction of errors after the system has been implemented. after the system has been implemented. The reviewing involves going through the The reviewing involves going through the specification and testing the system after specification and testing the system after implementation to find out whether it still implementation to find out whether it still meets the original specification.meets the original specification. ----- #### System documentation consists ofSystem documentation consists of  Report of fact finding which outlines methods used to collect data, Report of fact finding which outlines methods used to collect data, weakness of the current system and recommendation of the current weakness of the current system and recommendation of the current system.system.  Requirements specification which entails the output requirements, input, Requirements specification which entails the output requirements, input, hardware and software required for the new system.hardware and software required for the new system.  System flowchart which shows the overall functionality of te proposed System flowchart which shows the overall functionality of te proposed information system.information system.  Tables or file structures depending on the approach used in system Tables or file structures depending on the approach used in system construction.construction.  Sample test data to test whether the new computerized information Sample test data to test whether the new computerized information system is working as expected.system is working as expected.  User manual which helps the user work with the new system with User manual which helps the user work with the new system with minimal guidance. The manual contains information likeminimal guidance. The manual contains information like  How to install, start the systemHow to install, start the system  The interface of the systemThe interface of the system  How to carry out various tasksHow to carry out various tasks  Error correction and how to get helpError correction and how to get help ----- ### Review questions 1Review questions 1 1.1. Define the term information system.Define the term information system. 2.2. Differentiate between soft systems and hard Differentiate between soft systems and hard systems.systems. 3.3. List five characteristics of a system.List five characteristics of a system. 4.4. What is system control?What is system control? 5.5. Why do we need feedback in a system?Why do we need feedback in a system? 6.6. Explain the tem system boundary.Explain the tem system boundary. 7.7. State and explain three purposes of information State and explain three purposes of information systems in organisations.systems in organisations. 8.8. Define the term online analytical processing?Define the term online analytical processing? 9.9. Draw a well labelled diagram that depicts a Draw a well labelled diagram that depicts a system that is controlled through feedback.system that is controlled through feedback. ----- ### Answer of review questions 1Answer of review questions 1--11 1.1. An information system is the arrangement of people, data, An information system is the arrangement of people, data, processes and information that work together to support and processes and information that work together to support and improve the dayimprove the day--toto--day business operations.day business operations. 2.2. In soft systems, goals are not clearly defined unlike in hard systemsIn soft systems, goals are not clearly defined unlike in hard systems.. 3.3. A). Holistic thinkingA). Holistic thinking B). Subsystems.B). Subsystems. C). Boundary and environment.C). Boundary and environment. D). Purpose.D). Purpose. E). Process.E). Process. F). System entropy.F). System entropy. G). Inputs and outputs.G). Inputs and outputs. H). Open and closed systems.H). Open and closed systems. I). ControlI). Control 4.4. A system control is a method by which a system adapts to changes A system control is a method by which a system adapts to changes in the environment in order to give the expected output or perform at in the environment in order to give the expected output or perform at the expected level.the expected level. ----- ### Answer of review questions 1Answer of review questions 1--22 5.5. Feedback is needed in order Feedback is needed in order to adjust controls for better to adjust controls for better performance of the system.performance of the system. 6.6. System boundary is the System boundary is the scope within which a system scope within which a system component operates.component operates. 7.7. A). Supports information A). Supports information processing tasks.processing tasks. B). Supports decision making.B). Supports decision making. C). Supports sharing of C). Supports sharing of information.information. 8.8. Online analytical processing Online analytical processing is whereby a computer based is whereby a computer based ----- ### Review questions 2Review questions 2 1.1. Explain three system development theories and methods.Explain three system development theories and methods. 2.2. State the main disadvantage of Rapid Application Development State the main disadvantage of Rapid Application Development method.method. 3.3. Define the term system development lifecycle.Define the term system development lifecycle. 4.4. At what stage does the system change hands from the development At what stage does the system change hands from the development stage to the users.stage to the users. 5.5. Highlight three circumstances that necessitate the development of Highlight three circumstances that necessitate the development of new information systems.new information systems. 6.6. Define the term feasibility study as used in system development.Define the term feasibility study as used in system development. 7.7. State four methods that can be used to gather information during State four methods that can be used to gather information during system development.system development. 8.8. State two advantages of interview over questionnaires.State two advantages of interview over questionnaires. 9.9. State two disadvantages of interview method when used for State two disadvantages of interview method when used for information gathering.information gathering. 10.10. Give one example of automated information gathering technique.Give one example of automated information gathering technique. ----- ### Answer of review questions 2Answer of review questions 2--11 1.1. A). Traditional approach.A). Traditional approach. B). Rapid Application B). Rapid Application Development (RAD)Development (RAD) C). Structure approach.C). Structure approach. 2.2. The main disadvantage of The main disadvantage of RAD is that the system may RAD is that the system may be weak due to quick be weak due to quick development.development. 3.3. System development life System development life cycle refers to the steps cycle refers to the steps followed in developing a followed in developing a system for conception to system for conception to review and maintenance.review and maintenance. 4.4. At the implementation stage.At the implementation stage. 5.5. A). New opportunities.A). New opportunities. B). ProblemsB). Problems C). Directives.C). Directives. 6.6. Feasibility study is a special Feasibility study is a special study carried out to establish study carried out to establish the costs and benefits of a the costs and benefits of a new system.new system. 7.7. A). InterviewsA). Interviews B). QuestionnairesB). Questionnaires C). ObservationC). Observation D). Study of available D). Study of available documents.documents. E). Automated methods.E). Automated methods. ----- ### Answer of review questions 2Answer of review questions 2--22 8.8. A). NonA). Non--verbal communication can be used or verbal communication can be used or observed.observed. B). Questions can be rephrased for clarity.B). Questions can be rephrased for clarity. 9.9. A). It is difficult to organise for an interview due A). It is difficult to organise for an interview due to time constraint.to time constraint. B). The interviewee may not fully open up B). The interviewee may not fully open up some sensitive issues due to security concern.some sensitive issues due to security concern. 10.10. An example of automated information gathering An example of automated information gathering technique is the use of a video camera to technique is the use of a video camera to compare motion pictures.compare motion pictures. ----- ### Review questions 3Review questions 3 1.1. Outline the four areas that are considered Outline the four areas that are considered during the requirements specification stage.during the requirements specification stage. 2.2. Explain at least three factors that should be put Explain at least three factors that should be put into consideration during output design.into consideration during output design. 3.3. State four factors that may be considered in State four factors that may be considered in order to design a good file.order to design a good file. 4.4. Explain why it is important to consider file Explain why it is important to consider file backup and recovery strategies during file backup and recovery strategies during file design.design. ----- ### Answer of review questions 3Answer of review questions 3 1.1. A). OutputA). Output B). InputB). Input C). FilesC). Files D). Hardware and D). Hardware and software requirements.software requirements. 2.2. A). Target i.e. the A). Target i.e. the audience.audience. B). Frequency of report B). Frequency of report generationgeneration C). Quality and formatC). Quality and format 3.3. A). Record key fieldA). Record key field B). Type of dataB). Type of data C). Length of each fieldC). Length of each field D). Backup and recovery D). Backup and recovery strategies.strategies. 4.4. Back up and recovery Back up and recovery strategy helps in making strategy helps in making sure that if the current sure that if the current file gets corrupted, it is file gets corrupted, it is possible to reconstruct possible to reconstruct the original file.the original file. ----- ### Revision questions 1Revision questions 1 1.1. Outline seven steps followed in structured system Outline seven steps followed in structured system development.development. 2.2. Explain three tasks that are carried out during system Explain three tasks that are carried out during system implementation.implementation. 3.3. Outline three disadvantages of questionnaires.Outline three disadvantages of questionnaires. 4.4. Explain the concept of proxemics in interviews.Explain the concept of proxemics in interviews. 5.5. Give an advantages of straight changeover over parallel Give an advantages of straight changeover over parallel changeover.changeover. 6.6. Define the term file conversion.Define the term file conversion. 7.7. Differentiate between a system flowchart and a program Differentiate between a system flowchart and a program flowchart.flowchart. 8.8. Draw four system flowchart symbols and explain their Draw four system flowchart symbols and explain their functions.functions. ----- #### Answer of revision questions 1Answer of revision questions 1--11 1.1. A). Problem recognition and A). Problem recognition and definition.definition. B). Requirement B). Requirement specification.specification. C). System design.C). System design. D). System construction.D). System construction. E). System implementation.E). System implementation. F). System review and F). System review and maintenance.maintenance. 2.2. A). File conversions.A). File conversions. B). Staff training.B). Staff training. C). Project management.C). Project management. D). ChangeoverD). Changeover 3.3. A). Good questionnaires A). Good questionnaires are difficult to prepare.are difficult to prepare. B). The respondent may B). The respondent may not understand some not understand some questions.questions. C). The respondent has C). The respondent has the final say on when to the final say on when to fill and return the fill and return the questionnaire. Most of questionnaire. Most of them end up not being them end up not being filled or returned hence it filled or returned hence it is disadvantageous to is disadvantageous to the researcher.the researcher. ----- #### Answer of revision questions 1Answer of revision questions 1--22 4.4. Proxemics refer to issues Proxemics refer to issues related to physical contact related to physical contact such as sitting arrangement such as sitting arrangement during an interview.during an interview. 5.5. Straight changeover is Straight changeover is cheaper to implement than cheaper to implement than parallel changeover.parallel changeover. 6.6. File conversion refers to File conversion refers to changing files from one format changing files from one format to another.to another. 7.7. A system flowchart is for the A system flowchart is for the entire system while a program entire system while a program flowchart is for a part or a flowchart is for a part or a module in the system. module in the system. Therefore, several program Therefore, several program flowcharts may be derived flowcharts may be derived from a single system flowchart.from a single system flowchart. ----- ### Revision questions 2Revision questions 2 1.1. Define the term attribute.Define the term attribute. 2.2. Explain the importance of using automated methods in Explain the importance of using automated methods in fact finding.fact finding. 3.3. Why is observation sometimes disadvantageous when Why is observation sometimes disadvantageous when used in fact finding?used in fact finding? 4.4. State one of the disadvantages of the traditional State one of the disadvantages of the traditional approach in system development.approach in system development. 5.5. Outline the factors that should be considered when Outline the factors that should be considered when sourcing for hardware and software resources required sourcing for hardware and software resources required for a new system.for a new system. 6.6. Outline some of the contents of a user manual that Outline some of the contents of a user manual that would help the user run the system with minimal would help the user run the system with minimal guidance.guidance. ----- ### Answer of revision questions 2Answer of revision questions 2 1.1. Entity attributes refer to characteristics of a particular entity.Entity attributes refer to characteristics of a particular entity. 2.2. Automated methods of data collection can be used in areas which Automated methods of data collection can be used in areas which are not easily accessible.are not easily accessible. 3.3. A). The person being observed might alter his or her behaviour.A). The person being observed might alter his or her behaviour. B). It may be time consuming.B). It may be time consuming. 4.4. The weaknesses of the former system are not addressed.The weaknesses of the former system are not addressed. 5.5. A). Economic factors.A). Economic factors. B). Operational.B). Operational. C). Services from the vendor.C). Services from the vendor. 6.6. A). Installation procedures.A). Installation procedures. B). User interface.B). User interface. C). How to carry out various tasks.C). How to carry out various tasks. D). Test data and expected outputD). Test data and expected output E). Troubleshooting guideE). Troubleshooting guide ----- ### Practical exercise 1Practical exercise 1  Extract the book Extract the book return module return module flowchart from the flowchart from the system flowchart system flowchart depicted in figure right.depicted in figure right. ----- 356356 -----