Class 12 Final Notes
Class 12 Final Notes
System Analyst:
System analyst is a key person in system development process who analyses existing system and designs, implements
and evaluates the new system that tries to overcome the limitations of the existing system. In order to perform those
tasks, a system analyst constantly interacts with users and managers within and outside the company. On large
projects, the analyst works as a member of an IT department team.
Attributes/ Characteristics of System Analyst:
1. Knowledge of Organizations: A system analyst must have the knowledge of 'working mechanism',
'management structure' and 'functional relationship among different departments' of an organization for which the
information system is to be developed.
2. Knowledge of-Computer System: A system analyst must have knowledge about recent development in
computer system so that he/ she can advise the core development team to use the latest computer system which
addresses user's need with higher level of efficiency.
3. Good Inter-personal Relation: An analyst must be good listener, a good diplomat and Win users over as
friends. He/ She must be able to resolve conflicting requirements. He/ She must understand people and be able to
influence them to change their minds and attitudes. He/ She must understand their needs and motivate them to
work well under stressful conditions such as meeting deadlines etc.
4. Communication Skills: An analyst is also required to orally present his design to groups of users. He/ She must
thus be able to organize his thoughts and present them in a language that can be easily understood by users. Good
oral presentations and satisfactory replies to questions are essential to convince management about the usefulness
of computer-based information systems
5. Analytical Skill: System analysts are required to find solution of problem. A good analyst must be able to
perceive the core problem and discard duplicate data and information in the problem statement. A good analyst
will use appropriate analytical tools as necessary.
6. Breadth of Knowledge: A system analyst has to work with persons performing various jobs in an organization.
He/She may have to interact with accounts sales persons, Clerical staff, production supervisors, stores officers,
purchases officers, directors, etc. A system analyst must understand how they do their jobs and design systems to
enable them to do their job better.
****
Roles and Responsibilities of System Analyst
The success of an information system development is based on the role of system analyst. Among several roles,
some important roles are described below.
1. Change Agent: The analyst may be viewed as an agent of change. A system is designed to introduce changes
and the way how the user and organization handles information or makes decision. So the system analyst may
use different approaches to introduce changes.
2. Investigator and Monitor: A system analyst should investigate the existing system to find the reasons for its
failure. The role of an investigator is to extract the problems from existing systems. The role of monitor is to
undertake and successfully complete a project. In this role, the analysts must monitor programs in relation to
time, cost and quality.
3. Architect: The analyst’s role as an architect is an interface between the user’s logical design requirements
and the detailed physical system design. As an architect, the analyst also creates a detailed physical design of
system. A system analyst makes the design of the information system architecture on the basis of the end
user's requirements. This design becomes the blueprint for the programmers.
2|Page
4. Psychologist: The system analyst plays the role of psychologist when he/she, reaches the people, interprets
their thoughts and draw conclusion from these interaction. Psychologist plays a major role during the phase of
fact finding.
5. Motivator: The analyst plays the role of motivator in order to make the users accept the new system. The
analyst’s role as a motivator becomes very obvious and essential during the first few weeks after the
implementation of new system to make it familiar with them.
6. Defining and Prioritizing the Requirements: The most important and difficult duty of an analyst is to
understand the user’s requirements. There is a need to set priority among the requirements of various users.
The analyst must convince all the users about the priority of requirements.
7. Analysis and Evaluation: The system analyst analyses the working of the current information system in the
organization and finds out the extent to which they meet user's needs. On the basis of the collected
information, the analyst evaluates and finds the best characteristics of the new system which will meet the
user’s requirements. An analyst must critically evaluate a system after it has been in use for reasonable period
of time. The analyst must decide when to do evaluation, how to do evaluation, and how to collect user’s
comments.
8. Designing System: After specifications are accepted, the analyst designs the system. The design must be
understandable to the system implementer. The design must be flexible to accommodate changes easily. An
analyst must know the latest design also to assist implementer in his task.
Assignment
1. List out the types of information system?
2. Who is system analyst? List out the roles of system analyst.
3. List out the characteristics of system analyst.
*****
Requirements Analysis and Definition: It is the first stage of waterfall model. In this stage, the developer should
identify the actual requirements of the given problem. After that, the problems are analyzed and prioritized as per the
requirements of the problem. Finally these requirements are stated as problem statement.
System Design: In this stage the systems design process partition the requirements to either hardware or software
systems. It establishes overall system architecture. System design involves identifying and describing the fundamental
software system abstractions and their relationships.
Implementation and Unit Testing: During this stage, the system design is realized as a set of programs or program
unit testing involves verifying that each unit meets its specification.
Integration and System Testing: The individual program units or programs are integrated and tested as a complete
system to ensure that the software requirements have been met. After testing, the software system is delivered to the
customer.
Operation and Maintenance: In this stage, the system is installed to the desire location. The maintenance involves
correcting errors which were not discovered in earlier stages of the life cycle, improving the implementation of system
units and enhancing the system’s service as new requirements are discovered.
Advantages:
-It is simple model suitable for small size project.
-It is less expensive.
- Model required fulfillment of one phase unless it will not allow to go to next phase.
- All the testing and modification is done is the same phase, chances of defect multiplication reduced.
- When new team member joins, referenced documents help them to understand the project.
- The project with short span time can be developed with this model in better quality.
4|Page
Disadvantages:
-It has no back track mechanism.
- It is not suitable for large size project.
- It has lack of proper documentation.
- Takes lot of time to change and update the project documents.
- This model doesn’t suitable for randomly changing requirement.
2. Prototyping Model:
Prototyping is the iterative process of system development which is more appropriate for
developing new system where there is no clear idea of requirements, inputs and outputs. Using prototyping,
programmers can build early versions of systems. These systems are then continuously modified until the user is
satisfied. Prototyping is especially helpful in situations where there will be heavy user interaction with the system,
where the needed output is uncertain, and in some decision support applications where the logic is hard to determine
in advance. The developer interviews the user and designs an initial system using a database management system. The
user works with the prototype and suggests changes. This process repeats until the user or developer is satisfied.
Development of Prototype
The figure shows the steps involved in developing a type of prototype. There are 4 steps
and are as follows:
1. Identify the user needs: The system analyst interviews the user to obtain an idea of
what is required from the system.
2. Develop a prototype: The system analyst, working with other information specialists,
uses one or more prototyping tools to develop a prototype.
3. Determine if prototype is acceptable: The analyst educates the user in prototype use
and provides an opportunity from becoming familiar with the system. The user advises the
analyst whether the prototype is satisfactory. If so, then the next step, that is step 4 is
taken, else the prototype is revised by repeating steps 1, 2 and 3 with a better
understanding of the user needs.
4. Use the prototype: The prototype becomes the operational system. This approach is possible only when the
prototyping tools enable the prototype to contain all the essential elements of the new system.
Advantages:
- Communications between the systems analyst and user are improved.
- The expert can do a better job of determining the user's needs. The user plays a more active role in system
development.
- The expert and the user spend less time and effort in developing the system.
- Implementation is much easier because the user knows what to expect.
- A system is developed through operational prototyping is capable of easy adaptation.
Disadvantages:
- Because of the iterative nature of prototyping, there is no definite deliverable or completion deadline.
- Code inefficiencies may be a drawback in terms of functionality
- The computer-human interface provided by certain prototyping tools may not reflect good design techniques.
3. Spiral Model
In this model, process is represented as a spiral rather than as a
sequence of activities with backtracking. Each loop in the spiral
represents a phase in the process. It has no fixed phases such as
specification or design loops in the spiral are chosen depending on
what is required. Risks are explicitly assessed and resolved throughout
the process. Each loop in the spiral represents a phase of the software
process. Thus, the innermost loop might be concerned with system
5|Page
feasibility, the next loop with system requirement definition and analysis, the next loop with system design and so
on.
1. Planning: The project is reviewed and a decision made whether to continue with a further loop of the spiral. If it is
decided to continue, plans are drawn up for the next phase of the project.
2. Risk Analysis: For each of the identified project risks, a detailed analysis is carried out. Steps are taken to reduce
the risk. For example, if there is a risk that the requirements are inappropriate, a prototype system may be
developed.
3. Software Development: After risk evaluation, a development model for the system is chosen. For example, if user
interface risks are dominant, an appropriate development model might be evolutionary prototyping. If safety risks
are the main consideration, development based on formal transformations may be the most appropriate and so on.
The waterfall model may be the most appropriate development model if the main identified risk is sub-system
integration e project are defined by the
4. User Evaluation: Specific Objectives for the phase of the project are identified by the evaluation of users.
Constraints on the process and the product are identified. And detailed management plan is drawn up.
Advantages:
Disadvantages:
1. System Study:
A system is intended to meet the needs of an
organization. Thus the first step in the design is to specify
these needs or requirements. The top manager of the
organization takes the basic decision to use a computer
based (information) system for managing the
organization. The management of organization consults
with system analyst. For instance his / her role is similar
to the house architect for building a house. The first job
of the system analyst is to understand the existing
system that could be manual or computer based. During
this stage he/ she understand the organization by means
of extensive discussions with all levels in the organization
hierarchy, namely, top managers to clerks. Based on this he/ she identifies what priority assigns. During this
phase, the objectives of system are identified. It is predetermined course of action. This involves forecasting
because in order to plan the future course of action, it is essential to anticipate the future. Because problem
definition deals with the future, uncertainty is present. In summary, system study studies the
following questions:
- What is to be done in future.
- How to do it.
- When to do it.
- Who is to do it.
2. System Analysis:
”Systems analysis is the dissection of a system into its component pieces to study how those component
pieces interact and work”. Systems analysis is a term that collectively describes the early phases of systems
development. System analysis is defined as those phases and activities that focus on the business problem,
independent of technology (for the most part). Specifically, we refine our definition of systems analysis as
follows. "Systems analysis is (1) the survey and planning of the system and project, (2) the study and analysis
of the existing business and information system, and (3) the definition of business requirements and
priorities for a new or improved system.
3. Feasibility Study:
7|Page
Feasibility study is the most important activity in the system analysis phase. It analyses the proposed system
from different aspects so that it makes us clear that how practical or beneficial the system will be to the
organization. So it tells us whether the system is feasible to design or not. It is defined as the pre-defined
activity in SDLC that determines existence of various scopes for the development of new system. It
determines the future prospective about the new system. In feasibility study, we focus on the long term gain
instead of short term benefits. It deals with economical aspect, technical aspect, operational aspect,
behavioral aspect, schedule aspect, legal aspect etc. about the system. Moreover it also discuss about the
inputs, outputs and the efficient processing mechanism for the software. If the project is not feasible from
any aspect then the system will not give the maximum benefits for the users.
4. System Design:
The next step is to develop the logical design of the system. During this phase, the logic of the system is
designed. The system design should begin from the objectives of the system, namely, the information
requirement of users, and use this to find the necessary database. After complete this phase, the overall
8|Page
logical solution of a problem is determined. During system design different tools are used such as Flow
Chart, Algorithm, DFD (Data Flow Diagram, ERD (Entity Relationship Diagram) etc. Some methodologies
drawn this phase are given below. Type of system design methodologies
a, Top Down Methodology .
b, Bottom Up Methodology.
5. System Development:
After designing a logical diagram of a system then next step is to convert into program. This process is called
system development. Flowchart, algorithm, pseudo code etc. are the outlines the procedures for taking the
input data and processing it into usable output. We are now ready to code the instructions that will control
the All programming languages, C, C++, JAVA, FORTRAN, COBOL, BASIC and so on, are composed of
instructions that enable the computer to process a particular application, or perform a particular function.
In system development following processes are done.
- Convert logical structure in to programs in programming language.
- Database is created. 0 User Operational documents are written.
- Users are trained. - The internal documentation of a system are prepared.
6. System Testing:
System Testing System testing is an investigation conducted to provide stakeholders with information about
the quality of the product or service under test. System testing also provides an objective, independent view
of the software to allow the business to appreciate and understand the risks of software implementation.
Test techniques include, but are not limited to, the process of executing a program or application with the
intent of finding software bugs.
System testing can also be stated as the process of validating and verifying that a software program/
application/ product:
- System meets the business and technical requirements that guided its design and development.
- System works as expected. a System can be implemented with the same characteristics.
7. Implementation:
Implementation involves testing the installed system, converting from the old system to the new one and
training the users. This phase consists of implementation of the system into a production environment, and
resolution of the problem identified in testing phase. The new system is installed and operated with old
system until it has been checked out. Then the old system is then removed from operation and new system
takes from thereafter.
requires periodic ‘maintenance so as to keep in tune with design specification and to innovate new ideas
into the system. The content of the review will include:
- Objectives met - Cost - Performance - Standards - Recommendation
Types of Maintenance
1. Corrective Maintenance: It corrects the run time errors during the Operation.
2. Adaptive Maintenance: It modifies or adds new features in the system according to the environmental
change.
3. Perfective Maintenance: It makes the system perfect, up-to-date and improve the life of the system. In
this way software development stages goes on towards the fulfillments of new requirements of users.
Finally the system development project is reviewed in order to verify the customer requirements,
performance evaluation, and time and coast evacuation. It is important for redesign and modification in
next versions of the system in upcoming life cycle.
Assignment
1. Differentiate between black box and white box testing.
4. List out different system implementation method.
5. List out different types of system maintenance.
Documentation
Documentation is not a separate stage, it requires throughout the stages in the development process. It
consists of the written description and procedures about the software. It consists of the detail description about
software requirements specification, feasibility report, software designing report, description about input/output
and processing mechanism, source code, comments, manuals, guides and effective help desk. Moreover the
documentation should describe everything you have done so far. It consist the limitations of the software; demo to
describe how to run the software and the minimum requirements in order to run it smoothly. The following points
describe the actual importance of documentation.
- Effective and easy use for the users.
- It is easy to remember the program logic and instruction for the programmer during programming.
- It helps to solve the best way solution.
- For the future reference to maintenance and modify.
Mainly documentation is categorized into two types: internal documentation and external documentation.
Internal Documentation: It is used by the system analyst and the programmer during development process. It is
very useful for the development period and also useful in future for the modification and maintenance of the
software. Examples of internal documents.
10 | P a g e
- SR5 (System Requirements Specification) report contents the detail description about the actual requirements
and the feasibility description about the total benefits for the organization with effective solution of right
problem.
- Software design report consists of logical as well as physical design report. It consists the different tools and
techniques used to solve the problems.
- Source code and Comments of the software itself a part of documents for the programmer and comments are
also used in programs. It also includes documentation for testing and verification and maintenance.
External Documentation: It is used by the user during the running time of the .software. It includes the detail
description in terms of manuals, guide and help files. It mainly deals with how to effective use of software
Assignment
1 List the importance of documentation. .
2. List the types of documentation.
Short notes:
Data Flow Diagram (DFD):
A pictorial representation of any business activity will be more effective than a narrative one. It is easier to
understand or grasp when being explained and most important of all, it is much more precise and less ambiguous
than a narrative one. During the course of analysis, the System Analyst (SA) has to gather enough information in
order to answer the following questions. It also serves as a form of checklist:
• What are the processes that make up a system?
• What data is used in each of the processes?
• What and how is the data stored?
• What data enters and leaves the system?
All the information gathered has to be recorded. For this purpose, the SA will normally use the DFD. A DFD is a
diagrammatic representation of the flow of data through a process / system or sub-system/sub-process. It shows
what happens to the data as it goes through a process. Like a flowchart, a DFD also uses standard symbols and
notations.
3. Relationship: A relationship is an association among several entities and represents meaningful dependencies
between them. For example the association between teachers and students is teaching. It is represented by
diamond.
4. Lines: The flow of information is indicated by the lines in ER-diagram. It is simply a line. It is a connector of
entities, attributes and relationship
Case Tools:
Computer aided Software engineering tool is automatic computer based program that helps for software
engineering and SDLC process. It is very fast and effective tools for the development of big scale software. It helps in
analysis, design, implementation, testing and maintenance. Moreover it also helps in business planning, project
management, user interface designing, database designing, programming and documentation. Now visual CASE is
very popular which provides different facilities such as code generation, code conversion drag and dropped features
etc. Oracle 2000 Designer, TOAD, Visual CASE, Rational Rose and Cold Fusion are the some of the popular visual case
tool.
Chapter -2
Concept of Database.
Data:
Data is raw facts which are composed of alphabets, digits and other symbols. It may or may not give any sense.
For example: 1, Rubina, 5.4, 2,_Ram etc.
Information:
When data are processed using a database program or software, they are converted to the meaningful result,
called information. In other words, the output of data processing is called information. It is an organized collection
of related data, which gives a complete sense. Example: Information about weight of 3 students.
Height of students
1 Rubina 5.6
A database management system is computerized records keeping system. It is a software that defines, manipulates
and manages the database. It allows accessing the files, updating the records and retrieving data as requested. In
other words, DBMS is defined as the collection of interrelated data and set of programs to access those data. The
primary goal of a DBMS is to provide an efficient and effective environment for both data retrieval and storing data
in database. Commercially database management system is called database packages or also called database engine.
Some examples are FoxPro, DBase, Sybase, MS Access, My SQL, MS SQL Server, Oracle and DB2 etc.
The above figure shows the logical structure of database management system. User may be persons or
application from external environment that supplies various requests to the system. Database requests mean
the various activities from users. The database system checks for the requests and performs various
activities as per the need of users. Some major database activities are:
• Adding new file to the database
• Inserting data into the database file
• Retrieving / Viewing data from the database
• Updating data in existing database file
• Deleting data from the database file
• Removing files from the database
Advantage of DBMS:
• Sharing data: Data stored in a database can be shared. It refers to the capacity that makes data
simultaneously accessible by many users without any interference.
• Reduced data redundancy: The same data may be duplicated at many times or i , places, is called data
redundancy, DBMS reduces such type of duplication of data from database.
• Data backup and recovery: DBMS provides backup facilities to store data for future use. If any files or data
lost in any computer, it is possible to restore them from database server.
• Inconsistency avoided: When the same data is duplicated and changes are made at one site, and not on
other sites, it causes data inconsistency. DBMS avoided such type of data inconsistency. 0 Data integrity:
Data integrity means data accuracy, consistency and up to date. A DBMS should provide capabilities for
defining and enforcing constraints for data integrity.
• Data security: In database system, an unauthorized person cannot access data from database. Although
various departments may share data in database, access to specific information that can be limited to
selected users.
• Data independence: Description of the data (Schema) is stored in one central place. Therefore, applications
do not have to recompile when the format of the data changes.
• Multiple user interfaces: DBMS provides variety of interfaces for various users. It provides query language
interface, forms and command interfaces so that users interact easily with the database.
• Process complex query: It provides different methods such as View, trigger, index etc. to process complex
queries.
Disadvantage of DBMS:
13 | P a g e
• Expensive: Database software is very expensive for large computer systems. It also requires overhead costs
for maintaining and integrity functions.
• Changing technology: It is fast changing technology.
• Needs Technical Training: It is complex to understand and implement. So, proper training is required for
staff to work properly in the database system.
• Backup is needed: It needs to explicit back up. This adds costs as new storage space are needed to hold the
data.
• It is bit complex: Since it supports multiple functionality to give the user the best, the underlying
software has become complex. The designers and developers should have thorough knowledge about
the software to get the most out of it.
• More memory is needed: Because of its complexity and functionality, it uses large amount of
memory. It also needs large memory to run efficiently.
• DBMS system works on the centralized system, i.e.; all the users from all over the world access this
database. Hence any failure of the DBMS, will impact all the users.
• DBMS is generalized software, i.e.; it is written work on the entire systems rather specific one.
Hence some of the application will run slow.
Objectives of DBMS:
• It allows the growth of database system.
• DBMS provides safety mechanism for database.
• It allows multiple users to be active at one time.
• It eliminates redundant (duplicate) data.
• In DBMS, making the latest modification to the database available immediately.
• It provides storage area for mass amount of relevant data.
Database Model:
There are different forms of database management system, each characterized by the way where data are defined
and structured, called database model. It is the organizing principles of records in secondary storage. Following are
the different architectures:
• Hierarchical Database Model
• Network Database Model
• Relational Database Model
• Entity Relational Database Model
Advantages
• It is the easiest model. o It has one or more attributes.
• The searching is fast and easy, if parent is known.
• It supports one-to-one and one-to-many relationship.
Disadvantages:
• It is old fashioned, outdated database model.
• It does not support many-to-many relationship.
• The dependency on parent node is not beneficial always.
• It increases redundancy because same data is to be repeated in different places.
Assignment
1. Lists the advantages and disadvantages of DBMS.
2. Draw a figure to show example of hierarchical database model.
Advantages:
• It accepts many-to-many relationship, so it is more flexible.
• The searching is faster because of multidirectional pointers.
• The network model is simple and easy to design.
• It reduces redundancy because data shouldn’t be repeated if same data is needed.
Disadvantages:
• It is difficult to handle the relationship in complex programs.
• There is less security because of sharing data.
• It increases the processing overhead due to the complex relationship.
Advantages:
• The breaking of complex database table into simple database table becomes possible.
• Database processing is faster than other model.
• There is very less redundancy (repetition of data).
• The integrity rules can easily be implemented.
Disadvantages:
• It is more complex than other models.
• There are too many rules because of complex relationships.
16 | P a g e
• Entity − An entity in an ER Model is a real-world entity having properties called attributes. Every attribute is
defined by its set of values called domain. For example, in a school database, a student is considered as an
entity. Student has various attributes like name, age, class, etc.
• Relationship − The logical association among entities is called relationship. Relationships are mapped with
entities in various ways. Mapping cardinalities define the number of association between two entities.
Types of relationship:
• one to one
• one to many
• many to many
One-to-one: Each record in table A must have only one matching record in table B and record in table B must have
only one matching record in table A.
One-to-many: Each record in table A can have multiple matching records in table B and each record in
table B must have only one matching record in table A.
17 | P a g e
Many-to-many: Each record in table A can have multiple matching records in table B and each record in table B can
have multiple matching records in table A. This type of relationship is only possible by defining a third table which
consists of common fields or keys.
Concept of Normalization
Database Normalization is a technique of organizing the data in the database. Normalization is a systematic
approach of decomposing tables to eliminate data redundancy and undesirable characteristics like Insertion,
Update and Deletion Anomalies. It is a multi-step process that puts data into tabular form by removing
duplicated data from the relation tables.
1. 1NF
As per First Normal Form, no two Rows of data must contain repeating group of information i.e each set of
column must have a unique value, such that multiple columns cannot be used to fetch the same row. Each
table should be organized into rows, and each row should have a primary key that distinguishes it as unique.
18 | P a g e
The Primary key is usually a single column, but sometimes more than one column can be combined to create
a single primary key. For example consider a table which is not in First normal form
Student Table :
Student Age Subject
Raju 15 Biology, Maths
Suman 14 Maths
Kamal 17 Maths
In First Normal Form, any row must not have a column in which more than one value is saved, like separated
with commas. Rather than that, we must separate such data into multiple rows.
Using the First Normal Form, data redundancy increases, as there will be many columns with same data in
multiple rows but each row as a whole will be unique.
2. 2NF
As per the Second Normal Form there must not be any partial dependency of any column on primary key. It
means that for a table that has concatenated primary key, each column in the table that is not part of the
primary key must depend upon the entire concatenated key for its existence. If any column depends only on
one part of the concatenated key, then the table fails Second normal form.
In example of First Normal Form there are two rows for Raju, to include multiple subjects that he has opted
for. While this is searchable, and follows First normal form, it is an inefficient use of space. Also in the above
Table in First Normal Form, while the candidate key is {Student, Subject}, Age of Student only depends on
Student column, which is incorrect as per Second Normal Form. To achieve second normal form, it would be
helpful to split out the subjects into an independent table, and match them up using the student names as
foreign keys.
Student Subject
Raju Biology
19 | P a g e
In Subject Table the candidate key will be {Student, Subject} column. Now, both the above tables qualifies
for Second Normal Form and will never suffer from Update Anomalies. Although there are a few complex
cases in which table in Second Normal Form suffers Update Anomalies, and to handle those scenarios Third
Normal Form is there.
3. 3NF
4. Third Normal form applies that every non-prime attribute of table must be dependent on primary key, or we
can say that, there should not be the case that a non-prime attribute is determined by another non-prime
attribute. So this transitive functional dependency should be removed from the table and also the table must
be in Second Normal form. For example, consider a table with following fields.
Student_Detail Table :
Student_id Student_name DOB Street city State Zip
In this table Student_id is Primary key, but street, city and state depends upon Zip. The dependency between
zip and other fields is called transitive dependency. Hence to apply 3NF, we need to move the street, city
and state to new table, with Zip as primary key.
Primary Key : A primary key is a special relational database table column (or combination of columns) designated
to uniquely identify all table records.
A primary key’s main features are:
• It must contain a unique value for each row of data.
• It cannot contain null values.
A primary key is either an existing table column or a column that is specifically generated by the database according
to a defined sequence.
Foreign Key: A foreign key is a column or group of columns in a relational database table that provides a
link between data in two tables. It acts as a cross-reference between tables because it references the primary
key of another table, thereby establishing a link between them.
The majority of tables in a relational database system adhere to the foreign key concept. In complex
databases and data warehouses, data in a domain must be added across multiple tables, thus maintaining a
relationship between them. The concept of referential integrity is derived from foreign key theory.
Foreign keys and their implementation are more complex than primary keys.
Composite Key: A composite key, in the context of relational databases, is a combination of two or more columns
in a table that can be used to uniquely identify each row in the table. Uniqueness is only guaranteed when the
columns are combined; when taken individually the columns do not guarantee uniqueness.
20 | P a g e
Database Architecture:
The database architecture describes the organization of all database objects and how they work together. It
affects integrity, reliability and performance. The database architecture involves anything that defines the nature of
the data, data, or how the data flows.
• Centralized Database:
Centralized Database Centralized database is simple
type which works on a client-server basis. It is
located on a particular (central) location and
peripherals are connected with it to storing and
retrieving data as requirement. Centralized
database system run on a single computer system.
A computer system may be single user or multi-
user. It is only suitable for small organization and
small-scale operation. The database is centralized,
so there is no chance of data modification. Hence,
security is not so crucial part here. The
maintenance of database is easier because of data
or records are centrally stored. Since data is out
from access of unauthorized persons, so risk factors
are also minimized
Advantages:
- Cost minimizes.
- High data security.
- No duplication of data.
Disadvantages:
- Data traffic is high.
- Failure of server makes whole system down.
- it is suitable only for small organization.
It consists of only one database or server. It contains servers or database in several locations.
Less chance of data lost More chance of data theft and data lost.
Maintenance is easy and high security. Maintenance is complex and low security as compare to
centralized database system.
Failure of server makes the whole system down. Failure of one server does not make the whole system
down.
Cost of centralized database system is low. Cost of distributed system is very high.
Data Security:
Data security is protection of data in database system against unauthorized access, modification, failure, losses or
destruction. The authorized access means only right people can get the right access to the right data. There are
different causes of database physical destruction such as fire, water, heat, dust, power failure, theft etc. It might be
accidental loss or physical damage in computer system. In order to protect from such damages database is stored in
different location in different disk (RAID: Redundant Array of Independent Disk). Different types of data recovery
and data locking techniques are used for the security. Some of the data security methods are:
• Using proper backup in disks, tapes, CD etc. provides the security of data from the accidental loss.
• Making physical prevention by using stabilizer and UPS to supply a regular power through which we can
prevent hardware and software from high electricity voltage and irregular power supply.
• Using strong password protection system, making log in the system to prevent data from unauthorized
access to the database.
• By keeping the system under lock or safe place.
Responsibilities of DBA:
• DBA defines data security, data integrity, schemas, forms, reports, relationships and user privileges.
• DBA has responsibility to install, monitor and upgrade database server.
• S/he provides different facilities for data retrieving and making reports as required.
• S/he creates user manuals; gives training, describes the entire facilities offer by the system and provides
facilities to make effective use.
• S/ he have responsibility to maintain database security, backup-recovery strategy, and documentation of
data dictionary.
• S/ he supervising all the activities in the system: the addition, modification and deletion data from the
database.
Other Database Related Terms:
1. Data Dictionary: A data dictionary is a file which contains meta-data that is data about data. It is also called
information system catalogue. It keeps all the information about the database system such as location, size of the
database, tables, records, fields, user information, privileges, backup system, and recovery system etc. It also defines
the data types for each fields etc. A good data dictionary always ensures the consistency in database.
2. Data Integrity: Data Integrity referees to the validity or consistency of data in database. It ensures that the data
should be accurate and consistent. Data should be consistent and accurate as it is the basic element of database to
provide right information at right time, to take right decision and to make right planning for future. 30, data integrity
is an important step in database designing and proper decision making. If the data integrity is not maintained in a
database, then the database may have the following drawbacks.
• The unrelated data may be stored in the master and child table.
• The improper data may be stored in the column. . The data may not come from a defined domain (set of
defined data). For example: 'age' field of 'employee’ table having 500 as the data value.
• The data may not match the business rules of the business house. For example: age of an employee never is
255.
• The changes made in one table may not bring the necessary changes in other tables. For example when
’sold quantity’ of an item is inserted in ’sales’ table, then the ’stock quantity' in ’stock’ table may remain
constant.
Data Integrity Constraints:
Data integrity is preserved by using types of constraints (rules) called data integrity constraints. Mainly
there are three types of constraints are used in database system: Domain Integrity, Entity Integrity and Referential
Integrity
23 | P a g e
1 Domain Integrity Constraints: Domain integrity constraints define a set range of data values for given specific
data field. And also determines whether null values are allowed or not in the data field. For example domain
integrity checks the marks of English of students are in the range of 0 to 100 or not.
2 Entity Integrity Constraints: Entity integrity constraints specify that all rows in a table have a unique identifier,
known as the primary key value and it never be null i.e. blank. When we change the primary key value in master
table, then related key value in child table will be automatically changed. For example: entity integrity checks
whether the ’Registration no’ of two students have same value or not.
3 Referential Integrity Constraints: It exists in a relationship between the two tables in a database. It ensures that
the relationship between the primary keys in the master table and foreign key in child table are always maintained.
So it ensures that all foreign key values in a database are valid and they are referenced by the primary key values.
For example: the data value for the ’symbol no’ field in ’student’ entity and ’result’ entity should be same.
For example: CREATE table Student (SId NUMBER (4), Name CHAR (25));
DCL (Data Control Language): DCL provides additional features for security of table/ database. It includes
commands for controlling data and access to the databases. Examples of these Commands are Commit, Rollback,
Grant etc. Database Architecture The database architecture describes the organization of all database objects and
how they work together. It affects integrity, reliability and performance. The database architecture involves
anything that defines the nature of the data, the structure of the data, or how the data flows.
Assignment:
• Who is DBA? Explain the responsibilities of DBA.
• Define RDBMS. Explain advantages and disadvantages of database.
• What are domains and tuples?
• State different types of data integrity.
• What is normalization? Explain normalization with example.
• -
• -
• -
• -
• -
• -
• -
• -
• -
• -
Tuple is the collection of information about the attributes of table for single instance. In simple this also can be called
as a 'row' in a Table
Stands for "Object-Oriented Programming". OOP refers to a programming methodology based on objects,
instead of just functions and procedures. These objects are organized into classes, which allow individual
objects to be group together. Most modern programming languages including Java, C/C++, and PHP, are
object-oriented languages, and many older programming languages now have object-oriented versions.
An "object" in an OOP language refers to a specific type, or "instance," of a class. Each object has a
structure similar to other objects in the class, but can be assigned individual characteristics. An object can
also call functions, or methods, specific to that object. For example, the source code of a video game may
include a class that defines the structure of characters in the game. Individual characters may be defined as
objects, which allows them to have different appearances, skills, and abilities. They may also perform
different tasks in the game, which are run using each object's specific methods.
27 | P a g e
Object-oriented programming makes it easier for programmers to structure and organize software programs.
Because individual objects can be modified without affecting other aspects of the program, it is also easier
to update and change programs written in object-oriented languages. As software programs have grown
larger over the years, OOP has made developing these large programs more manageable.
In object oriented programming
• Bottom-up approach is followed in program design.
• New data and functions can be easily added whenever necessary.
• Data is hidden cannot be accessed by external functions.
• Functions that operate on the data of an object are tied together in the data structure.
• Data structures are designed such that they characterize the objects.
• Programs are divided into objects.
• Emphasis is on data rather than procedure.
• Objects may communicate with each other through functions.
• Data structures are designed such that they characterize the objects.
Advantages of OOP:
• We can eliminate redundant codes by using inheritance feature of OOP.
• It is very easy for managing complex and large size problems.
• The most important is the reusability of codes by using the features inheritance.
• It takes very less time for the development and maintaining the software.
• It is efficient for testing and implementation of the system.
• It follows bottom up approach; It can be implemented in the field 0f OODBMS (Object Oriented
Database Management System), OOAD (Object Oriented Analysis and Design) and other different
fields of engineering.
Disadvantages of OOP:
Object Oriented Programming has several disadvantages which made it unpopular in the early years.
• Size: Object Oriented programs are much larger than other programs. In the early days of computing,
space on hard drives, floppy drives and in memory was at a premium. Today we do not have these
restrictions.
• Effort: Object Oriented programs require a lot of work to create. Specifically, a great deal of
planning goes into an object oriented program well before a single piece of code is ever written.
Initially, this early effort was felt by many to be a waste of time. In addition, because the programs
were larger (see above) coders spent more time actually writing the program.
• Speed: Object Oriented programs are slower than other programs, partially because of their size.
Other aspects of Object Oriented Programs also demand more system resources, thus slowing the
program down.
In recent years, however, improvements in computer performance have made restrictions about size and
speed inconsequential. The question of human effort still exists, however; many novice programmers do not
like Object Oriented Programming because of the great deal of work required to produce minimal results.
28 | P a g e
Concepts of OOP:
• Object:
An object is any entity, thing or organization
that exits in real world. It consists of two
fundamentals characteristics: its attributes
and behaviors. For example: a dog is an
object having attributes such as color,
weight, age, etc. and behaviors such as
barking, wagging tail, etc. In OOP, attributes
are represented by data and behaviors are
represented by functions.
• Class:
A class is the collection of similar objects. It is defined as the template or prototype to define the
common attributes and behavior for all the objects of the class. The entire set of data and code of an
object can be made a user-defined data type with the help of a class. In fact objects are variables of
type class. Once, a class has been defined,, we can create any number of objects associated with that
class.
• Abstraction:
In OOP, data abstraction defines the conceptual boundaries of an object. These boundaries
distinguish an object from another object. So, abstraction is the act of representing essential features
without including the background details. It focuses the outside view of an object, separating its
essential behaviour from its implementation.
• Encapsulation:
Encapsulation is a way if organizing data and function into a structure by concealing the way the
object is implemented, that is preventing access to data by any means other than those specified.
Encapsulation therefore guarantees the integrity of the data contained in the object. It implies that
there is visibility to the functionalities offered by an object, and no visibility to its data
• Inheritance:
In object-oriented programming, inheritance enables new objects to take on the properties of existing
objects. A class that is used as the basis for inheritance is called a superclass or base class. A class that
inherits from a superclass is called a subclass or derived class. The terms parent class and child class are also
acceptable terms to use respectively. A child inherits visible properties and methods from its parent while
adding additional properties and methods of its own.
• Polymorphism:
The term polymorphism is formed by the combination of two Greek words: poly (means many) and
morph (means form). So, the meaning of polymorphism is having many forms. It simply means 'one
name many form'. For examples, in chemistry, carbon exhibits polymorphism because it can be
found in more than one form: graphite and diamond. Each of the form has its own distinct
properties. Polymorphism is an important feature of GOP which refers to the ability of an object to
29 | P a g e
take on different forms depending upon situations. An operation may exhibit different behaviors in
different instances. The behavior depends upon the types of data used in the operation.
Application of OOP :
The concept of object helps to translate our thoughts to a program. It provides a way of solving a problem in the same
way as a human being perceives a real world problem and finds out the solution. It is possible to construct large
reusable components using object-oriented techniques. Development of reusable components is rapidly growing in
commercial software industries.
If there is complexity in software development, object-oriented programming is the best paradigm to solve the
problem. The following areas make the use of OOP:
✓ Image Processing and Pattern Recognition
✓ Computer Aided Design and Manufacturing
✓ Object Oriented Database Management Systems
✓ Internet and Web based Applications
✓ Mobile Computing
✓ Data Warehouse and Data Mining
✓ Digital Electronics
Differences between OOP and Structured programming language:
Object Oriented Programming Language. Structure Programming Language.
OOP focus on representing problems using real-world It deals with organizing the program in the logical structure.
objects and their behavior.
Large programs are divided into objects. Large programs are divided into functions.
It uses bottom up approach of program development. It uses top down approach of program development.
Data and functions are tied together so they can't move Data move openly around the system from function to
freely. function.
The concept of encapsulation provides high level of security. Security can't be maintained because it has no such features.
New features and functions can easily be added whenever Adding new data and functions is difficult and time
required. consuming.
Developing program using OOP language is quite easier and Developing program using SPL is difficult and more time
less time consuming. consuming.
It consists of features such as data abstraction, It does not consist of those features.
encapsulation, inheritance and polymorphism.
Example: C++, Java, VB.net, C#, Python, Eiffel, Ada, etc. Examples: Pascal, C, FORTRAN, COBOL, Q-BASIC, etc.
Cyber law
Cyber law is a type of law which rules in the internet to prevent internet related crime.
Fields of cyber law
Electronic and digital signature
Computer crime
Intellectual property
Data protection and privacy
Telecommunication law
Cyber law of Nepal
Nepal cannot be isolated from emerging technology and the problems raised by the technology. The cyber law is on
the process of development. Nepal passed the Electronic Transaction and Digital Signature Act 2004, also known as
Cyber law.
The main laws are:
The law covers most of the issues related with cyber activities and is supposed to forecast to be landmark legislation
for development of IT industry in Nepal.
Conducts such as hacking, deleting data, stealing e-document, software piracy and posting offensive information are
capable of criminal and civil sanctioning under the new cyber law.
The government can punish cyber offenders with up to 5 years of imprisonment and /or fine of up to Rs. 50,000.
However, much depends on the harshness of the crime.
The law has tightened the security for banking transactions through electronics means, which should boost the
economic activities across the internet via Nepal.
It gives legal status to information posted on the websites of government offices, government run corporations and
local bodies.
It has also granted legal status to digital signatures sent through the electronic media like e-banking, e-commerce, etc.
The law has also made a new judicial body to listen to complaints, cases and matters concerning cyber crime.
Computer Crime
Computer crime has been defined broadly as a criminal act that has been committed using a computer as the primary
tool.
31 | P a g e
IT policies
The policies of IT are the action adopted for the implementation of strategies to achieve goals and fulfill the
objectives. Some of the policies of IT are as follows:
To declare information technology sectors a prioritized sector.
To provide internet facilities to all village development committees.
To render assistance to educational institutions and encourage native and foreign training.
To computerize the records of each governmental office.
To increase the use of computers in the private sector.
To develop physical and virtual information technology park.
To use information-technology to promote e-commerce, e-education, e-health, among others.
To establish National Information Technology Centre.
To establish a national level fund by mobilizing the resources.
To establish Nepal in the global market through the use of information technology.
Artificial Intelligence
Artificial Intelligence (AI) and it's application areas
Artificial Intelligence (AI) is a branch of computer science which is concerned with programs that solves and analyze
problems intelligently.
The applications of AI are as:
Game playing: Ai emerges and gives new height for dull machines on the field of game playing. Some intelligence
programming is far better than human brain.
Expert systems: it is computer programming to make decisions in real life situations. AI based computer system can
decide and think itself for desired result what is to be happened.
Pattern detection: it detects most common patterns for authentication, for example thumb detection, iris detection, etc.
This is most widely used tools for security purpose which once stored in database.
Natural Language Processing: NLP is a branch of artificial intelligence that deals with analyzing understanding and
generating the languages that human use naturally in order to interface with computers in both written and spoken.
Automated operation: AI is used to automate satellite, space shuttle, airplane without pilot, etc. Without any technical
human being, the system automatically handle a and controls the systems that are already set in that corresponding
instruction with logics and mathematics.
Robotics: robots are used in many fields like in space, medicine, and research etc. Now a days, robots are broadly
using in surgery for operation micro level surgery for operation micro-level surgery.
components of AI
32 | P a g e
Search: this intelligence is used to search solution of particular problem like possibilities of moves on chess playing
game. Searching is very important and needs to be very fast and must search with accuracy. So AI based system is
useful for particular problem oriented search easily.
Pattern recognization: it is used to recognize some type of figures, images or audio sounds. Its application is used for
the authentication like face detection, iris detection, voice recognization, etc.
Logic generate: as the name suggest, AI is intelligence with creating logic in different problems. Logic in terms of
predicate basis or whatever, this system creates logic for solving the any kind of related problems as per the AI related
system and software.
Common sense and reasoning: the main goal of AI is to produce good reasoning power and produce logic. This
reasoning power and logic made machines like human.
Learning from experience: AI programming is built to learn from the experiences like human being. Although
learning are limited with comparison to the human beings and also depends on the programming language used.
Genetic programming: AI programs are used to solve relationship between humans. As we see in genetically there is
inheritance properties that can help the future prediction.
Neural network: AI technique that mimics the operation of the human brain that refers to nerves and neurons, and
comprises of densely interconnected processors working simultaneously that means parallel.
Ethical aspect of AI
AI can be used for good or bad. This is why it's important to think about what AI is, and how we want it to be used.
Some ethical aspects of AI are:
AI builders have an obligation not to exploit people's ignorance and make them think. AI is human.
Robots are not really your friends. They may be harmful for individuals. So developers should be ethical. Use of AI
must obey the social norms and values.
Use of AI should be under the intellectual property rights.
Contemporary Technology
Disadvantages of e-commerce:
33 | P a g e
a. Any one, good or bad can easily start a business. And there are many bad sites which eat up customer's money.
b. There is no guarantee of product quality.
c. Mechanical failures can cause unpredictable effects on the total processes.
d. As there is minimum chance of direct customer to company interactions, customer loyalty is always on a check.
e. There are many hackers who look for opportunities and thus an ecommerce site, service payment gateways all are
always prone attack.
E-learning
E-learning is a new concept of delivering digital contents in learner oriented environment using information and
communication te4chnology (ICT). Delivery of the digital content is the main characteristic of e-learning.
Advantages of e-learning:
It maintains the consistency of content.
It is easy for customization.
There is no any geographical limitation for learning.
It is quite favorable for learner as it can happen at any time and anywhere.
It reduces or eliminates travel costs to attend learning events.
It reduces or eliminates need for classroom/instructor infrastructure.
Disadvantages of e-learning:
Learners with low motivation or bad study habits may fall behind
Without the routine structures of a traditional class, students may get lost or confused about course activities and
deadlines
Students may feel isolated from the instructor and classmates
Instructor may not always be available when students are studying or need help
Slow Internet connections or older computers may make accessing course materials frustrating
Managing computer files and online learning software can sometimes seem complex for students with beginner-level
computer skills
Hands-on or lab work is difficult to simulate in a virtual classroom.
E-governance
E-governance is the application of electronic means to improve the interaction between government and citizens; and
to increase the administrative effectiveness and efficiency in the internal government operations.
Despite the government of Nepal has positively giving attention towards the development of ICTs and subsequent
implementing e-governance, a number of issues has yet addressed. Some of the challenges for successful
implementation of e-governance are presented as:
Information transparency
Legal issues
Resources availability
Infrastructure including connectivity in rural area
Capacity and awareness
Political will and government action
34 | P a g e
Advantages of E-governance
E-Governance offers many benefits and advantages for the government, corporate sector and society. E-Governance
facilitates better delivery of government services to citizens, improved interactions with business and industry, citizen
empowerment through access to information, or more efficient government management. It simplifies internal
operations and improves performance of government departments while helping all sections of society to avail
government services at lower cost with maximum ease of use.
Virtual reality
Virtual reality is a new computational paradigm that redefines the interface between human and computer becomes a
significant and universal technology and subsequently penetrates applications for education and learning.
Application fields of Virtual reality
Virtual Reality in the Military: A virtual reality simulation enables them to do so but without the risk of death or a
serious injury. They can re-enact a particular scenario, for example engagement with an enemy in an environment in
which they experience this but without the real world risks.
Virtual Reality in Education: Education is another area which has adopted virtual reality for teaching and learning
situations. The advantage of this is that it enables large groups of students to interact with each other as well as within
a three dimensional environment.
Virtual Reality in Healthcare: Healthcare is one of the biggest adopters of virtual reality which encompasses surgery
simulation, phobia treatment, robotic surgery and skills training.
Virtual Reality in Business: Many businesses have embraced virtual reality as a cost effective way of developing a
product or service. For example it enables them to test a prototype without having to develop several versions of this
which can be time consuming and expensive.
Virtual Reality in Engineering: Virtual reality engineering includes the use of 3D modelling tools and visualization
techniques as part of the design process. This technology enables engineers to view their project in 3D and gain a
greater understanding of how it works. Plus they can spot any flaws or potential risks before implementation.
Virtual Reality and Scientific Visualization: Virtual reality is being increasingly used in the field of scientific
visualization. This field is based upon using computer graphics to express complex ideas and scientific concepts, for
example molecular models or statistical results.
Virtual Reality Programming Languages: For virtual reality to be truly effective, it must have a good sense of realism.
Just on its own this is a technical challenge and, as such, virtual reality is highly demanding on many resources. From
hardware performance to the intellectual ability of the implementer of the system, how these are managed are a
massive issue.
.E-medicine
E-medicine refers to an approach that provides medical services whenever and wherever required using information
and communication technology.
With the help of this approach, even small number of doctors can provide medical service to large number of people
scattered in different locations. The people of rural areas who are unable to get service of doctors can be benefitted
from this approach. The patients share his/her medical problems to the doctors. This approach is now getting more
popularity among the doctors too. They can post their experiences and issues in the online discussion forum. Without
good facility of information and communication technology, e-medicine cannot be effective. This is the problem
facing in the developing countries like Nepal.
35 | P a g e
1. break statement is used in switch and loops. continue statement is used in loops only.
When break is encountered the switch or loop When continue is encountered, the statements after it
2. execution is immediately stopped. are skipped and the loop control jump to next iteration.
Example:
Example: #include<stdio.h>
int main()
#include<stdio.h> {
int main() int i;
{ for(i=0;i<5;++i)
int i; for(i=0;i<5;++i) {
if(i==3)
{ if(i==3) continue;
break; printf(“%d “,i);
printf(“%d “,i); }
} return 0;
return 0; }
}
3. Output:
012 Output:
37 | P a g e
0124
3. Network Layer: This layer is concerned with transmission of packet. N/w layer protocol chooses the best path to
send a package called routing. Two protocols are widely used in n/w layer.
i. X.25 Protocol
ii. Internet Protocol
4. Transport Layer: It provides the mechanism for the exchange of data between end systems. It ensures that the
data received is in fact in order. Following jobs are performed by this layer.
i. Port Addressing
ii. Segmentation & Reassemble
iii. Connection Control
5. Session Layer: It is responsible for requesting logical connection to be established for communication process.
This logical connection is termed as session. It also provides data synchronization between two communication
terminals.
6. Presentation layer: This layer translates format data to adapt to the needs of the application layer & nodes at both
receiving & sending end of communication process. It handles data communication, formatting, encryption,
decryption, etc.
7. Application Layer: It is the top-most layer of OSI model & provides user access to the n/w. It provides services
that support user application, such as database access, email & file transfer, etc.
IP address: this is a code made up of numbers separated by three dots that identifies a particular computer on the
Internet. Every computer, whether it is a Web server or the computer you're using right now, requires an IP address to
connect to the Internet. IP addresses consist of four sets of numbers from 0 to 255, separated by three dots. For
example "66.72.98.236" or "216.239.115.148". Your Internet Service Provider (ISP), will assign you either a static IP
address (which is always the same) or a dynamic IP address, (which changes every time you log on).
MAC address: Stands for "Media Access Control Address," and no, it is not related Apple Macintosh computers. A
MAC address is a hardware identification number that uniquely identifies each device on a network. The MAC
address is manufactured into every network card, such as an Ethernet card or Wi-Fi card, and therefore cannot be
changed.
Repeater: Network repeaters regenerate incoming electrical, wireless or optical signals. With physical media like
Ethernet or Wi-Fi, data transmissions can only span a limited distance before the quality of the signal degrades.
Repeaters attempt to preserve signal integrity and extend the distance over which data can safely travel.
Bridge: In telecommunication networks, a bridge is a product that connects a local area network (LAN) to another
local area network that uses the same protocol (for example, Ethernet or token ring). You can envision a bridge as
being a device that decides whether a message from you to someone else is going to the local area network in your
building or to someone on the local area network in the building across the street. A bridge examines each message
38 | P a g e
on a LAN, "passing" those known to be within the same LAN, and forwarding those known to be on the other
interconnected LAN (or LANs).
Protocol: A standard set of regulations and requirements that allow two electronic items to connect to and exchange
information with one another. Protocols regulate data transmission among devices as well as within a network of
linked devices through both error control and specifying which data compression method to use. In particular,
protocols decide: the method of error checking, how to compact data (if required), how the transmitting device signals
that it has concluded sending data, and how the receiving device signals that it has completed receiving data.
Wi-Fi: Wi-Fi is the name of a popular wireless networking technology that uses radio waves to provide wireless high-
speed Internet and network connections. A common misconception is that the term Wi-Fi is short for "wireless fidelity,"
however this is not the case. Wi-Fi is simply a trademarked phrase that means IEEE 802.11x.
C Programming
C Programming Language
C language is a general purpose and structured programming language developed by 'Dennis Ritchie' at AT
&T's Bell Laboratories in the 1972s in USA.
It is also called as 'Procedure oriented programming language.'
C is not specially designed for specific applications areas like COBOL (Common Business-Oriented
Language) or FORTRAN (Formula Translation). It is well suited for business and scientific applications. It
has some various features like control structures, looping statements, arrays, macros required for these
applications.
The C language has following numerous features as:
• Portability
• Flexibility
• Effectiveness and efficiency
• Reliability
• Interactivity
Execution of C Program :
C program executes in following 4 (four steps).
1. Creating a program :
An editor like notepad or wordpad C Editor is used to create a C program. This file contains a source code
which consists of executable code. The file should be saved as '*.c' extension only.
39 | P a g e
History of C :
Year of
Language Name Developed By
Establishment
The development of C was a cause of evolution of programming languages like Algol 60, CPL
(Combined Programming Langauge), BCPL (Basic Combined Programming Language) and B.
• Algol-60 : (1963) :
ALGOL is an acronym for Algorithmic Language. It was the first structured procedural
programming language, developed in the late 1950s and once widely used in Europe. But it was
too abstract and too general structured langauage.
• CPL : (1963) :
CPL is an acronym for Combined Programming Language. It was developed at Cambridge
University.
• BCPL : (1967) :
BCPL is an acronym for Basic Combined Programming Language. It was developed by Martin
Richards at Cambridge University in 1967. BCPL was not so powerful. So, it was failed.
• B : (1970) :
B language was developed by Ken Thompson at AT & T Bell Laboratories in 1970. It was machine
dependent. So, it leads to specific problems.
40 | P a g e
• C : (1972) :
'C' Programming Langauage was developed by Dennis Ritchie at AT & T Bell Laboratories in
1972. This is general purpose, compiled, structured programming langauage. Dennis Ritchie
studied the BCPL, then improved and named it as 'C' which is the second letter of BCPL
Structure of C Program
The basic structure of C program is as follow:
Document Section
Links Section (File)
Definition Section
Global variable declaration Section
void main()
{
Variable declaration section
Function declaration section
executable statements;
}
Function definition 1
---------------------
---------------------
Function definition n where,
Document Section : It consists of set of comment lines which include name of a program, author
name, creation date and other information.
Links Section (File) : It is used to link the required system libraries or header files to excute a
program.
Definition Section : It is used to define or set values to variables.
Global variable declaration Section : It is used to declare global or public variable.
void main() : Used to start of actual C program. It includes two parts as declaration part and
executable part.
Variable declaration section : Used to declare private variable.
Function declaration section : Used to declare functions of program from which we get required
output.
Then, executable statements are placed for execution.
Function definition section : Used to define functions which are to be called from main().
Character Set :
A character refers to the digit, alphabet or special symbol used to data represetation.
1. Alphabets : A-Z, a-z
2. Digits : 0-9
3. Special Characters : ~ ! @ # $ % ^ & * ( ) _ + { } [ ] - < > , . / ? \ | : ; " '
4. White Spaces : Horizontal tab, Carriage return, New line, form feed
Identifier :
Identifier is the name of a variable that is made up from combination of alphabets, digits and
underscore.
Variable :
41 | P a g e
It is a data name which is used to store data and may change during program execution. It is
opposite to constant. Variable name is a name given to memory cells location of a computer
where data is stored.
* Rules for varibales:
• First character should be letter or alphabet.
• Keywords are not allowed to use as a variable name.
• White space is not allowed.
• C is case sensitive i.e. UPPER and lower case are significant.
• Only underscore, special symbol is allowed between two characters.
• The length of indentifier may be upto 31 characters but only only the first 8 characters are
significant by compiler.
• (Note: Some compilers allow variable names whose length may be upto 247 characters.
But, it is recommended to use maximum 31 characters in variable name. Large variable name
leads to occur errors.)
Keywords :
Keywords are the system defined identifiers.
All keywords have fixed meanings that do not change.
White spaces are not allowed in keywords.
Keyword may not be used as an indentifier.
It is strongly recommended that keywords should be in lower case letters.
There are totally 32(Thirty Two) keywords used in a C programming.
int float double long
short signed unsigned const
if else switch break
default do while for
register extern static struct
typedef enum return sizeof
goto union auto case
void char continue volatile
\b Backspace
\t Horizontal Tab
42 | P a g e
\f Form feed
\r Carriage Return
\v Vertical Tab
\? Question Mark
\\ Backslash
\0 Null
Constants in C :
A constant is an entity that doesn't change during the execution of a program.
Followings are the different types of constants :
1. REAL CONSTANT :
• It must have at least one digit.
• It must have a decimal point which may be positive or negative.
• Use of blank space and comma is not allowed between real constants.
• Example:
+194.143, -416.41
2. INTEGER CONSTANT :
• It must have at least one digit.
• It should not contain a decimal place.
• It can be positive or negative.
• Use of blank space and comma is not allowed between real constants.
• Example:
4. STRING CONSTANT :
• It is collection of characters enclosed in double quotes.
• It may contain letters, digits, special characters and blank space.
• Example:
"Depot School"
Data Types in C :
"Data type can be defined as the type of data of variable or constant store."
When we use a variable in a program then we have to mention the type of data. This can be
handled using data type in C.
Followings are the most commonly used data types in C.
* QUALIFIER :
When qualifier is applied to the data type then it changes its size.
Size qualifiers : short, long
Sign qualifiers : signed, unsigned
Example:
#include <stdio.h>
int main()
{
enum Days{Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday};
Days TheDay;
int j = 0;
printf("Please enter the day of the week (0 to 6)\n");
scanf("%d",&j);
TheDay = Days(j);
if(TheDay == Sunday || TheDay == Saturday)
printf("Hurray it is the weekend\n");
else
printf("Curses still at work\n");
return 0;
}
* TYPEDEF :
It is used to create new data type. But it is commonly used to change existing data type with
another name.
Syntax:
typedef [data_type] synonym;
OR typedef [data_type] new_data_type;
Example:
#include <stdio.h>
void main ()
{
typedef int my_type;
my_type var1, var2, var3;
var1 = 10;
var2 = 20;
var3 = 30;
}
Operators in C :
"Operator is a symbol that is used to perform mathematical operations."
When we use a variable in a program then we have to mention the type of data. This can be
handled using data type in C.
Followings are the most commonly used data types in C.
#include <stdio.h>
#include <conio.h>
Assignment = void main()
{
45 | P a g e
int a,b;
clrscr();
a = 53;
printf("\n\t Value of A :
%d",a); // 53
b = a; // Interchange of value
using assignment
printf("\n\n\t Value of B :
%d",b); // 53
getch();
}
#include <stdio.h>
#include <conio.h>
void main()
{
int a,b,c,d,e,f,g;
clrscr();
printf("\n\t Enter First Number
:"); // 5
scanf("%d",&a);
printf("\n\t Enter Second
Number :"); // 2
scanf("%d",&b);
c = a + b;
printf("\n\n\t Addition is :
Arithmetic +, -, *, /, % %d",c); // 7
d = a - b;
printf("\n\n\t Subtraction is :
%d",d); // 3
e = a * b;
printf("\n\n\t Multiplication
is : %d",e); // 10
f = a / b;
printf("\n\n\t Division is :
%d",f); // 2
g = a % b;
printf("\n\n\t Modulus is :
%d",g); // 1
getch();
}
#include <stdio.h>
Logical &&, ||, ! #include <conio.h>
46 | P a g e
void main()
{
int no1=2, no2=5;
clrscr();
printf("\n\n %d",(no1 &&
no2)); // returns 1
printf("\n\n %d",(no1 ||
no2)); // returns 1
getch();
}
#include <stdio.h>
#include <conio.h>
void main()
{
int a=6, b=2;
clrscr();
Relational <, >, <=, >=, ==, != printf("\n\n A<=B :
%d",(a<=b)); // 0 - False
printf("\n\n A>B : %d",(a>b));
// 1 - True
printf("\n\n A!=B :
%d",(a!=b)); // 1 - True
getch();
}
#include <stdio.h>
#include <conio.h>
void main()
{
int a,b;
clrscr();
a = 18;
b = 4;
printf("\n\t Value of A :
Shorthand +=, -=, *=, /=, %= %d",a); // 18
printf("\n\t Using of B :
%d",b); // 4
b += a ; // b = b + a
printf("\n\n\t Using += (i.e
b=b+a): %d",b); // 22
// Change the operator as -=,
*=, /=, %=
getch();
}
47 | P a g e
#include <stdio.h>
#include <conio.h>
void main()
{
int a=4, b;
clrscr();
printf("\n\n Value of A :
%d",a); // 4
a++; // Post
printf("\n\n Value of A :
%d",a); // 5
++a; // Pre
printf("\n\n Value of A :
%d",a); // 6
Unary ++, -- b=--a;
printf("\n\n Value of A :
%d",a); // 5
printf("\n\n Value of B :
%d",b); // 5
b=a++;
printf("\n\n Value of A :
%d",a); // 6
printf("\n\n Value of B :
%d",b); // 5
b++;
printf("\n\n Value of B :
%d",b); // 6
getch();
}
#include <stdio.h>
#include <conio.h>
void main()
{
int a, b=3;
clrscr();
a = 5;
Conditional ()?:; printf("\n\n A is less than B ?
");
// No
getch();
}
48 | P a g e
#include <stdio.h>
#include <conio.h>
void main()
{
int a=2, b=3,c;
Bitwise &, |, ^, <<, >>, ~ clrscr();
c =a|b;
printf("\n%d\n",c);
getch();
}
Syntax:
if(condition)
{
statements;
}
Example:
#include <stdio.h>
#include <conio.h>
void main()
{
int a;
a=5;
clrscr();
if(a>4)
printf("\nValue of A is greater than 4 !");
if(a==4)
printf("\n\n Value of A is 4 !");
getch();
}
2. If-Else Statement
Syntax:
if(condition)
{
true statements;
}
else
{
false statements;
}
Example:
#include <stdio.h>
#include <conio.h>
void main()
{
int no;
clrscr();
printf("\n Enter Number :");
scanf("%d",&no);
if(no%2==0)
printf("\n\n Number is even !");
else
printf("\n\n Number is odd !");
getch();
50 | P a g e
It is a conditional statement which is used when we want to check more than 1 conditions at a
time in a same program. The conditions are executed from top to bottom checking each condition
whether it meets the conditional criteria or not. If it found the condition is true then it executes the
block of associated statements of true part else it goes to next condition to execute.
Syntax:
if(condition)
{
if(condition)
{
statements;
}
else
{
statements;
}
}
else
{
statements;
}
Example:
#include <stdio.h>
#include <conio.h>
void main()
{
int no;
clrscr();
printf("\n Enter Number :");
scanf("%d",&no);
if(no>0)
{
printf("\n\n Number is greater than 0 !");
}
else
{
if(no==0)
{
printf("\n\n It is 0 !");
}
else
{
printf("Number is less than 0 !");
51 | P a g e
}
}
getch();
}
4. Switch Case
Syntax:
switch(expression)
{
case expr1:
statements;
break;
case expr2:
statements;
break;
case exprn:
statements;
break;
default:
statements;
}
In above syntax, switch, case, break are keywords.
expr1, expr2 are known as 'case labels.'
Statements inside case expression need not to be closed in braces.
Break statement causes an exit from switch statement.
Default case is optional case. When neither any match found, it executes.
Program :
#include <stdio.h>
#include <conio.h>
void main()
{
int no;
52 | P a g e
clrscr();
printf("\n Enter any number from 1 to 3 :");
scanf("%d",&no);
switch(no)
{
case 1:
printf("\n\n It is 1 !");
break;
case 2:
printf("\n\n It is 2 !");
break;
case 3:
printf("\n\n It is 3 !");
break;
default:
printf("\n\n Invalid number !");
}
getch();
}
for loop
In above syntax, the given three expressions are seperated by ';' (Semicolon)
Features :
• More concise
• Easy to use
• Highly flexible
• More than one variable can be initilized.
• More than one increments can be applied.
• More than two conditions can be used.
Program :
#include <stdio.h>
#include <conio.h>
void main()
{
int a;
clrscr();
for(i=0; i<5; i++)
{
printf("\n\t FundamentalOfComputing"); // 5 times
}
getch();
}
for(a=1;a<=3;a++)
{
Printf(("a=%d\n”,a);
}
}
getch();
}
while loop:
This is an entry controlled looping statement. It is used to repeat a block of statements until
condition becomes true.
Syntax:
while(condition)
{
statements;
increment/decrement;
}
In above syntax, the condition is checked first. If it is true, then the program control flow goes
inside the loop and executes the block of statements associated with it. At the end of loop
increment or decrement is done to change in variable value. This process continues until test
condition satisfies.
Program :
#include <stdio.h>
#include <conio.h>
void main()
{
int a;
clrscr();
a=1;
while(a<=5)
{
printf("\n Depot School Dharan");
a+=1 // i.e. a = a + 1
}
getch();
}
Do-While loop :
This is an exit controlled looping statement.
Sometimes, there is need to execute a block of statements first then to check condition. At that
time such type of a loop is used. In this, block of statements are executed first and then condition
is checked.
Syntax:
do
{
statements;
(increment/decrement);
55 | P a g e
}while(condition);
In above syntax, the first the block of statements are executed. At the end of loop, while statement
is executed. If the resultant condition is true then program control goes to evaluate the body of a
loop once again. This process continues till condition becomes true. When it becomes false, then
the loop terminates.
Note: The while statement should be terminated with ; (semicolon).
Program :
#include <stdio.h>
#include <conio.h>
void main()
{
int a;
clrscr();
a=1;
do
{
printf("\n\t FundamentalOfComputing"); // 5 times
a+=1; // i.e. a = a + 1
}while(a<=5);
a=6;
do
{
printf("\n\n\t Technowell"); // 1 time
a+=1; // i.e. a = a + 1
}while(a<=5);
getch();
}
Break Statement :
Sometimes, it is necessary to exit immediately from a loop as soon as the condition is satisfied.
When break statement is used inside a loop, then it can cause to terminate from a loop. The
statements after break statement are skipped.
Syntax :
break;
Figure :
Program :
#include <stdio.h>
#include <conio.h>
void main()
{
int i;
clrscr();
56 | P a g e
for(i=1; ; i++)
{
if(i>5)
break;
printf("%d",i); // 5 times only
}
getch();
}
Output :
12345
Continue Statement :
Sometimes, it is required to skip a part of a body of loop under specific conditions. So, C supports
'continue' statement to overcome this anomaly.
The working structure of 'continue' is similar as that of that break statement but difference is that it
cannot terminate the loop. It causes the loop to be continued with next iteration after skipping
statements in between. Continue statement simply skips statements and continues next iteration.
Syntax :
continue;
Figure :
Program :
#include <stdio.h>
#include <conio.h>
void main()
{
int i;
clrscr();
for(i=1; i<=10; i++)
{
if(i==6)
continue;
printf("\n\t %d",i); // 6 is omitted
}
getch();
}
Output :
1
2
3
4
5
7
8
57 | P a g e
9
10
Goto Statement :
It is a well known as 'jumping statement.' It is primarily used to transfer the control of execution to
any place in a program. It is useful to provide branching within a loop.
When the loops are deeply nested at that if an error occurs then it is difficult to get exited from
such loops. Simple break statement cannot work here properly. In this situations, goto statement
is used.
Syntax :
goto [expr];
Figure :
Program :
#include <stdio.h>
#include <conio.h>
void main()
{
int i=1, j;
clrscr();
while(i<=3)
{
for(j=1; j<=3; j++)
{
printf(" * ");
if(j==2)
goto stop;
}
i = i + 1;
}
stop:
printf("\n\n Exited !");
getch();
}
Output :
* *
Exited
Contents :
1. Functions
2. Types of Functions :
3. Built In Functions
4. User Defined Functions
5. Function Call By Passing Value
58 | P a g e
1. Built in Functions :
These functions are also called as 'library functions'. These functions are provided by system.
These functions are stored in library files. e.g.
• scanf()
• printf()
• strcpy
• strlwr
• strcmp
• strlen
• strcat
1. User Defined Functions :
The functions which are created by user for program are known as 'User defined functions'.
Syntax:
void main()
{
// Function prototype
<return_type><function_name>([<argu_list>]);
// Function Call
<function_name>([<arguments>]);
}
// Function definition
<return_type><function_name>([<argu_list>]);
{
<function_body>;
}
Program :
#include <stdio.h>
#include <conio.h>
void add()
59 | P a g e
{
int a, b, c;
clrscr();
printf("\n Enter Any 2 Numbers : ");
scanf("%d %d",&a,&b);
c = a + b;
printf("\n Addition is : %d",c);
}
void main()
{
void add();
add();
getch();
}
Output :
Enter Any 2 Numbers : 23 6
Addition is : 29
// Declaration
void <function_name>(<data_type><var_nm>);
// Calls
<function_name>(<var_nm>);
// Definition
void <function_name>(<data_type><var_nm>);
{
<function_body>;
- - - - - - - -;
}
Program :
#include <stdio.h>
#include <conio.h>
void printno(int a)
{
printf("\n Number is : %d", a);
}
void main()
{
60 | P a g e
int no;
void printno(int);
clrscr();
printf("\n Enter Number : ");
scanf("%d", &no);
printno(no);
getch();
}
Output :
Enter Number : 21
Number is : 21_
// Declaration
<data_type><function_name>();
// Calls
<variable_of_function>=<function_nm>();
// Definition
<data_type><function_name>()
{
<function_body>;
- - - - - - - -;
return <variable_of_function>;
}
Program :
#include <stdio.h>
#include <conio.h>
int number()
{
int no;
printf("\n Enter Number : ");
scanf("%d",&no);
return no;
}
void main()
{
int no;
int number();
61 | P a g e
clrscr();
no = number();
printf("\n Number is : %d",no);
getch();
}
Output :
Enter Number : 5
Number is : 5_
#include <stdio.h>
#include <conio.h>
int number(int n)
{
return n;
}
void main()
{
int number(int);
int a = number(4);
clrscr();
printf("\n Number is : %d",a);
getch();
}
Output :
Number is : 4_
Recursion()
{
printf("Recursion !");
Recursion();
62 | P a g e
}
Program :
#include <stdio.h>
#include <conio.h>
Recursion()
{
int no;
printf("\nRecursion... ");
printf("\n\n Enter Number : ");
scanf("%d",&no);
if (no==3)
exit(0);
else
Recursion();
}
void main()
{
clrscr();
Recursion();
}
Output :
Recursion...
Enter Number : 2
Recursion...
Enter Number : 1
Recursion...
Enter Number : 3_
Function Advantages :
• It is easy to use.
• Debugging is more suitable for programs.
• It reduces the size of a program.
• It is easy to understand the actual logic of a program.
• Highly suited in case of large programs.
• By using functions in a program, it is possible to construct modular and structured programs.
Storage Class :
'Storage' refers to the scope of a variable and memory allocated by compiler to store that variable.
Scope of a variable is the boundary within which a varible can be used. Storage class defines the
the scope and lifetime of a variable.
63 | P a g e
From the point view of C compiler, a variable name identifies physical location from a computer
where varaible is stored. There are two memory locations in a computer system where variables
are stored as : Memory and CPU Registers.
Functions of storage class :
To detemine the location of a variable where it is stored ?
Set initial value of a variable or if not specified then setting it to default value.
Defining scope of a variable.
To determine the life of a variable.
Types of Storage Classes :
Storage classes are categorized in 4 (four) types as,
Example :
auto int a;
Program :
#include <stdio.h>
#include <conio.h>
void main()
{
auto int i=10;
clrscr();
{
auto int i=20;
printf("\n\t %d",i);
}
printf("\n\n\t %d",i);
getch();
}
Output :
20
10
Example :
register int a;
When the calculations are done in CPU, then the value of variables are transferred from main
memory to CPU. Calculations are done and the final result is sent back to main memory. This
leads to slowing down of processes.
Register variables occur in CPU and value of that register variable is stored in a register within
that CPU. Thus, it increases the resultant speed of operations. There is no waste of time, getting
variables from memory and sending it to back again.
It is not applicable for arrays, structures or pointers.
It cannot not used with static or external storage class.
Unary and address of (&) cannot be used with these variables as explicitly or implicitly.
Program :
#include <stdio.h>
#include <conio.h>
void main()
{
register int i=10;
clrscr();
{
register int i=20;
printf("\n\t %d",i);
}
printf("\n\n\t %d",i);
getch();
}
Output :
20
10
Example :
static int a;
Program :
#include <stdio.h>
#include <conio.h>
void main()
{
int i;
void incre(void);
clrscr();
for (i=0; i<3; i++)
incre();
getch();
}
void incre(void)
{
int avar=1;
static int svar=1;
avar++;
svar++;
printf("\n\n Automatic variable value : %d",avar);
printf("\t Static variable value : %d",svar);
}
Output :
Automatic variable value : 2 Static variable value : 2
Automatic variable value : 2 Static variable value : 3
Automatic variable value : 2 Static variable value : 4_
Syntax :
Example :
extern int a;
The variable access time is very fast as compared to other storage classes. But few registers are
available for user programs.
The variables of this class can be referred to as 'global or external variables.' They are declared
outside the functions and can be invoked at anywhere in a program.
Program :
#include <stdio.h>
#include <conio.h>
Output :
20
10_
Array :
Array is a collection of homogenous data stored under unique name. The values in an array is
called as 'elements of an array.' These elements are accessed by numbers called as 'subscripts or
index numbers.' Arrays may be of any variable type.
Array is also called as 'subscripted variable.'
Types of an Array :
1. One / Single Dimensional Array
2. Two Dimensional Array
Single / One Dimensional Array :
The array which is used to represent and store data in a linear form is called as 'single or one
dimensional array.'
Syntax:
67 | P a g e
Example:
In above example, a is an array of type integer which has storage size of 3 elements. The total
size would be 3 * 2 = 6 bytes.
* MEMORY ALLOCATION :
Program :
#include <stdio.h>
#include <conio.h>
void main()
{
int a[3], i;;
clrscr();
printf("\n\t Enter three numbers : ");
for(i=0; i<3; i++)
{
scanf("%d", &a[i]); // read array
}
printf("\n\n\t Numbers are : ");
for(i=0; i<3; i++)
{
printf("\t %d", a[i]); // print array
}
getch();
}
Output :
Numbers are : 9 4 6_
68 | P a g e
Features :
• Array size should be positive number only.
• String array always terminates with null character ('\0').
• Array elements are countered from 0 to n-1.
• Useful for multiple reading of elements (numbers).
Disadvantages :
• There is no easy method to initialize large number of array elements.
• It is difficult to initialize selected elements.
Example:
int a[3][3];
In above example, a is an array of type integer which has storage size of 3 * 3 matrix. The total
size would be 3 * 3 * 2 = 18 bytes.
It is also called as 'multidimensional array.'
* MEMORY ALLOCATION :
Program :
#include <stdio.h>
#include <conio.h>
void main()
{
int a[3][3], i, j;
clrscr();
printf("\n\t Enter matrix of 3*3 : ");
for(i=0; i<3; i++)
{
for(j=0; j<3; j++)
{
scanf("%d",&a[i][j]); //read 3*3 array
}
}
printf("\n\t Matrix is : \n");
for(i=0; i<3; i++)
69 | P a g e
{
for(j=0; j<3; j++)
{
printf("\t %d",a[i][j]); //print 3*3 array
}
printf("\n");
}
getch();
}
Output :
Matrix is :
3 4 5
6 7 2
1 2 3_
Structure :
Structure is user defined data type which is used to store heterogeneous data under unique
name. Keyword 'struct' is used to declare structure.
The variables which are declared inside the structure are called as 'members of structure'.
Syntax:
struct structure_nm
{
<data-type> element 1;
<data-type> element 2;
- - - - - - - - - - -
- - - - - - - - - - -
<data-type> element n;
}struct_var;
Example :
70 | P a g e
struct emp_info
{
char emp_id[10];
char nm[100];
float sal;
}emp;
Note :
1. Structure is always terminated with semicolon (;).
2. Structure name as emp_info can be later used to declare structure variables of its type in a
program.
* INSTANCES OF STRUCTURE :
Instances of structure can be created in two ways as,
Instance 1:
struct emp_info
{
char emp_id[10];
char nm[100];
float sal;
}emp;
Instance 2:
struct emp_info
{
char emp_id[10];
char nm[100];
float sal;
};
struct emp_info emp;
In above example, emp_info is a simple structure which consists of stucture members as
Employee ID(emp_id), Employee Name(nm), Employee Salary(sal).
* ACEESSING STRUCTURE MEMBERS :
Structure members can be accessed using member operator '.' . It is also called as 'dot operator'
or 'period operator'.
structure_var.member;
Program :
#include <stdio.h>
#include <conio.h>
struct comp_info
{
71 | P a g e
char nm[100];
char addr[100];
}info;
void main()
{
clrscr();
printf("\n Enter Company Name : ");
gets(info.nm);
printf("\n Enter Address : ");
gets(info.addr);
printf("\n\n Company Name : %s",info.nm);
printf("\n\n Address : %s",info.addr);
getch();
}
Output :
Enter Company Name : CODES
Enter Address : Dharan-9
Pointer :
Pointer is a variable which holds the memory address of another variable. Pointers are
represented by '*'. It is a derive data type in C. Pointer returns the value of stored address.
Syntax:
<data_type> *pointer_name;
In above syntax,
* = variable pointer_name is a pointer variable.
pointer_name requires memory location
pointer_name points to a variable of type data type.
How to Use ?
int *tot;
Illustration :
Figure :
72 | P a g e
In above example, the statement instructs the system to find out a location for integer variable
quantity and puts the values 95 in that memory location.
* Features of Pointer :
Program :
#include <stdio.h>
#include <conio.h>
void main()
{
int a=10;
int *ptr;
clrscr();
ptr = &a;
printf("\n\t Value of a : %d", a);
scanf("\n\n\t Value of pointer ptr : %d", *ptr);
printf("\n\n\t Address of pointer ptr : %d", ptr);
getch();
}
Output :
Value of a : 10
Union :
Union is user defined data type used to stored data under unique variable name at single memory
location.
Union is similar to that of structure. Syntax of union is similar to structure. But the
major difference between structure and union is 'storage.' In structures, each member has its
own storage location, whereas all the members of union use the same location. Union contains
many members of different types, it can handle only one member at a time.
To declare union data type, 'union' keyword is used.
Union holds value for one data type which requires larger storage among their members.
Syntax:
73 | P a g e
union union_name
{
<data-type> element 1;
<data-type> element 2;
<data-type> element 3;
}union_variable;
Example:
union techno
{
int comp_id;
char nm;
float sal;
}tch;
In above example, it declares tch variable of type union. The union contains three members as
data type of int, char, float. We can use only one of them at a time.
* MEMORY ALLOCATION :
Program :
#include <stdio.h>
#include <conio.h>
union techno
{
int id;
char nm[50];
}tch;
void main()
{
clrscr();
printf("\n\t Enter developer id : ");
scanf("%d", &tch.id);
printf("\n\n\t Enter developer name : ");
scanf("%s", tch.nm);
printf("\n\n Developer ID : %d", tch.id);//Garbage
printf("\n\n Developed By : %s", tch.nm);
74 | P a g e
getch();
}
Output :
Enter developer id : 101
Developer ID : 25972
Developed By : technowell_
String Handling in C :
String :
A string is a collection of characters. Strings are always enlosed in double quotes as
"string_constant".
Strings are used in string handling operations such as,
• Counting the length of a string.
• Comparing two strings.
• Copying one string to another.
• Converting lower case string to upper case.
• Converting upper case string to lower case.
• Joining two strings.
• Reversing string.
Declaration :
The string can be declared as follow :
Syntax:
char string_nm[size];
Example:
char name[50];
String Structure :
When compiler assigns string to character array then it automatically supplies null character
('\0') at the end of string. Thus, size of string = original length of string + 1.
char name[7];
name = "TECHNO"
Read Strings :
75 | P a g e
To read a string, we can use scanf() function with format specifier %s.
char name[50];
scanf("%s",name);
The above format allows to accept only string which does not have any blank space, tab, new line,
form feed, carriage return.
Write Strings :
To write a string, we can use printf() function with format specifier %s.
char name[50];
scanf("%s",name);
printf("%s",name);
'string.h' is a header file which includes the declarations, functions, constants of string handling
utilities. These string functions are widely used today by many programmers to deal with string
operations.
Some of the standard member functions of string.h header files are,
Function Name Description
strlen - Returns the length of a string.
strlwr - Returns upper case letter to lower case.
strupr - Returns lower case letter to upper case.
strcat - Concatenates two string.
strcmp - Compares two strings.
strrev - Returns length of a string.
strcpy - Copies a string from source to destination.
Program :
#include <stdio.h>
#include <conio.h>
#include <string.h>
void main()
{
char str[50];
clrscr();
printf("\n\t Enter your name : ");
gets(str);
printf("\nLower case of string: %s",strlwr(str));
printf("\nUpper case of string: %s",strupr(str));
printf("\nReverse of string: %s",strrev(str));
printf("\nLength of String: %d",strlen(str));
getch();
76 | P a g e
Output :
Enter your name : FundamentalOfComputing
Lower case of string: fundamentalofcomputing
Upper case of string: FUNDAMENTALOFCOMPUTING
Reverse of string: GNITUPMOCFOLATNEMADNUF
Length of String: 22_
FILE HANDLING IN C
To work with files, the library routines must be included into your programs. This is done by the
statement,
#include <stdio.h>
as the first statement of your program.
File operation functions in C:
putchar(c);
} while (c != EOF);
}
fclose(myfile);
}
USING FILES
• Declare a variable of type FILE
To use files in C programs, you must declare a file variable to use. This variable must be of type FILE, and
be declared as a pointer type.
FILE is a predefined type. You declare a variable of this type as
FILE *in_file;
This declares infile to be a pointer to a file.
• Associate the variable with a file using fopen()
Before using the variable, it is associated with a specific file by using the fopen() function, which accepts
the pathname for the file and the access mode (like reading or writing).
•
• in_file = fopen( "myfile.dat", "r" );
In this example, the file myfile.dat in the current directory is opened for read access.
• Process the data in the file
Use the appropriate file routines to process the data
• When finished processing the file, close it
Use the fclose() function to close the file.
•
• fclose( in_file );
The following illustrates the fopen function, and adds testing to see if the file was opened successfully.
#include <stdio.h>
/* declares pointers to an input file, and the fopen function */
FILE *input_file, *fopen ();
NOTE: Consider the following statement, which combines the opening of the file and its test to see if it was
successfully opened into a single statement.
int ch;
NOTE that the putc/getc are similar to getchar/putchar except that arguments are supplied
specifying the I/O device.
CLOSING FILES
When the operations on a file are completed, it is closed before the program terminates. This allows the
operating system to cleanup any resources or buffers associated with the file. The fclose() function is used to
close the file and flush any buffers associated with the file.
fclose( input_file );
fclose( output_file );
COPYING A FILE
The following demonstrates copying one file to another using the functions we have just covered.
#include <stdio.h>
main() /* FCOPY.C */
{
char in_name[25], out_name[25];
79 | P a g e
printf("File to be copied:\n");
scanf("%24s", in_name);
printf("Output filename:\n");
scanf("%24s", out_name);
Header File in C :
Header file contains different predefined functions, which are required to run the program. All
header files should be included explicitly before main ( ) function.
It allows programmers to seperate functions of a program into reusable code or file. It contains
declarations of variables, subroutines. If we want to declare identifiers in more than one source
code file then we can declare such identifiers in header file. Header file has extension like '*.h'.
The prototypes of library functions are gathered together into various categories and stored in
header files.
E.g. All prototypes of standard input/output functions are stored in header file 'stdio.h' while
console input/output functions are stored in 'conio.h'.
The header files can be defined or declared in two ways as
Method 1 : #include "header_file-name"
Method 2 : #include <header_file-name>
Method 1 is used to link header files in current directory as well as specified directories using
specific path. The path must be upto 127 characters. This is limit of path declaration. Method 2 is
used to link header files in specified directories only.
Standard Header Files :
Followings are the some commonly used header files which plays a vital role in C programming :
HSEB-GRADE XII
2072(2015)
Sub: Computer Science
Group 'A'
1,a) What is looping? Describe 'for' and 'while' loop with appropriate example.
Answer:
'A loop' is a part of code of a program which is executed repeatedly. A loop is used using condition. The repetition is done until condition
becomes condition true. A loop declaration and execution can be done in following ways:
· Check condition to start a loop
· Initialize loop with declaring a variable.
· Executing statements inside loop.
· Increment or decrement of value of a variable.
'For' loop is a programming language control statement for specifying iteration, which allows code to be executed repeatedly until condition
is tru.
In C programming, Syntax:
for(initial value;condition;counter)
{
81 | P a g e
Statement...
}
Step 1,
The initial step is executed first, and only once. This step allows to declare and initialize any loop control variables.
Step 2,
The condition is evaluated. If it is true, the body of the loop is executed. If it is false, Loop is stop.
Step 3,
After the body of the 'for' loop executes, the flow of control jumps back up to the counter. This statement allows to update any loop control
variables. After that it will check the condition.
The condition is true, the loop executes and the process repeats itself, After the condition becomes false, the 'for' loop terminates.
Example:
#include<stdio.h>
void main()
{
Int I;
For(i=1;i<=5;i++)
{
printf(“Condition is true\n”);
}
printf(“program End\n”);
}
‘While loop’ Repeats a statement or group of statements while a given condition is true. It tests the condition before executing the loop
body. In C programming, Syntax:
while(Condition)
{
Statement...
Counter (increment / decrement)
}
Example:
#include <stdio.h>
int main()
{
int x = 0;
while ( x < 10 )
{
printf( "%d\n", x );
x++;
}
}
1,b) Write a program to check if a given number is odd or even using if statement.
Answer:
#include<stdio.h>
void main()
{
int num;
printf("Input Number:");
scanf("%d",&num);
if(num%2==0)
printf("%d is Even\n",num);
else
printf("%d is Odd\n",num);
}
Example:
#include <stdio.h>
#include <string.h>
void main()
{
char str[50];
char *m="abc";
printf("\n\t Enter your name : ");
gets(str);
printf("\nLower case of string: %s",strlwr(str));
printf("\nUpper case of string: %s",strupr(str));
printf("\nReverse of string: %s",strrev(str));
printf("\nLength of String: %d",strlen(str));
printf("\nString compare %d ",strcmp(str,m));
}
for(i=0;i<3;i++)
for(j=0;j<3;j++)
c[i][j]=a[i][j]+b[i][j];
printf("\nThe Addition of two matrix is\n");
for(i=0;i<3;i++){
printf("\n");
for(j=0;j<3;j++)
printf("%d\t",c[i][j]);
}
Union is user defined data type used to stored data under unique variable name at single memory location. Union is similar to that of
structure. Syntax of union is similar to structure.
The major difference between structure and union is 'storage.'
In structures, each member has its own storage location, whereas all the members of union use the same location. Union contains many
members of different types, it can handle only one member at a time.
83 | P a g e
}
printf("%d\n",gt);
}
To use files in C programs, must declare a file variable to use. This variable must be of type FILE, and be declared as a pointer type. FILE
is a predefined type.
Syntax: FILE *file_pointer;
Syntax for 'fopen()' function:
file_pointer=fopen("file name", file handling mode);
'fclose()' function use for closing the opened file.
Example:
#include
void main(void)
{
FILE *fp;
char c;
myfile = fopen("firstfile.txt", "r");
if (fp == NULL)
printf("File doesn't exist\n");
else
{
do {
c = getc(fp);
putchar(c);
} while (c != EOF);
}
fclose(fp);
}
5,b) Write a program to display name, age and address reading from file 'record.dat'.
Answer:
#include "stdio.h"
void main()
{
FILE *f;
char ch;
f=fopen("'record.dat'","r");
while((ch=fgetc(f))!= EOF)
printf("%c",ch);
fclose(f);
}
84 | P a g e
HSEB-GRADE XII
2070(2014)
Computer Science
Candidates are required to give their answer in their own words as far as practicable.
Group ‘A’
Long answer questions
Attempt any four questions
1. Write a program which reads name of 100 students and sort them in alphabetical order.
Answer:
#include<stdio.h>
void main()
{
char nm[100][20];
char tmp[20];
int r=100,i,m,n,j;
for(i=0;i<r;i++)
{
printf("Input Name:");
scanf("%s",&nm[i]);
}
printf("\n\n\nsorting:\n");
for(m=0;m<r;m++)
{
for(n=0;n<r;n++)
{
if(strcmp(nm[n-1],nm[n])>0)
{
strcpy(tmp,nm[n-1]);
strcpy(nm[n-1],nm[n]);
strcpy(nm[n],tmp);
}
}
}
for(j=0;j<r;j++)
{
printf("%s\n",nm[j]);
}
}
1. Describe ‘Sequence’, ‘Selection’ and ‘Loop’ with flowchart. Write a program to check if a number
is odd or even.
Answer:
Sequence: A sequence point defines any point in a computer program's execution at which it is guaranteed
that all effects of previous evaluations will have been performed. They are often mentioned in reference to
C, because the result of some expressions can depend on the order of evaluation of their sub-expressions.
85 | P a g e
Adding one or more sequence points is one method of ensuring a consistent result, because this restricts the
possible orders of evaluation.
Selection: selection also called a decision, one of the three basic logic structures in c programming. The
other two logic structures are sequence and loop. In a selection structure, a question is asked, and depending
on the answer, the program takes one of two courses of action, after which the program moves on to the next
event.
86 | P a g e
Loop: 'A loop' is a part of code of a program which is executed repeatedly. A loop is used using condition.
The repetition is done until condition becomes condition true. A loop declaration and execution can be done
in following ways:
• Check condition to start a loop
• Initialize loop with declaring a variable.
• Executing statements inside loop.
• Increment or decrement of value of a variable.
87 | P a g e
3. What is an array? Write a program which finds multiplication table of two matrices (3*3).
Answer:
Array is a collection of homogenous data stored under unique name. The values in an array is called as
'elements of an array.' These elements are accessed by numbers called as 'subscripts or index numbers.'
Arrays may be of any variable type. Array is also called as 'subscripted variable.'
Types of an Array :
1. One / Single Dimensional Array
2. Two Dimensional Array
Single / One Dimensional Array :
The array which is used to represent and store data in a linear form is called as 'single or one dimensional
array.'
Two Dimensional Array : The array which is used to represent and store data in a tabular form is called as
'two dimensional array.' Such type of array specially used to represent data in a matrix form.
Program:
#include <stdio.h>
void main()
{
int m[3][3];
int n[3][3];
int mn[3][3];
int i,j,k,l;
int x,y,z,v;
int a,s,q;
int sum=0;
printf("Input 3*3 Matrix A=[]:\n");
for(j=0;j<3;j++)
{
for(k=0;k<3;k++)
{
scanf("%d",&m[j][k]);
}
}
89 | P a g e
printf("Matrix table:\n");
printf("A=");
for(l=0;l<3;l++)
{
for(i=0;i<3;i++)
{
printf("\t%d",m[l][i]);
}
putchar('\n');
}
printf("\n\nB=");
for(l=0;l<3;l++)
{
for(i=0;i<3;i++)
{
printf("\t%d",n[l][i]);
}
putchar('\n');
}
//matrix calculation
for(a=0;a<3;a++)
{
for(s=0;s<3;s++)
{
sum=0;
for(q=0;q<3;q++)
{
sum=sum+(m[a][q]*n[q][s]);
}
mn[a][s]=sum;
}
}
{
for(i=0;i<3;i++)
{
printf("\t%d",mn[l][i]);
}
putchar('\n');
}
4. Write a program which reads name, roll number and age from a file named “student.dat” and display
them.
Answer:
#include <stdio.h>
void main()
{
FILE *fp;
char c;
fp=fopen("students.dat","r");
puts("Name roll age");
while((c=fgetc(fp))!=EOF)
{
printf("%c",c);
}
}
Group ‘B’
Short answer questions
Attempt any seven questions:
5. Describe different levels of feasibility study.
Answer:
Different levels of feasibilities are:
• Technical feasibility
• Economic feasibility
• Operational feasibility
• Legal feasibility
Technical Feasibility:
Technical feasibility is concerned with the availability of hardware and software required for the
development of the system, to see compatibility and maturity of the technology proposed to be used and to
see the availability of the required technical manpower to develop the system.
Economic Feasibility:
91 | P a g e
It is the measure of cost effectiveness of the project. The economic feasibility is nothing but judging
whether the possible benefit of solving the problems is worthwhile or not. When the specific requirements
and solutions have been identified, the analyst weighs the cost and benefits of all solutions, this is called
“cost benefit analysis”. A project which is expensive when compared to the savings that can be made from
its usage, then this project may be treated as economically infeasible.
Operational Feasibility:
Operational feasibility is all about problems that may arise during operations.
Information The system needs to provide adequate, timely, accurate and useful information. It should be
able to supply all the useful and required information to all levels and categories of users.
Response time It needs to study the response time of the system in term of throughput. It should be fast
enough to give the required output to the users.
Accuracy A software system must operate accurately. It means that it should provide value to its users.
Accuracy is the degree to which the software performs its required functions and gives desired output
correctly.
Security There should be adequate security to information and data. It should be able to protect itself from
fraud.
Services The system needs to be able to provide desirable and reliable services to its users.
Efficiency The system needs to be able to use maximum of the available resources in an efficient manner so
that there are no delays in execution of jobs.
Legal Feasibility:
Legal feasibility studies issues arising out of the need to the development of the system. The possible
consideration might include copyright law, labor law, antitrust legislation, foreign trade, regulation, etc.
Legal feasibility plays a major role in formulating contracts between vendors and users.
Psychologist: In system development, systems are built around people. The analyst plays the role of
psychologist in the way s/he reaches people, interprets their thoughts, assesses their behavior and draws
conclusions from these interactions. Psychologist plays a major role during the phase of fact finding.
Motivator: System acceptance is achieved through user participation in its development, effective user
training and proper motivation to use the system.
Intermediary: In implementing a candidate system, the analyst tries to appease all parties involved.
Diplomacy in dealing with people can improve acceptance of the system.
= Simple assignment operator, Assigns values from right side operands to left side operand
Add AND assignment operator, It adds right operand to the left operand and assign the
+=
result to left operand
Subtract AND assignment operator, It subtracts right operand from the left operand and
-=
assign the result to left operand
Multiply AND assignment operator, It multiplies right operand with the left operand and
*=
assign the result to left operand
Divide AND assignment operator, It divides left operand with the right operand and assign
/=
the result to left operand
Modulus AND assignment operator, It takes modulus using two operands and assign the
%=
result to left operand
<<= Left shift AND assignment operator
>>= Right shift AND assignment operator
&= Bitwise AND assignment operator
^= bitwise exclusive OR and assignment operator
|= bitwise inclusive OR and assignment operator
Misc. Operators
Operator Description
sizeof() Returns the size of a variable.
& Returns the address of a variable.
* Pointer to a variable.
?: Conditional Expression
• Simplicity: software objects model real world objects, so the complexity is reduced and the program
structure is very clear;
• Modularity: each object forms a separate entity whose internal workings are decoupled from other
parts of the system;
• Modifiability: it is easy to make minor changes in the data representation or the procedures in an OO
program. Changes inside a class do not affect any other part of a program, since the only public interface
that the external world has to a class is through the use of methods;
• Extensibility: adding new features or responding to changing operating environments can be solved
by introducing a few new objects and modifying some existing ones;
• Maintainability: objects can be maintained separately, making locating and fixing problems easier;
• Re-usability: objects can be reused in different programs.
Advantages of multimedia:
• It is integrated and interactive. All the different mediums are integrated through the digitization
process. Interactivity is heightened by the possibility of easy feedback.
• It is flexible. Being digital, this media can easily be changed to fit different situations and audiences.
• It can be used for a wide variety of audiences, ranging from one person to a whole group.
• Increases learning effectiveness.
• More appealing over traditional, lecture-based learning methods.
• Offers significant potential in improving personal communications, education and training efforts.
• Reduces training costs.
96 | P a g e
• Easy to use.
• Tailors information to the individual.
• Provides high-quality video images & audio.
• Offers system portability.
• Gathers information about the study results of the student.
b. Expert System.
Answer:
An expert system is an artificial intelligence application that uses a knowledge base of human expertise to
aid in solving problems. The degree of problem solving is based on the quality of the data and rules obtained
from the human expert. Expert systems are designed to perform at a human expert level. In practice, they
will perform both well below and well above that of an individual expert. The expert system derives its
answers by running the knowledge base through an inference engine, a software program that interacts with
the user and processes the results from the rules and data in the knowledge base. Expert systems are used in
applications such as medical diagnosis, equipment repair, investment analysis, financial, estate and
insurance planning, route scheduling for delivery vehicles, contract bidding, counseling for self-service
customers, production control and training.
97 | P a g e
********************************
Group ‘A’
Long Answer
Q1) What is control statement? Describe ‘Sequence’, ‘Selection’ and ‘Loop’ with flow chart
and example.
Answer:
Control Statement: Control statements enable us to specify the flow of program control; i.e., the
order in which the instructions in a program must be executed. They make it possible to make
decisions, to perform tasks repeatedly or to jump from one section of code to another. The if else
Statement, switch Statement, Loops, while Loop, do while Loop, for Loop, break Statement,
continue Statement and goto Statement are the examples of control statements.
There are four types of control statements in C:
• Decision making statements
• Selection statements
• Iteration statements
• Jump statements
Sequence: A sequence point defines any point in a computer program's execution at which it is
guaranteed that all effects of previous evaluations will have been performed. They are often
mentioned in reference to C, because the result of some expressions can depend on the order of
evaluation of their sub-expressions. Adding one or more sequence points is one method of
ensuring a consistent result, because this restricts the possible orders of evaluation.
98 | P a g e
Selection: selection also called a decision, one of the three basic logic structures in c
programming. The other two logic structures are sequence and loop. In a selection structure, a
question is asked, and depending on the answer, the program takes one of two courses of action,
after which the program moves on to the next event.
Loop: 'A loop' is a part of code of a program which is executed repeatedly. A loop is used using
condition. The repetition is done until condition becomes condition true. A loop declaration and
execution can be done in following ways:
• • Check condition to start a loop
• • Initialize loop with declaring a variable.
• • Executing statements inside loop.
• • Increment or decrement of value of a variable.
99 | P a g e
Q2) Write a program which reads name of 20 employees and sort them in alphabetic order.
Answer:
#include "stdio.h"
#include "string.h"
#include "conio.h"
void main()
{
int i,j;
char name[20][20],temp[20];
for(i=0;i<20;i++)
{
printf("Enter the name of %dth person:\n",i+1);
scanf("%s",&name[i]);
}
printf("\n The names in original order are:\n");
for(i=0;i<20;i++)
{
printf("%d.%s\n",i+1,name[i]);
}
for(i=0;i<20-1;i++)
{
for(j=i+1;j<20;j++)
{
100 | P a g e
if(strcmp(name[i],name[j])>0 )
{
strcpy(temp,name[i]);
strcpy(name[i],name[j]);
strcpy(name[j],temp);
}
}
}
Answer:
Structure: Structure is a method of packing the data of different types. When we require using a
collection of different data items of different data types in that situation we can use a structure. A
structure is used as a method of handling a group of related data items of different data types.
Example:
#include "stdio.h"
#include "conio.h"
struct comp_info
char nm[100];
char addr[100];
}info;
void main()
clrscr();
gets(info.nm);
gets(info.addr);
getch();
}
Union: Union is user defined data type used to stored data under unique variable name at single
memory location. Union is similar to that of structure. Syntax of union is similar to structure. But
the major difference between structure and union is 'storage.' In structures, each member has its
own storage location, whereas all the members of union use the same location. Union contains
many members of different types, it can handle only one member at a time. To declare union data
type, 'union' keyword is used. Union holds value for one data type which requires larger storage
among their members.
Example:
#include "stdio.h"
#include "conio.h"
union techno
int id;
char nm[50];
}tch;
void main()
clrscr();
scanf("%d", &tch.id);
scanf("%s", tch.nm);
getch();
Q4) What is recursion? Write a program to calculate factorial value of given number using
recursive function.
Answer:
Recursion is a programming technique that allows the programmer to express operations in terms
of themselves. In C, this takes the form of a function that calls itself. A useful way to think of
recursive functions is to imagine them as a process being performed where one of the instructions
is to "repeat the process". This makes it sound very similar to a loop because it repeats the same
code, and in some ways it is similar to looping. On the other hand, recursion makes it easier to
express ideas in which the result of the recursive call is necessary to complete the task.
Example:
#include "stdio.h"
#include "conio.h"
int fact(int);
void main()
int num,f;
scanf("%d",&num);
f=fact(num);
int fact(int n)
if(n==1)
return 1;
else
return(n*fact(n-1));
103 | P a g e
Q5) Write a program which reads name, department and age from a file named
"Employee.dat" and display them.
Answer:
#include "stdio.h"
#include "conio.h"
void main()
{
FILE *f;
char ch;
f=fopen("employee.txt","r");
while( ( ch = fgetc(f) ) != EOF )
printf("%c",ch);
fclose(f);
getch();
}
Group ‘B’
Short Answer Questions
Q7) Who is system analyst? List out the roles of system analyst.
Answer:
Systems analyst who designs an information system is the same as an architect of a house. Three
groups of people are involved in developing information systems for organizations. They are
managers, users of the systems and computer programmers who implement systems. The
systems analyst coordinates the efforts of all these groups to effectively develop and operate
computer based information systems. Systems analysts develop information systems. For this
104 | P a g e
task, they must know about concepts of systems. They must be involved in all the phases of
system development life cycle. It mainly consists of four phases: System Analysis, System
Design, System Construction & Implementation and System Support. Every phase consist of
inputs, tasks and outputs.
Roles of system analyst:
Change Agent: The analyst may be viewed as an agent of change.
Investigator and Monitor: A systems analyst may investigate the existing system to find the
reasons for its failure.
Architect: The analyst’s role as an architect is liaison between the user’s logical design
requirements and the detailed physical system design.
Psychologist: In system development, systems are built around people.
Motivator: System acceptance is achieved through user participation in its development, effective
user training and proper motivation to use the system.
Intermediary: In implementing a candidate system, the analyst tries to appease all parties
involved.
Star Topology:
Star networks are one of the most common computer network topologies. In its simplest form, a
star network consists of one central switch, hub or computer, which acts as a conduit to transmit
messages.
This consists of a central node, to which all other nodes are connected; this central node provides
a common connection point for all nodes through a hub.
Ring Topology:
A ring network is a network topology in which each node connects to exactly two other nodes,
forming a single continuous pathway for signals through each node - a ring. Data travels from
node to node, with each node along the way handling every packet. Because a ring topology
provides only one pathway between any two nodes, ring networks may be disrupted by the failure
of a single link. A node failure or cable break might isolate every node attached to the ring.
107 | P a g e
Tree Topology:
The type of network topology in which a central 'root' node (the top level of the hierarchy) is
connected to one or more other nodes that are one level lower in the hierarchy (i.e., the second
level) with a point-to-point link between each of the second level nodes and the top level central
'root' node, while each of the second level nodes that are connected to the top level central 'root'
node will also have one or more other nodes that are one level lower in the hierarchy (i.e., the
third level) connected to it, also with a point-to-point link, the top level central 'root' node being the
only node that has no other node above it in the hierarchy (The hierarchy of the tree is
symmetrical.) Each node in the network having a specific fixed number, of nodes connected to it
at the next lower level in the hierarchy, the number, being referred to as the 'branching factor' of
the hierarchical tree. This tree has individual peripheral nodes.
Mesh topology:
Mesh networking (topology) is a type of networking where each node must not only capture and
disseminate its own data, but also serve as a relay for other nodes, that is, it must collaborate to
propagate the data in the network. A mesh network can be designed using a flooding technique or
a routing technique. When using a routing technique, the message is propagated along a path, by
108 | P a g e
hopping from node to node until the destination is reached. To ensure all its paths' availability, a
routing network must allow for continuous connections and reconfiguration around broken or
blocked paths, using self-healing algorithms. A mesh network whose nodes are all connected to
each other is a fully connected network. Mesh networks can be seen as one type of ad hoc
network.
Inheritance:
Inheritance – is the inclusion of behavior (i.e. methods) and state (i.e. variables) of a base class in
a derived class so that they are accessible in that derived class. The key benefit of Inheritance is
that it provides the formal mechanism for code reuse. Any shared piece of business logic can be
moved from the derived class into the base class as part of refactoring process to improve
maintainability of your code by avoiding code duplication. The existing class is called the super
class and the derived class is called the subclass. Inheritance can also be defined as the process
whereby one object acquires characteristics from one or more other objects the same way
children acquire characteristics from their parents.
Example:
#include "iostream.h"
class vehicle
{
int wheels;
float weight;
public:
void message(void)
109 | P a g e
{
cout<<"Vehicle message, from vehicle, the base class\n";
}
};
class car : public vehicle
{
int passenger_load;
public:
void message(void) // second message()
{
cout<<"Car message, from car, the vehicle derived class\n";
}
};
class truck : public vehicle
{
int passenger_load;
float payload;
public:
int passengers(void)
{
return passenger_load;
}
};
class boat : public vehicle
{
int passenger_load;
public:
int passengers(void) {return passenger_load;}
void message(void) // third message()
{
cout<<"Boat message, from boat, the vehicle derived class\n";
}
};
int main()
{
vehicle unicycle;
car sedan_car;
truck trailer;
boat sailboat;
unicycle.message();
sedan_car.message();
trailer.message();
sailboat.message();
// base and derived object assignment
unicycle = sedan_car;
unicycle.message();
return 0;
}
110 | P a g e
Disadvantages of multimedia:
• Expensive
• Not always easy to configure
• Requires special hardware
• Not always compatible