Sie sind auf Seite 1von 5

DEPT OF COMPUTER SCIENCE NIGER STATE POLYTECHNIC, ZUNGERU.

ND 2 SEMESTER SPECIAL-SIT EXAMINATIONS, 2011/2012 SESSION COURSE: COM 113 INTRODUCTION TO COMPUTER PROGRAMMING PROGRAMME: ND 1 COMPUTER SCIENCE TIME ALLOWED: 2 HOURS INSTRUCTIONS: ANSWER QUESTION 1 AND ANY OTHER THREE (3) QUESTIONS. 1. Supply the appropriate answer(s) for the blank(s) in each of the following statements i. Computer process data under the control of a set of instructions called ___________ ii. A(n) ________________ is a formula or a set of steps for solving a particular problem. iii. The process of instructing the computer to solve a problem is called___________. iv. ________________ is a symbol that is used when a flowchart ends on one page and continues on the next page. v. All programs (or algorithms) can be written in terms of three types of control structures: _____________, ___________________ and ____________________. vi. A program flowchart indicates the ___________ to be performed and the _____________ in which they occur. vii. ______________ is the programming step during which algorithms are converted to computer programs. Viii __________ is a way of expressing algorithms in a form that can be executed by a computer. Ix. An error in a computer program is called a __________________________. x. _________________ is a program in machine-executable form. xi. ___________________ is a set of computer programs. xii. ____________________ is the process of removing errors from a computer program (15 marks) 2(a) Draw, name and state the functions of seven (7) flowchart symbols that you know. (7 marks) (b) Name one main purpose, three (3) main advantages, and two (2) main disadvantages, of using flowchart. (3 marks) (c) Given the hair-shampooing algorithm below, you are required to draw a flowchart to represent it:
1

1. Wet hair 2. Set value of washCount to 0 3. Repeat steps 3.1 through 3.3 until the value of washCount equals 4 3.1 Lather hair 3.2 Rinse hair 3.3 Add 1 to the value of washCount 4. Stop (5 marks)

3(a) Consider carefully each of the statements below, and indicate whether it is true or false. If a statement is false, explain briefly why it is false. i. ii. Program in machine-executable form is called pseudocode An algorithm is a procedure for solving a problem in terms of action to be executed and the order in which these actions are to be executed. iii. Pseudocode is a programming language that programmers use in writing programs. iv. A selection structure specifies that an action or actions is/are to be repeated. v. Coding a program comes before designing the algorithm. Computers understand machine language. (5 marks) (b) The following flowchart prints a set of number on the screen. Look carefully at the flowchart and then answer the questions below. The flowchart symbols have been labeled with a letter of the alphabet for easy referencing
a b c
Start

vi.

COUNT = 10

Display COUNT

d e
COUNT =0

COUNT = COUNT -1

branch1

branch2 f
STOP 2

i. ii. iii. iv. v.

Which symbol(s)represent(s) processing step? (2 mark) What is symbol e called? (1 mark) Which number is displayed on the screen first and which last.? Explain how you arrived at your answer. (4 marks) What is symbol a called? (1 mark) State what value (i.e. true or false) will be given to branch1and branch2. (2 marks)

4(a) What do you understand by the term algorithm? (2 marks) (b) Write a brief history of the origin of the term algorithm. (2 marks) (c) Explain briefly two (2) benefits of high level programming language over assembly language (2 marks) (d) Develop an algorithm that accepts any two numbers and displays the sum, difference, product and average of the two numbers. Show your problem analysis and explain your design. (9 marks)

5 (a) Mention five essential features that an algorithm should possess (5 marks) (b) Name two (2) differences and two (2) similarities between machine language and assembly language. (4 marks) (c) Develop an algorithm that computes the sum of the first ten positive integers (That is 1+2+3.+10). Show your problem analysis, and explain your design. (6 marks)

6(a) Explain fully the procedure for developing useful computer programs. (5marks) (b) Develop an algorithm in pseudocode that makes the computer to accept three data values X, Y, Z as input and outputs the biggest and the average of the three values. (5 marks) (c) Draw a flowchart of the algorithm you have designed in question 6(b) marks) (5

A store wishes to program a decision on non-cash receipts for goods into their intelligent tills. The conditions to check are agreed as:
4

1. Transaction under 50 2. Pays by cheque with cheque card (guarantee 50) 3. Pays by credit card The possible actions that a cashier could take are agreed as: 1. Ring up sale 2. Check credit card from local database 3. Call a supervisor 4. Automatic check of credit card company database Using the rules above construct a decision table showing all possible combinations of alternatives.
if driver.age < 20 and driver.has training then driver.eligible = true if driver.age < 20 and driver.has training = false then driver.eligible = false if driver.age >= 20 then driver.eligible = true (do not care about training for this case)

Das könnte Ihnen auch gefallen