Professional Documents
Culture Documents
BPC Unit-1
BPC Unit-1
BPC Unit-1
A computer is an electronic device that accepts data from the user, processes it,
produces results, displays them to the users, and stores the results for future usage.
Data is a collection of unorganized facts & figures and does not provide any
further information regarding patterns, context, etc. Hence data means
"unstructured facts and figures".
Information is a structured data i.e. organized meaningful and processed data. To
process the data and convert into information, a computer is used.
Functions of Computers
A computer performs the following functions −
Receiving Input
Data is fed into computer through various input devices like keyboard, mouse,
digital pens, etc. Input can also be fed through devices like CD-ROM, pen drive,
scanner, etc.
Processing the information
Operations on the input data are carried out based on the instructions provided in
the programs.
Storing the information
After processing, the information gets stored in the primary or secondary storage
area.
Producing output
The processed information and other details are communicated to the outside world
through output devices like monitor, printer, etc.
Functional Components of a Computer
Input Unit :The input unit consists of input devices that are attached to the
computer. These devices take input and convert it into binary language that
the computer understands. Some of the common input devices are keyboard,
mouse, joystick, scanner etc.
Central Processing Unit (CPU)
The CPU is called the brain of the computer since no action can take place without
its permission and execution is the main processing unit. It communicates with all
the other components of the computer and has 3 components that help in the
smooth functioning of the CPU. The components of the CPU are:
Memory Unit
The information entered through the input devices is saved in the memory of the
CPU and then passed on to the other parts. Similarly, when the output is ready it is
saved in the memory before the result is given to the user.
Control Unit
This unit controls the functioning component of the computer. It collects the data
entered, leads it on for processing after the processing is done, receives the output,
and provides it to the user. So getting instructions, decoding them, signaling the
execution, and receiving the output is done by the control center and hence it is
called the center of all processing actions that happen in the computer.
Storage Unit
The computers need to store all their data and they have either a Hard Disk Drive
(HDD) or a Solid State Drive (SDD) for this purpose. Hard disk drives are disks
that store data and this data is read by a mechanical arm. Solid-State drives are like
SIM cards in mobile phones. They have no moving parts and are faster than hard
drives. There is no need for a mechanical arm to find data on a physical location on
the drive and therefore this takes no time at all.
Output Unit : The output unit consists of output devices that are attached
with the computer. It converts the binary data coming from CPU to human
understandable form. The common output devices are monitor, printer,
plotter etc.
Computing Environments : When a problem is solved by the computer, during
that computer uses many devices, arranged in different ways and which work
together to solve problems. This constitutes a computing environment where
various number of computer devices arranged in different ways to solve different
types of problems in different ways. In different computing environments
computer devices are arranged in different ways and they exchange information
in between them to process and solve problem. One computing environment
consists of many computers other computational devices, software and networks
that to support processing and sharing information and solving task. Based on
the organization of different computer devices and communication processes
there exists multiple types of computing environments. Types of Computing
Environments : There are the various types of computing environments. They
are :
Computing Environments Types
2.
3. Time-Sharing Computing Environment : In Time Sharing Computing
Environment multiple users share system simultaneously. Different users
(different processes) are allotted different time slice and processor switches
rapidly among users according to it. For example, student listening to music
while coding something in an IDE. Windows 95 and later versions, Unix,
IOS, Linux operating systems are the examples of this time sharing
computing environment.
4.
5. Client Server Computing Environment : In client server computing
environment two machines are involved i.e., client machine and server
machine, sometime same machine also serve as client and server. In this
computing environment client requests resource/service and server provides
that respective resource/service. A server can provide service to multiple
clients at a time and here mainly communication happens through computer
network.
6.
7. Distributed Computing Environment : In a distributed computing
environment multiple nodes are connected together using network but
physically they are separated. A single task is performed by different
functional units of different nodes of distributed unit. Here different
programs of an application run simultaneously on different nodes, and
communication happens in between different nodes of this system over
network to solve task.
8.
9. Grid Computing Environment : In grid computing environment, multiple
computers from different locations works on single problem. In this system
set of computer nodes running in cluster jointly perform a given task by
applying resources of multiple computers/nodes. It is network of computing
environment where several scattered resources provide running environment
for single task.
10.Cloud Computing Environment : In cloud computing environment on
demand availability of computer system resources like processing and
storage are availed. Here computing is not done in individual technology or
computer rather it is computed in cloud of computers where all required
resources are provided by cloud vendor. This environment primarily
comprised of three services i.e software-as-a-service (SaaS), infrastructure-
as-a-service (IaaS), and platform-as-a-service (PaaS).
11.
12.Cluster Computing Environment : In cluster computing environment
cluster performs task where cluster is a set of loosely or tightly connected
computers that work together. It is viewed as single system and performs task
parallelly that’s why also it is similar to parallel computing environment.
Cluster aware applications are especially used in cluster computing
environment.
1. Mainframe: High cost and complexity, with a significant learning curve for
developers.
2. Client-Server: Dependence on network connectivity, and potential security
risks from centralized data storage.
3. Cloud Computing: Dependence on network connectivity, and potential
security and privacy concerns.
4. Mobile Computing: Limited processing power and memory compared to
other computing environments, and potential security risks.
5. Grid Computing: Complexity in setting up and managing the grid
infrastructure.
6. Embedded Systems: Limited processing power and memory, and the need for
specialized skills for software development
Algorithm
Characteristics of an Algorithm
Well-defined Inputs
The expected inputs of an algorithm must be well-defined to ensure its
correctness, predictability, and repeatability.
With well-defined inputs, it is easier to optimize the algorithm based on the
characteristics of the input.
Well-defined Outputs
The outputs of an algorithm should be well-defined to ensure that the
algorithm produces the intended and accurate result for a given set of inputs.
It avoids ambiguity and guarantees that the algorithm solves the problem
correctly.
Well-defined outputs allow you to optimize the algorithm further to achieve
the results more efficiently.
Unambiguity
Ambiguity in the algorithm's description can lead to incorrect
implementations and unreliable results. That is why it is important for an
algorithm to be unambiguous.
It allows the algorithm to be predictable, i.e., the same input produces the
same output, which makes debugging an implementation easier.
Finiteness
The algorithm should end after a finite amount of time, and it should have a
limited number of instructions.
A finite algorithm ensures that it will eventually stop executing and produce a
result.
The time and space complexity can be analyzed in the case of a finite
algorithm which is important for performing further optimizations.
Language Independent
A language-independent algorithm can be easily ported to different
programming languages and platforms, making it more adaptable and usable
across various environments.
They are adopted easily for usage across different fields due to its practical
hardware requirements.
Complexity in algorithms refers to the amount of resources (such as time or
memory) required to solve a problem or perform a task.
Advantages of Algorithms
Easy to understand: Since it is a stepwise representation of a solution to a
given problem, it is easy to understand.
Language Independent: It is not dependent on any programming language,
so it can easily be understood by anyone.
Debug / Error Finding: Every step is independent / in a flow so it will be
easy to spot and fix the error.
Sub-Problems: It is written in a flow so now the programmer can divide the
tasks which makes them easier to code.
Disadvantages of Algorithms
Creating efficient algorithms is time-consuming and requires good logical
skills.
Nasty to show branching and looping in algorithms.
What is a Flowchart
Flowcharts are nothing but the graphical representation of the data or the
algorithm for a better understanding of the code visually. It displays step-by-step
solutions to a problem, algorithm, or process.
Flowchart symbols
Different types of boxes are used to make flowcharts flowchart Symbols
The terminator symbol represents the starting or ending point of the system.
Process
A box indicates some particular operation.
Document
This represents a printout, such as a document or a report.
Decision
A diamond represents a decision or branching point. Lines coming out from the
diamond indicates different possible situations, leading to different sub-
processes.
Data
It represents information entering or leaving the system. An input might be an
order from a customer. Output can be a product to be delivered.
On-Page Reference
This symbol would contain a letter inside. It indicates that the flow continues on
a matching symbol containing the same letter somewhere else on the same page.
Off-Page Reference
This symbol would contain a letter inside. It indicates that the flow continues on
a matching symbol containing the same letter somewhere else on a different
page.
Delay or Bottleneck
Identifies a delay or a bottleneck.
Flow
Lines represent the flow of the sequence and direction of a process.
Advantages of Pseudocode
Improves the readability of any approach. It’s one of the best approaches to
start implementation of an algorithm.
Acts as a bridge between the program and the algorithm or flowchart. Also
works as a rough documentation, so the program of one developer can be
understood easily when a pseudo code is written out. In industries, the
approach of documentation is essential. And that’s where a pseudo-code
proves vital.
The main goal of a pseudo code is to explain what exactly each line of a
program should do, hence making the code construction phase easier for the
programmer.
Pseudocode is understood by the programmers of all types.
It cannot be compiled into an executable program.
Compiler
Interpreter
Assembler
An assembler translates assembly language programs into machine code.The
output of an assembler is called an object file, which contains a combination
of machine instructions as well as the data required to place these
instructions in memory.
Linker
For a code to run we need to include a header file or a file saved from the library
which are pre-defined if they are not included in the beginning of the program then
after execution the compiler will generate errors, and the code will not work.
Linker is a program that holds one or more object files which is created by
compiler, combines them into one executable file.Linking is implemented at both
time,load time and compile time. Compile time is when high level language is
turns to machine code and load time is when the code is loaded into the memory by
loader.
1.Dynamic Linker:-
2.Static Linker:-
Loader
A loader is a program that loads the machine codes of a program into the system
memory. \It is part of the OS of the computer that is responsible for loading the
program. It is the bare beginning of the execution of a program. Loading a program
involves reading the contents of an executable file into memory. Only after the
program is loaded on operating system starts the program by passing control to the
loaded program code. All the OS that supports loading have loader and many have
loaders permanently in their memory.
C Program Execution Process
2) Expanded source code is sent to compiler which compiles the code and converts
it into assembly code.
3) The assembly code is sent to assembler which assembles the code and converts
it into object code. Now a simple.obj file is generated.
4) The object code is sent to linker which links it to the library such as header files.
Then it is converted into executable code. A simple.exe file is generated.
5) The executable code is sent to loader which loads it into memory and then it is
executed. After execution, output is sent to console.