Pseudocode and Flowchart-Computer Fundamentals and Programming-Assignment Solution, Exercises of Computer Engineering and Programming

Kapish Gupta assigned this task at Assam Don Bosco University. Submission of the task was not acceptable after due date. Assignment is related to Computer Fundamentals and Programming. It includes: Pseudocode, Flowchart, Programming, Language, Descriptions, Systematic, , Standard, Form, Program, Design

Typology: Exercises

2011/2012

Uploaded on 07/28/2012

dewansh
dewansh 🇮🇳

4.4

(10)

89 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
Q#1: What is Pseudocode and Flowchart?
Pseudocode:
``*`*`*`*`*`*`*`*`*``
Pseudocode is a programming analysis tool, which is used for planning
program logic. “Pseudo” means false, and “Code” refers to the instructions
written in a programming language. These pseudo-instructions are phrases
written in ordinary natural language.
Pseudocode is a compact and informal high-level description of a computer
programming algorithm that uses the structural conventions of programming
languages, but omits detailed variable declarations or language-specific
syntax.
The programming language is augmented with natural
language descriptions of the details, where convenient.
There is no systematic standard form, pseudocode generally
does not obey the syntax rules of any particular language.
Pseudocode is oftenly used in description of algorithms, so that
all programmers can understand them.
Pseudocode uses a structure which resembles computer
instructions, instead of using symbols to describe the logic
steps of a program.
Since, pseudocode emphasizes the design of the program, it is
also called Program Design Language (PDL).
Example of Pseudocode:
``*`*`*`*`*`*`*`*`*`*`*`*`*`*`*`*`*``
Problem: The input data of each student for the examination also contains
information regarding sex of the candidate in the field named Sexcode, which
can have values M (for male) or F (for female). We want to make a list of only
those female students who have passed in second division (obtained marks
between 45% to 60%). In the end we want to print out the total number of
such students. If the input data of all the students is terminated by a trailer
record, which has a sentinel value of Z for Sexcode, write the pseudocode.
docsity.com
pf3
pf4
pf5

Partial preview of the text

Download Pseudocode and Flowchart-Computer Fundamentals and Programming-Assignment Solution and more Exercises Computer Engineering and Programming in PDF only on Docsity!

Q#1: What is Pseudocode and Flowchart?

Pseudocode:

*`*`*`*`*`*`*`*`*

Pseudocode is a programming analysis tool, which is used for planning program logic. “Pseudo” means false, and “Code” refers to the instructions written in a programming language. These pseudo-instructions are phrases written in ordinary natural language.

Pseudocode is a compact and informal high-level description of a computer programming algorithm that uses the structural conventions of programming languages, but omits detailed variable declarations or language-specific syntax.

The programming language is augmented with natural language descriptions of the details, where convenient.

There is no systematic standard form, pseudocode generally does not obey the syntax rules of any particular language.

Pseudocode is oftenly used in description of algorithms, so that all programmers can understand them.

Pseudocode uses a structure which resembles computer instructions, instead of using symbols to describe the logic steps of a program.

Since, pseudocode emphasizes the design of the program, it is also called Program Design Language (PDL).

Example of Pseudocode:

*`*`*`*`*`*`*`*`*`*`*`*`*`*`*`*`*

Problem: The input data of each student for the examination also contains

information regarding sex of the candidate in the field named Sexcode, which can have values M (for male) or F (for female). We want to make a list of only those female students who have passed in second division (obtained marks between 45% to 60%). In the end we want to print out the total number of such students. If the input data of all the students is terminated by a trailer record, which has a sentinel value of Z for Sexcode, write the pseudocode.

Pseudocode:

Flowchart:

*`*`*`*`*`*`*`*

A flowchart is a pictorial representation of an algorithm. A flowchart is a schematic representation of an algorithm. It uses boxes of different shapes to denote different types of instuctions. These boxes are connected by solid lines having narrow marks to indicate the flow of operation.

Flow chart is often used by programmers as a program planning tool for organizing a sequence of steps necessary to solve a problem by a computer. The process of drawing a flowchart for an algorithm is oftenly reffered to as flowcharting. In program writing, while drawing a flowchart, a programmer is not concerned with the syntax. Hence he/she can concentrate on the logic of the program. A flowchart often serves as a document for the computer program.

Example of Flowchart:

*`*`*`*`*`*`*`*`*`*`*`*`*`*`*

Problem: Draw a flowchart of the logical steps needed to compute factorial

N (N!) where N! = 1 * 2 * 3 *….N.

Set Count to zero Read first student record DO WHILE Sexcode is not equal to Z IF Sexcode = F THEN Calculate Percentage IF Percentage => 45 THEN IF Percentage =< 60 THEN Write output data Add 1 to Count END IF Read next student record ENDDO Write Count Stop

Most programming languages require the programmer to declare the data type of every data object, and most database systems require the user to specify the type of each data field. A data type describes representation, interpretation and structure of values manipulated by algorithms or objects stored in computer memory or other storage device.

There are three basic types of data in C. These are:

int Integer

float Real Values

char Characters

The Integer Type Data:

*`*`*`*`*`*`*`*`*`*`*`*`*`*`*

Integer type data can be stored in several different ways providing more or fewer significant digits and also offering the option of storing them without a sign.

Format:

An integer is a whole number, i.e. a number without a fraction or decimal point. It may have a positive or a negative value. For example, 601, 250, - and 501 are integers.

Space:

The range of values of int data type depends upon the computer system being used and it takes two or four bytes. In MS DOS, an integer type variable takes two bytes in the memory and the range of values stored is from -32768 to 32767.

The maximum and minimum values for integer data types are specified in integer.h header file. The minimum integer value is defined by INT_MIN and maximum integer value is defined by INT_MAX.

The integer type data can store integer values of different ranges. These ranges vary depending on the type of integer data which can be an int, short int, long int or unsigned int.

The Float Type Data:

*`*`*`*`*`*`*`*`*`*`*`*`*`*

Floating point numbers provide a way of storing very large and very small numbers including fractions. There are often several different ways of storing floating point numbers offering a choice of precision or number of significant digits. High precision storage of floating point numbers uses up more computer memory and results in slower arithmetic.

Format:

The float data is represented in decimal or exponential form. It may be signed or unsigned. It is a real type data. For example, 23.26, 16.21, 0.56, -9.87 are floating type data.

Space:

The float type data takes four bytes in the memory and it can store real values from 3.4x10-38^ to 3.4x10^38. It is accurate up to 6 decimal places.

The maximum and minimum values for float data types are specified in float.h header file. The minimum float value is defined by FLT_MIN and maximum float value is defined by FLT_MAX.

The Character Type Data:

*`*`*`*`*`*`*`*`*`*`*`*`*`*`*`*

Finally the character data type provides a way of storing and manipulating the internal codes that represent the symbols that appear on output devices and the symbols that are engraved on keyboard key tops.

Arithmetic operations can also be performed on char type variables.

Format:

Character type data consists of alphabetic characters, numeric digits and special characters.

Space:

A single character takes 8 bits or one byte in the memory. The maximum and minimum values for character data types are specified in the header file. The minimum char value is defined by CHAR_MIN and maximum char value is defined by CHAR_MAX.