Subject: Computer Science
During programming analysis and system design, the programmers, system engineers and system designers work together to build a successful program or a computer-based information system. Various ideas, components and program modules are integrated to accomplish the task.
System analysts and designers perform the following tasks during these steps.
The programming tools give the idea how the flow should take place in order to accomplish a task. Several programming tools are used in this context. Some of the most common programming tools are:
Pseudo code is a combination of two words: Pseudo and Code. 'Pseudo' means imitation and 'code' refer to instruction written in the programming language. Pseudo code is not a real programming code. It is the generic way of describing an algorithm without using any specific programming language-related notations.
Source: www.slideshare.net
The features of pseudocode are:
The pseudo code cannot be compiled. It cannot be executed and there are no real formatting or syntax rules for writing pseudo codes.
It is simply an important step in producing the final code. Some important terms used in pseudo code for different activities are:
The two major constructions in pseudo code structures are: Sequence and Selection (decision). Sequence indicates the continuous flow of the program, whereas selection uses logical comparison or conditional check for making decisions.
Example:
…………… IF (condition> THEN List of Actions ELSE List of Different Actions END IF ……………… ………………… |
Example:
READ A, B, AND C IF A is greater than C THEN DISPLAY A ELSE DISPLAY C END IF ELSE IF B is greater than C THEN DISPLAY B ELSE DISPLAY C END IF END IF STOP |
Example:
INITIALIZE Count to zero DO WHILE Count is greater than or equal to 10 ADD 1 to Count PRINT Count ENDDO STOP |
Advantages of Pseudo code:
Disadvantages of Pseudo code:
An algorithm is defined as a finite sequence of explicit instructions that produces an output with the set of input values. The steps in the algorithm are never ambiguous. It terminates after a finite number of steps.
Source:www.brandxindustries.com
Algorithms can have repetitions and logical decisions until a specific task is completed. Algorithms are not computer programs. They cannot be executed by the computer.
Properties of Algorithm
An algorithm must have the following properties.
Example: Write an algorithm to make a telephone call.
Step 1: Remember or read the telephone number. Step 2: Lift the receiver Step 3: Is there a dial tone? If yes, then dial telephone, go to step 4. { If no, then put down the receiver. Go to step 2} Step 4: Speak Step 5: Put down the receiver. |
Example: Write an algorithm to find the largest number among three input numbers.
Step 1: Start Step 2: Read 3 numbers say: A, B, C Step 3: Find the largest number between A and B and store it in MAXAB Step 4: Find the largest number between MAXAB and C and store it in MAX Step 5: Display MAX Step 6: Stop |
Write the algorithm to calculate the interest on principle amount in N number of Years.
Step 1: Start Step 2: Read principle, Rate and Time Step 3: Multiply principle * Rate * Time Step 4: Divide by 100 Step 5: Write the answer Step 6: Any more calculations? { If yes, then go to step 2 If No } Step 7: Stop |
Write algorithm to calculate the total and average marks of 10 students for 7 subjects.
Step 1: Start Step 2: Subject = 1 Step 3: Input mark for this Subject Step 4: Add marks and store into a variable Step 5: Are all subjects (7 subjects) done? { If No, then increase the subject number and go to step 3. If yes, then go to step 6 Step 6: Print the sum Step 7: Find average (divide by 7) Step 8: Print the sum and average Step 9: Are all (10 students done)? { If No, then increase the student number and go to step 2 If yes, then go to step 9} Step 9: End |
References:
Khanal, R.C. Khanal, R.C. Computer Concept for XII. Pashupatigriha Marga, Thapathali, Kathmandu, Nepal: Ekta Books Distributors Pvt. Ltd., 2010. 117-123.
Adhikari, Deepak Kumar.,et.al., Computer Science XII,Asia Publication Pvt.Ltd
© 2019-20 Kullabs. All Rights Reserved.