PST UnitV
PST UnitV
PST UnitV
DFD is the abbreviation for Data Flow Diagram. The flow of data of a system or a process is
represented by DFD.
It also gives insight into the inputs and outputs of each entity and the process itself. DFD does
not have control flow and no loops or decision rules are present. Specific operations depending
on the type of data can be explained by a flowchart.
It is a graphical tool, useful for communicating with users ,managers and other personnel. it is
useful for analyzing existing as well as proposed system.
It provides an overview of
What data is system processes.
What transformation are performed.
What data are stored.
What results are produced , etc.
Characteristics of DFD
DFDs are commonly used during problem analysis.
DFDs are quite general and are not limited to problem analysis for software requirements
specification.
DFDs are very useful in understanding a system and can be effectively used during analysis.
It views a system as a function that transforms the inputs into desired outputs.
The DFD aims to capture the transformations that take place within a system to the input
data so that eventually the output data is produced.
The processes are shown by named circles and data flows are represented by named arrows
entering or leaving the bubbles.
A rectangle represents a source or sink and it is a net originator or consumer of data. A
source sink is typically outside the main system of study.
Levels of DFD
DFD uses hierarchy to maintain transparency thus multilevel DFD’s can be created. Levels of
DFD are as follows:
0-level DFD: It represents the entire system as a single bubble and provides an overall
picture of the system.
1-level DFD: It represents the main functions of the system and how they interact with each
other.
2-level DFD: It represents the processes within each function of the system and how they
interact with each other.
3-level DFD: It represents the data flow within each process and how the data is
transformed and stored.
Advantages of DFD
It helps us to understand the functioning and the limits of a system.
It is a graphical representation which is very easy to understand as it helps visualize
contents.
Data Flow Diagram represent detailed and well explained diagram of system components.
It is used as the part of system documentation file.
Data Flow Diagrams can be understood by both technical or nontechnical person because
they are very easy to understand.
Disadvantages of DFD
At times DFD can confuse the programmers regarding the system.
Data Flow Diagram takes long time to be generated, and many times due to this reasons
analysts are denied permission to work on it.
DFD Level 0 is also called a Context Diagram. It’s a basic overview of the whole system or
process being analyzed or modeled. It’s designed to be an at-a-glance view, showing the
system as a single high-level process, with its relationship to external entities. It should be
easily understood by a wide audience, including stakeholders, business analysts, data analysts
and developers.
DFD Level 1 provides a more detailed breakout of pieces of the Context Level Diagram. You
will highlight the main functions carried out by the system, as you break down the high-level
process of the Context Diagram into its subprocesses.
DFD Level 2 then goes one step deeper into parts of Level 1. It may require more text to reach
the necessary level of detail about the system’s functioning.
Progression to Levels 3, 4 and beyond is possible, but going beyond Level 3 is uncommon.
Doing so can create complexity that makes it difficult to communicate, compare or model
effectively.
MODULE
A module is defined as a part of a software program that contains one or more routines. When
we merge one or more modules, it makes up a program.
Whenever a product is built on an enterprise level, it is a built-in module, and each module
performs different operations and business.
Modules are implemented in the program through interfaces. The introduction of modularity
allowed programmers to reuse prewritten code with new applications. Modules are created and
merged with compilers, in which each module performs a business or routine operation within
the program.
For example - SAP(System, Applications, and Products) comprises large modules like finance,
payroll, supply chain, etc. In terms of softwares example of a module is Microsoft Word which
uses Microsoft paint to help users create drawings and paintings.
SUBPROGRAMS
A subprogram is defined as a set of statements that can be reused at multiple places in a program
when convenient. This reuse results in multiple types of savings, from memory space to coding
time. Such reuse is also an abstraction, for the analysis of subprograms computations are restored
in a program by a statement that calls the subprogram.
Features of Subprograms
Types of Subprograms
Value parameters
The value parameters copy the actual value of an argument into the formal parameter of the
function. In this case, changes made to the parameter inside the function have no effect on the
argument.
This is the default mechanism for passing parameters to a method. In this mechanism, when a
method is called, a new storage location is created for each value parameter.
The values of the actual parameters are copied into them. Hence, the changes made to the
parameter inside the method have no effect on the argument.
Reference Parameters
SCOPE OF VARIABLE
A variable is only available from inside the region it is created. This is called scope.
Local Scope
A variable created inside a function belongs to the local scope of that function, and can only be
used inside that function.
Example
def myfunc():
x = 300
print(x)
myfunc()
output:
300
Global Scope
A variable created in the main body of the Python code is a global variable and belongs to the
global scope.
Global variables are available from within any scope, global and local.
Example
x = 300
def myfunc():
print(x)
myfunc()
print(x)
Output
300
300
FUNCTIONS
Types of Functions
1. Library Functions: are the functions which are declared in the C header files such as
scanf(), printf(), gets(), puts(), ceil(), floor() etc.
2. User-defined functions: are the functions which are created by the C programmer, so
that he/she can use it many times. It reduces the complexity of a big program and
optimizes the code.
o Function call Function can be called from anywhere in the program. The parameter list
must not differ in function calling and function declaration. We must pass the same
number of functions as it is declared in the function declaration.
o Function definition It contains the actual statements which are to be executed. It is the
most important aspect to which the control comes when the function is called. Here, we
must notice that only one value can be returned from the function.
RECURSION
Recursion is the technique of making a function call itself. This technique provides a way to
break complicated problems down into simple problems which are easier to solve.
Example:
void recursion() {
recursion(); /* function calls itself */
}
int main() {
recursion();
}
Number Factorial
The following example calculates the factorial of a given number using a recursive function −
#include <stdio.h>
if(i <= 1) {
return 1;
}
return i * factorial(i - 1);
}
int main() {
int i = 12;
printf("Factorial of %d is %d\n", i, factorial(i));
return 0;
}
When the above code is compiled and executed, it produces the following result −
Factorial of 12 is 479001600
FILE
A file is a named collection of related information that is recorded on secondary storage such as
magnetic disks, magnetic tapes and optical disks.
Types of Files
File Attributes
A file has a single e editable name given by its creator. The name never changes unless a user
has necessary permission to change the file name. The names are given because it is humanly
understandable.
The properties of a file can be different on many systems, however, some of them are common:
Read Files – The system call requires file name and next block in memory to be read. The
system needs a read pointer to read the file from a specific location in the file and this pointer is
updated for the next read from the file.
Write Files – The system call uses same file pointers of the process to write to a file. This saves
space and reduces complexity.
Deleting a file – We look into the directory for the file name, if a file is found, release the space
occupied by the file and remove directory entries for the deleted file.
Truncating a file – Sometimes the user does not want to delete a file, but remove some
information from it. This will change file length attribute, however, other attributes remain
unchanged.
Sequential files
A sequential file is an ordinary text file. Each character in the file is assumed to be either a text
character or some other ASCII control character such as newline
Output:
Enter the account, name, and balance.
Enter EOF to end input.
100 Jones 24.98
200 Doe 345.67
300 White 0.00
400 Stone -42.16
500 Rich 224.62
^Z
Function feof returns true only after the program attempts to read the nonexistent data following
the last line.
Program output:
Account Name Balance
100 Samuel 24.98
200 Martin 345.67
300 White 0.00
400 Stone -42.16
500 Rich 224.62