Tuesday, September 7, 2010
Monday, September 6, 2010
IGNOU BCA CS-63 Assignment 2010
Course Code : CS-63
Course Title : Introduction to System Software
Assignment Number : BCA(3)-63/Assignment/2010
Maximum Marks : 25
Last Date of Submission : 30th April, 2010 (For January Session)
30th October, 2010 (For July Session)
There are six questions in this Assignment. Answer all the questions. You may use illustrations and diagrams to enhance explanation.
IGNOU BCA CS-63 Assignment 2010
( Solution below )
Question 1: Find out the reasons those have made the UNIX an amazingly successful operating system. What are the Features on existing UNIX based operating systems like Linux Red Hat, Fedora and Ubantu Operating system. Also, compare them with Windows Vista. (6 Marks)
Question 2: Write a shell program to generate the first hundred numbers in the Fibonacci series (4 Marks)
Question 3: Design an algorithm that accepts an input a decimal number and converts it into BCD (Binary Coded Decimal) representation. Also, draw its Flow Chart.
(4 Marks)
Question 4: Consider the following set of processes that arrive in the ready queue at the same time:
Process CPU time
P1 2
P2 1
P3 4
P4 3
P5 1
P6 2
Consider the following scheduling algorithms: FCFS, SJF and Round Robin (quantum = 1)
What is turnaround time of each process for each of the above scheduling algorithms?
What is the waiting time of each process for each of the above algorithms? (3 Marks)
Question 5: Write a shell program to find the Greatest Common Divisor among the two positive non-zero integers given. (4 Marks)
Question 6: List the UNIX commands for the following: To search files for lines that match a particular string pattern given. To print the list of the currently logged-in users. To sort alphabetically, a list of numbers stored in a file. To count, number of words in a given text file. (4 Marks)
IGNOU BCA CS-63 Solved Assignment 2010
Answer 1 .#include
main()
{
int num,no_bits;
clrscr();
printf("enter a number");
scanf("%d",&num);
no_bits=count_bits(num);
printf("number of bits %d\t",no_bits);
bin_print(num,no_bits);
}
count_bits(int n) /* function to count number of bits */
{
int i=0;
for (;n!=0;n=n>>1)
i++;
return(i);
}
bin_print(int x, int n_bits)
/* function to print decimal numbers in binary format */
{
int j;
printf("no. %d in binary \t",x);
for(j=n_bits-1; j>=0;j--)
printf("%i",(x>>j) & 01);
}
Answer 2. In formal language theory, a context-free grammar (CFG) is a grammar in which every
production rule is of the form
V › w
where V is a single nonterminal symbol, and w is a string of terminals and/or nonterminals
(possibly empty).
Thus, the difference with arbitrary grammars is that the left hand side of a production rule is
always a single nonterminal symbol rather than a string of terminal and/or nonterminal symbols.
The term "context-free" expresses the fact that nonterminals are rewritten without regard to the
context in which they occur.
A formal language is context-free if some context-free grammar generates it. These languages
are exactly all languages that can be recognized by a non-deterministic pushdown automaton.
Context-free grammars play a central role in the description and design of programming
languages and compilers. They are also used for analyzing the syntax of natural languages.
Example 1
S › a
S › a S
S › b S
The terminals here are a and b, while the only non-terminal is S. The language described is all
nonempty strings of as and bs that end in a.
This grammar is regular: no rule has more than one nonterminal in its right-hand side, and each
of these nonterminals is at the same end of the right-hand side.
Every regular grammar corresponds directly to a nondeterministic finite automaton, so we know
that this is a regular language.
It is common to list all right-hand sides for the same left-hand side on the same line, using | to
separate them, like this:
S › a | aS | bS
Technically, this is the same grammar as above.
Example 2
In a context-free grammar, we can pair up characters the way we do with brackets. The simplest
example:
S › a S b
S › a b
This grammar generates the language , which is not regular.
The special character å stands for the empty string. By changing the above grammar to
S › aSb | å
we obtain a grammar generating the language instead. This differs only in
that it contains the empty string while the original grammar did not.
Example 3
Here is a context-free grammar for syntactically correct infix algebraic expressions in the
variables x, y and z:
S › x | y | z | S + S | S - S | S * S | S/S | (S)
This grammar can, for example, generate the string "( x + y ) * x - z * y / ( x + x )" as follows:
"S" is the initial string. "S - S" is the result of applying the fifth transformation [S › S - S] to the
nonterminal S. "S * S - S / S" is the result of applying the sixth transform to the first S and the
seventh one to the second S. "( S ) * S - S / ( S )" is the result of applying the final transform to
certain of the nonterminals. "( S + S ) * S - S * S / ( S + S )" is the result of the fourth and fifth
transforms to certain nonterminals. "( x + y ) * x - z * y / ( x + x )" is the final result, obtained by
using the first three transformations to turn the S non terminals into the terminals x, y, and z.
This grammar is ambiguous, meaning that one can generate the same string with more than one
parse tree. For example, "x + y * z" might have either the + or the * parsed first; presumably
these will produce different results. However, the language being described is not itself
ambiguous: a different, unambiguous grammar can be written for it.
Answer 3. Windows Vista is a line of operating systems developed by Microsoft for use on personal
computers, including home and business desktops, laptops, tablet PCs, and media center PCs.
Prior to its announcement on July 22, 2005, Windows Vista was known by its codename
"Longhorn." Development was completed on November 8, 2006; over the following three
months it was released in stages to computer hardware and software manufacturers, business
customers, and retail channels. On January 30, 2007, it was released worldwide, and was made
available for purchase and download from Microsoft's website. The release of Windows Vista
came more than five years after the introduction of its predecessor, Windows XP, the longest
time span between successive releases of Microsoft Windows desktop operating systems. It was
succeeded by Windows 7 which was released to manufacturing on July 22, 2009 and is
scheduled for general availability on October 22, 2009.
Windows Vista contains many changes and new features, including an updated graphical user
interface and visual style dubbed Windows Aero, a redesigned search function, multimedia
tools including Windows DVD Maker, and redesigned networking, audio, print, and display
sub-systems. Vista aims to increase the level of communication between machines on a home
network, using peer-to-peer technology to simplify sharing files and digital media between
computers and devices. Windows Vista includes version 3.0 of the .NET Framework, allowing
software developers to write applications without traditional Windows APIs.
Microsoft's primary stated objective with Windows Vista has been to improve the state of
security in the Windows operating system. One common criticism of Windows XP and its
predecessors is their commonly exploited security vulnerabilities and overall susceptibility to
malware, viruses and buffer overflows. In light of this, Microsoft chairman Bill Gates
announced in early 2002 a company-wide " Trustworthy Computing initiative" which aims to
incorporate security work into every aspect of software development at the company. Microsoft
stated that it prioritized improving the security of Windows XP and Windows Server 2003
above finishing Windows Vista, thus delaying its completion.
While these new features and security improvements have garnered positive reviews, Vista has
also been the target of much criticism and negative press. Criticism of Windows Vista has
targeted its high system requirements, its more restrictive licensing terms, the inclusion of a
number of new digital rights management technologies aimed at restricting the copying of
protected digital media, lack of compatibility with some pre-Vista hardware and software, and
the number of authorization prompts for User Account Control. As a result of these and other
issues, Windows Vista had seen initial adoption and satisfaction rates lower than Windows XP.
However, with an estimated 330 million internet users as of January 2009, it has been announced
that Vista usage had surpassed Microsoft’s pre-launch two-year-out expectations of achieving
200 million users. As of the end of August 2009, Windows Vista (with approximately 380
million internet users) is the second most widely used operating system on the internet with an
approx. 23% market share, the most widely used being Windows XP with an approx. 69%
market share.
End-user
Windows Explorer in Windows Vista
Windows Aero: The new hardware-based graphical user interface is named Windows
Aero, which Jim Allchin stated is an acronym for Authentic, Energetic, Reflective, and
Open. The new interface is intended to be cleaner and more aesthetically pleasing than
those of previous Windows versions, including new transparencies, live thumbnails, live
icons, and animations, thus providing a new level of eye candy. Laptop users report,
however, that battery life is shortened with the feature enabled.
Windows Shell: The new Windows shell is significantly different from Windows XP,
offering a new range of organization, navigation, and search capabilities. Windows
Explorer's task pane has been removed, integrating the relevant task options into the
toolbar. A "Favorite links" pane has been added, enabling one-click access to common
directories. The address bar has been replaced with a breadcrumb navigation system. The
preview pane allows users to see thumbnails of various files and view the contents of
documents. The details pane shows information such as file size and type, and allows
viewing and editing of embedded tags in supported file formats. The Start menu has
changed as well; it no longer uses ever-expanding boxes when navigating through
Programs. The word "Start" itself has been removed in favor of a blue Windows Pearl.
Instant Search (also known as search as you type) : Windows Vista features a new way
of searching called Instant Search, which is significantly faster and more in-depth
(content-based) than the search features found in any of the previous versions of
Windows.
Windows Sidebar: A transparent panel anchored to the side of the screen where a user
can place Desktop Gadgets, which are small applets designed for a specialized purpose
(such as displaying the weather or sports scores). Gadgets can also be placed on other
parts of the desktop.
Windows Internet Explorer 7: New user interface, tabbed browsing, RSS, a search
box, improved printing, [21] Page Zoom, Quick Tabs (thumbnails of all open tabs), Anti-
Phishing filter, a number of new security protection features, Internationalized Domain
Name support (IDN), and improved web standards support. IE7 in Windows Vista runs in
isolation from other applications in the operating system (protected mode); exploits and
malicious software are restricted from writing to any location beyond Temporary Internet
Files without explicit user consent.
Windows Media Player 11, a major revamp of Microsoft's program for playing and
organizing music and video. New features in this version include word wheeling (or
"search as you type"), a new GUI for the media library, photo display and organization,
the ability to share music libraries over a network with other Windows Vista machines,
Xbox 360 integration, and support for other Media Center Extenders.
Backup and Restore Center: Includes a backup and restore application that gives users
the ability to schedule periodic backups of files on their computer, as well as recovery
from previous backups. Backups are incremental, storing only the changes each time,
minimizing disk usage. It also features Complete PC Backup (available only in Ultimate,
Business, and Enterprise versions) which backs up an entire computer as an image onto a
hard disk or DVD. Complete PC Backup can automatically recreate a machine setup onto
new hardware or hard disk in case of any hardware failures. Complete PC Restore can be
initiated from within Windows Vista or from the Windows Vista installation CD in the
event the PC is so corrupt that it cannot start up normally from the hard disk.
Windows Mail: A replacement for Outlook Express that includes a new mail store that
improves stability, and features integrated Instant Search. It has the Phishing Filter like
IE7 and Junk mail filtering that is enhanced through regular updates via Windows
Update.
Windows Calendar is a new calendar and task application.
Windows Photo Gallery, a photo and movie library management application. It can
import from digital cameras, tag and rate individual items, adjust colors and exposure,
create and display slideshows (with pan and fade effects) and burn slideshows to DVD.
Windows DVD Maker, a companion program to Windows Movie Maker that provides
the ability to create video DVDs based on a user's content. Users can design a DVD with
title, menu, video, soundtrack, pan and zoom motion effects on pictures or slides.
Windows Media Center, which was previously exclusively bundled in a separate
version of Windows XP, known as Windows XP Media Center Edition, has been
incorporated into the Home Premium and Ultimate editions of Windows Vista.
Games and Games Explorer: Games included with Windows have been modified to
showcase Vista's graphics capabilities. New games are Chess Titans, Mahjong Titans
and Purble Place. A new Games Explorer special folder contains shortcuts and
information to all games on the user's computer.
Answer 4. echo Enter a number
read no
i=1
ans=0
while [ $i -le 'expr $no / 2' ]
do
if [ 'expr $no % $i' -eq 0 ]
then
ans='expr $ans + $i'
fi
i='expr $i + 1'
done
if [ $no -eq $ans ]
then
echo $no is perfect
else
echo $no is NOT perfect
=======================================================================================================================================================================================================================================
AKHILESH
System Admin
IGNOU BCA CS-05 Solved Assignments 2010
IGNOU BCA CS-05 Solved Assignments 2010
Course Code : CS-05
Course Title : Elements of Systems Analysis and Design
Assignment Number : BCA (3)-/Assignment/ 2010
Maximum Marks : 25
Last Date of Submission : 30th April, 2010 (For January Session)
30th October, 2010 (For July Session)
Question 1: Define the term “System Analysis (3 Marks)
Ans 1. System Analysis is the Modern e-mail systems are based on a store-and-forward model in which e-mail computer server systems, accept, forward, or store messages on behalf of users, who only connect to the e-mail infrastructure with their personal computer or other networkenabled device for the duration of message transmission or retrieval to or from their designated server. Rarely is e-mail transmitted directly from one user's device to another's. While, originally, e-mail consisted only of text messages composed in the ASCII character set, virtually any media format can be sent today, including attachments of audio and video clips.
System analysis is the branch of electrical engineering that characterizes electrical
systems and their properties. Although many of the methods of system analysis can be
applied to non-electrical systems, it is a subject often studied by electrical engineers
because it has direct relevance to many other areas of their discipline, most notably signal processing and communication systems.
=====================================================================
Question 2: Define the term “System Design”. (3 Marks)
Ans 2: Systems design is the process or art of defining the architecture, components, modules,
interfaces, and data for a system to satisfy specified requirements. One could see it as the
application of systems theory to product development. There is some overlap and synergy
with the disciplines of systems analysis, systems architecture and systems engineering.
Systems design is the process or art of defining the architecture, components, modules,
interfaces, and data for a system to satisfy specified requirements. One could see it as the
application of systems theory to product development. There is some overlap and synergy
with the disciplines of systems analysis, systems architecture and systems engineering.
Major System Design Activities are
1. DB design
2. Program design
3. System & program test preparation
4. System Interface Specification
5. Audit Consideration
6. Audit control & Documentation control
Major design process parts are
1. O/p design
2. I/p design
3. File Design
4. Procedure design
- Computer design
- Non-computer design
5. Control design
=====================================================================
Question 3: Explain the responsibilities of a System Analyst? (4 Marks)
Ans 3 : Systems analyst is responsible for researching, planning, coordinating and
recommending software and system choices to meet an organization's business
requirements. The systems analyst plays a vital role in the systems development process. A successful systems analyst must acquire four skills: analytical, technical, managerial, and
interpersonal. Analytical skills enable systems analysts to understand the organization and its functions, which helps him/her to identify opportunities and to analyze and solve problems.
Technical skills help systems analysts understand the potential and the limitations of
information technology. The systems analyst must be able to work with various
programming languages, operating systems, and computer hardware platforms.
Management skills help systems analysts manage projects, resources, risk, and change.
Interpersonal skills help systems analysts work with end users as well as with other
analysts, programmers, and other systems professionals.
Systems analysts may act as liaisons between vendors and the organization they
represent. They may be responsible for developing cost analyses, design considerations,
and implementation time-lines. They may also be responsible for feasibility studies of a
computer system before making recommendations to senior management.
Basically a systems analyst performs the following tasks:
Interact with the customers to know their requirements
Interact with designers to convey the possible interface of the software
Interact/guide the coders/developers to keep track of system development
Perform system testing with sample/live data with the help of testers
Implement the new system
====================================================================
Question 4: Assume that you are appointed as System Analyst for the development of a “Library Information System(LIS)”. Develop SRS for it. Make necessary assumptions (8 Marks)
Question 5: Develop design document for LIS in Question no.1 above. (7 Marks)
Ans : 4 n 5 DESIGN ..The most creative and challenging phase of the system life cycle is system design. The term design describes a final system and the process by which it is
developed. It refers to the technical specifications (analogous to the engineer's
blueprints) that will be applied in implementing the candidate system. It also
includes the construction of programs and program testing. The key question
here is: How should the problem be solved?
The first step is to determine how the output is to be produced and in what
format. Samples of the output (and input) are also presented. Second input data
and master files (database) have to be designed to meet the requirements of the
proposed output. The operational (processing) phases are handled through
program construction and testing, including a list of the programs needed to meet
the system's objectives and complete documentation. Finally, details related to
justification of the system and an estimate of the impact of the candidate system
on the user and the organization are documented and evaluated by management
as a step toward.
Implementation
The final report prior to the implementation phase includes procedural flowcharts,
record layouts, report layouts, and a workable plan for implementing the
candidate system. Information on personnel, money, hardware, facilities and their
estimated cost must also be available. At this point projected costs must be close
to actual costs of implementation.
In some firms, separate groups of programmers do the programming whereas
other firms employ analyst-programmers who do analysis and design as well as
code programs. For this discussion, we assume two separate persons carry out
the analysis and programming. There are certain functions, though, that the
analyst must perform whole programs are being written. Operating procedures
and documentation must be completed. Security and auditing procedures must
also be developed.
INTRODUCTION OF PHYSICAL DESIGN
The systems objectives outlined during the feasibility study serve as the basis
from which the work of system design is initiated. Much of the activities involved
at this stage is of technical nature requiring a certain degree of experience in
designing systems, sound knowledge of computer related technology and
thorough understanding of computers available in the market and the various
facilities provided by the vendors. Nevertheless, a system cannot be designed in
isolation without the active involvement of the user. The user has a vital role to
play at this stage too. As we know that data collected during feasibility study will
be utilized systematically during the system design. It should, however, be kept in
mind that detailed study of the existing system is not necessarily over with the
completion of the feasibility study. Depending on the plan of feasibility study, the
level of detailed study will vary and the system design stage will also vary in the
amount of investigation that still needs to be done. This investigation is generally
an urgent activity during the system design, as the designer needs to study
minute’s details in all aspects of the system. Sometimes, but rarely, this
investigation may form a separate stage between Feasibility Study and Computer
System Design. Designing a new system is a creative process, which calls for
logical as well as lateral thinking. The logical approach involves systematic
moves towards the end product keeping in mind the capabilities of the personnel
and the equipment at each decision making step. Lateral thought implies
encompassing of ideas beyond the usual functions and equipment. This is to
ensure that no efforts are being made to fit previous solutions into new situations.
System Design Considerations
The system design process is not a step-by-step adherence of clear procedures
and guidelines. Though, certain clear procedures and guidelines have emerged
in recent days, but still much of design work depends on knowledge and
experience of the designer.
When designer starts working on system design, he will face different type of
problems. Many of these will be due to constraints imposed by the user or
limitations of the hardware and software available in the market. Sometimes, it is
difficult to enumerate the complexity of the problems and solutions thereof since
the variety of likely problems is so great and no solutions are exactly similar.
However, following considerations should be kept in mind during the systemdesigning
phase:
The primary objective of the design: Of course, is to deliver the requirements
as specified in the feasibility report. In general, the following design objectives
should be kept in mind:
a) Practicality: The system must be stable and can be operated by people with
average +
b) Efficiency: This involves accuracy, timeliness and comprehensiveness of the
system output.
c) Cost: it is desirable to aim for a system with a minimum cost subject to the
condition that it must satisfy all the requirements.
Flexibility: The system should be modifiable depending on the changing needs
of the user. Such modifications should not entail extensive reconstructing or
recreation of software. It should also be portable to different computer systems.
d) Security: This is very important aspect of the design and should cover areas
of hardware reliability, fall back procedures, physical security of data and
provision for detection of fraud and abuse.
System design involves first logical design and then physical construction of the
system. The logical design describes the structure and characteristics of
features, like the outputs, inputs, files, databases and procedures. The physical
construction, which follows the logical design, produces actual program software,
files and a working system.
The designer normally will work under following constraints:
1. Hardware: The existing hardware will obviously affect the system design.
2. Software: The available software (operating system, utilities, language
etc.) in the market will constrain the design.
3. Budget: The budget allocated for the project will affect the scope and
depth of design.
4. Time-scale: The new system may be required by a particular time (e.g.
the start of a financial year). This may put a constraint on the designer to
find the best design.
5. Interface with other systems: The new system may require some data
from another computerized system or may provide data to another system
in which case the files must be compatible in format and the system must
operate with a certain processing cycle.
4. SYSTEM DEVELOPMENT LIFE CYCLE
User Revised Requirement
Requirement Specification
Decision to
Design Information
System
Feasibility
Test Plan Study
Logical System Design Functional Spec.
Physical
Requirement
System Configuration
Requirement
Determination
Initial
Requirement
Investigation
Feasibil
ity
Analysi
s
System
Implementation
System
Design
System
Specifica
tion
Analysis
System
Evaluation
Hardware
Study
Data
Schedule Budget
Revised
Requirement
System Modification Improved System
Maintenance
Context Level DFD For
Library Management System
Member
Details
Book
Details
Library
Management
System
CODING STANDARDS
Coding standards can improve the quality of our work and help make our team
more efficient and effective. In “VB programming standards lead to better code”,
we discussed some coding standards and naming conventions for controls,
variables, constants, enumerations, and procedures. To improve the readability
of your Visual Basic programs even further, we’ll explore some suggested
standards for variable qualifiers, menus, code formatting, and commenting.
Variable qualifiers
Often, projects contain variables that are related to one another. So your
variables should be named in a way that makes the related information easy to
find. For example, if you are retrieving information about a customer, such as first
name and last name, use Customer as a standard qualifier for naming all
variables related to Customer. Your qualifier will go right after the variable data
type prefix—for example, strCustomerFirst and strCustomerLast—to denote that
both variables relate to information gathered about a customer. Use the common
variable qualifiers listed in Table A for naming related variables.
Qualifier Description
Txt First element of the textbox
Cmb First element of the combo box
Lbl First element of the label
Frm First element of the form
Lst First element of the list box
Str First element in a set
Next Next element in a set
Prev Previous element in a set
Cur Current element in a set
Min Minimum value
Max Maximum value
Tmp A highly localized “scratch” variable
Src Source; often used in transfer routines
Dst Destination; often used in conjunction with src
Table A Suggested prefixes for frequently used controls
Menus
All menus should have the standard mnu prefix. Menu control prefixes should
also include an additional prefix for each level of nesting, with the final menu
caption at the end of the name string. For example, in our application we have
three top-level menus called Details, Facility and Reports with their submenu
items . Code formatting and commenting conventions. The addition of indents and
comments can greatly improve the readability of your code. Properly used,
indents can make it easy for someone reading your program to quickly identify
the program structures. In fact, it can help reveal bugs or unnecessarily complex
portions of the code before you ever run the program.
Code formatting
In general, your code should be easy for you and others to read. If you don't
indent your statements, it is practically impossible to make sense of what you’re
doing.
When you format your code, you should:
Make it easy to read and to understand.
Reduce the work necessary to understand structural constructs.
Make the structure of code as self-documenting as possible.
Indent continuation lines.
Use indentation to show organizational structure.
In other words, by formatting the code, it should be clear where various elements
such as decision structures begin and end. If there is an else, you should be able
to quickly identify the code that will execute for each portion of the if-else branch.
More specifically, you should indent:
After an If statement when an End If is used.
After an Else statement.
After a Select Case statement.
After a Case statement.
After a Do statement.
Successive lines of a statement that has been split with the line
continuation character.
After a With statement.
After calling an Edit or AddNew method of a Record set object. The
Update or CancelUpdate method should appear at the same level of
indention as the Edit or AddNew statement.
After a prcconnect method call.
In the declarations section of a module.
In the bodies of user-defined data type declarations.
In the bodies of enumeration declarations.
Code that is subordinate to a line label. Visual Basic doesn't allow you to
indent labels, and this works to your advantage. If you indent the entire
highest-level code one tab stop from the left side of the code window, the
labels within the procedure will stand out because they are left aligned in
the code window.In addition, you should use white space to group related statements. Insert a
blank line:
Before and after each If…Then.
Before and after each Select Case.
Before and after each loop.
After declaring a block of variables.
Between groups of statements that perform a step in an overall task.
Verification & Validation
The goal of verification and validation activities is to assess and improve the
quality of the work products generated during development and modification of
software. Quality attributes of interest include correctness, completeness,
consistency, reliability, usefulness, usability, efficiency, conformance to
standards, and overall cost effectiveness.
There are two types of verification: life-cycle verification and formal verification.
Life-cycle verification is the process of determining the degree to which the work
products of a given phase of the development cycle fulfill the specifications
established during priori phases. Formal verification is rigorous mathematical
demonstration that source code conforms to its specifications. Validation is the
process of evaluating software at the end of the software development process to
determine compliance with the requirements. Boehm phrases these definitions
as follows:
Verification: “Are we building the product right?”
Validation: “Are we building the right product?”
Program verification methods fall into two categories-static and dynamic
methods. In dynamic method, the program is executed on some test data and the
outputs of the program are examined to determine if there are any errors present.
Hence, dynamic techniques follow the traditional pattern of testing, and the
common notion of testing refers to this technique.
Static techniques, on the other hand, do not involve actual program execution on
actual numeric data, though it may involve some form of conceptual execution. In
static techniques, the program is not compiled and then executed, as in testing.
Common forms of static techniques are program verification, code reading, code
reviews and walkthroughs, and symbolic execution. In static techniques, often
the errors are detected directly, unlike dynamic techniques where only the
presence of an error is detected. This aspect of static testing makes it quite
attractive and economical.
It has been found that the types of errors detected by the two categories of
verification techniques are different. The type of errors detected by static
techniques is often not found by testing, or it may be more cost-effective to detect
these errors by static methods. Consequently, testing and static methods are
complimentary in nature, and both should be used for reliable software.
Code Reading
Code reading involves careful reading of the code by the programmer to detect
any discrepancies between the design specifications and the actual
implementation. It involves determining the abstraction of a module and then
comparing it with its specifications. The process is the reverse of design. I
design, we start from an abstraction and move toward more details. In code
reading, we start from the details of a program and move toward an abstract
description. The process of code reading is best done by reading the code inside out starting
with the innermost structure of the module. First, determine its abstract behavior
and specify the abstraction. Then, the higher-level structure is considered, with
the inner structure replaced by its abstraction. This process is continued, until we
reach the module or program, being read. At that time, the abstract behavior of
the program/module will be known, which can then be compared to the
specifications to determine any discrepancies.
Code reading is very useful and can detect errors often not revealed by testing.
Reading in the manner of stepwise-abstraction also forces the programmer to
code in a manner conducive to this process, which leads to well-structured
programs. Code reading is sometimes called desk review.
Static Analysis
Analysis of programs, by methodically analyzing the program text, is called static
analysis. Static analysis is usually performed mechanically by the aid of software
tools. During static analysis, the program itself is not executed, but the program
text is the input to the tools. The aim of the static analysis tools is to detect errors
or potential errors or to generate information about the structure of the program
that can be useful for documentation or understanding of the program. Different
kinds of static analysis tools can be designed to perform different types of
analysis.
Many compilers perform some limited, static analysis. More often, tools explicitly
for static analysis are used. Static analysis can be very useful for exposing errors
that may escape other techniques. As the analysis is performed with the help of
software tools, static analysis is a very cost-effective way of discovering errors.
An advantage is that static analysis, sometimes, detects the errors themselves,
not just the presence of errors, as in testing. This saves the effort of tracing the
error from the data that reveals the presence of errors. Furthermore, static
analysis can provide "warnings" against potential errors and can provide insight
into the structure of the program. It is also useful for determining violations of
local programming standards, which the standard compilers will be unable to
detect. Extensive static analysis can considerably reduce the effort later needed
during testing
Data flow analysis is one form of static analysis that concentrates on the uses of
data, by programs and detects some data flow anomalies. Data flow anomalies
are "suspicious" use of data in a program. In general, data flow anomalies are
technically not errors, and they may go undetected by the compiler. However,
they are often a symptom of an error, caused due to carelessness in typing or
error in coding. At the very least, presence of data flow anomalies implies poor
coding. Hence, if a program has data flow anomalies, it is a cause of concern,
which should be properly addressed.
X = a;
x does not appear in any right hand side
x = b;
A CODE SEGMENT
An example of the data flow anomaly is the live variable problem, in which a
variable is assigned some value but then the variable is not used in any later
computation. Such a live variable and, assignment to the variable are clearly
redundant.
Monitoring and Control
The review process was started with the purpose of detecting defects in the
code. Though design reviews substantially reduce defects in code, reviews are
still very useful and can considerably enhance reliability and reduce effort during
testing. Code reviews are designed to detect defects that originate during the
coding process, although they can also detect defects in detailed design.
However, it is unlikely that code reviews will reveal errors in system design or
requirements.
Code inspections or reviews are, usually, held after code has been successfully
completed and other forms of static tools have been applied but before any
testing have been performed. Therefore, activities like code reading, symbolic
execution, and static analysis should be performed, and defects found by these
techniques corrected before code reviews are held. The main motivation for this
is to save human time and effort, which would otherwise be spent detecting
errors that a compiler or static analyzer can detect. In other words, the entry
criteria for code review are that the code must compile successfully and has
been "passed" by other static analysis tools.
The documentation to be distributed to the review team members includes the
code to be reviewed and the design document. The review team for code reviews
should include the programmer, the designer, and the tester. The review starts
with the preparation for the review and ends with a list of action items.
The aim of reviews is to detect defects in code. One obvious coding defect is that
the code fails to implement the design. This can occur in many ways. The
function implemented by a module may be different from the function actually
defined in the design or the interface of the modules may not be the same as the
interface specified in the design. In addition, the input-output format assumed by
a module may be inconsistent with the format specified in the design.
Other code defects can be divided into two broad categories: logic and control
and data operations and computations. Some examples of logic and control
defects are infinite loops, unreachable code, incorrect predicate, missing or
unreferenced labels, and improper nesting of loops and branches. Examples of
defects in computation and data operations are missing validity tests for external
data, incorrect access of array components, improper initialization, and misuse of
variables.
A Sample Checklist: The following are some of the items that can be included in
a checklist for code reviews.
Do data definitions exploit the typing capabilities of the language?
Do all the pointers point to some object? (Are there any "dangling pointers"?)
Are the pointers set to NULL, where needed?
Are the array indexes within bound?
Are indexes properly initialized?
Are all the branch conditions correct (not too weak, not too strong)?
Will a loop always terminate (no infinite loops)?
Is the loop termination condition correct?
Is the number of loop executions "off by one"?
Where applicable, are the divisors tested for zero?
Are imported data tested for validity?
Do actual and formal interface parameters match?
Are all variables used? Are all output variables assigned?
Can statements placed in the loop be placed outside the loop?
Are the labels unreferenced?
Will the requirements of execution time be met?
Are the local coding standards met?
===============================================================================================================================================================================================================
You Can get study materials From........................
- http://rapidshare.com/files/401584412/Ignou_BCA_Sem_I_CS610_Foundation_Course_in_English_for_Computing.rar
- http://rapidshare.com/files/401584414/Ignou_BCA_Sem_I_CS611_Computer_Fundamentals_and_PC_Software.rar
- http://rapidshare.com/files/401584415/Ignou_BCA_Sem_I_FHS01_Foundation_Course_in_Humanities_and_Social_Sciences.rar
- http://rapidshare.com/files/401584416/Ignou_BCA_Sem_II_CS60_Foundation_Course_in_Mathematics_in_Computing.rar
- http://rapidshare.com/files/401584419/Ignou_BCA_Sem_II_CS62____C____Programming_and_Data_Structures.rar
- http://rapidshare.com/files/401584420/Ignou_BCA_Sem_II_CS612_PC_Software_and_Application_Skills.rar