Unit 1 SGT
Unit 1 SGT
Prof. S. G. Taley
Syllabus: 1SF04 Programming for Problem
Solving (L-2, C-2)
Unit I Introduction (Hours:5)
Characteristics of Computer, Organization of Computer, Input–Process Output Cycle
Various Types of Memory (Primary Memory & Secondary Memory), Introduction to
C language, Basic structure.
Text Book:
1) R. S. Salaria : Programming for Problem Solving , Khanna
Publication 2) E Balagurusamy: Computing Fundamentals and C
Programming- Tata McGraw Hill, Second Edition
Reference Books:
1. Herbert Schildt- C Complete reference (Tata McGraw Hill)
2. Yashwant Kanetkar- Let us C- Seventh Edition
Unit I Introduction
Output Unit
• It connects the internal system of a computer to the external
environment. It provides the results of any computation, or
instructions to the outside world. Some output devices are
printers, monitor, plotter, speaker etc.
Storage Unit
This unit holds the data and instructions. It also stores the
intermediate results before these are sent to the output devices. It
also stores the data for later use.
Memory Units
Computer store data in binary format, binary format
contain only two characters 0 and 1. All the information
stored/represented in the computer is a code which
contain a specific combination of 0’s and 1’s. The memory
units are used to measure the size of data in computer. The
memory units are as follow.
The Input-Process-Output Cycle of a
computer
• The most elementary computing concepts include receiving input—
known as data— from the user, manipulating the input according
to the given set of instructions and delivering the output—known
as information—to the user. Figure 1.12 shows the functioning of a
computer based on these concepts. The various functions
performed by the computer are briefly described below:
• Accepting the raw data The first task to be performed by a
computer is to accept the data from the user, with the help of an
input device, such as mouse and keyboard. Mouse is used to enter
the data through point-and-click operation while keyboard is used
to enter the character data by typing the various keys. We need to
enter the data into the computer so as to obtain the required result
as output.
• Processing the data The data is processed with the help of
specific instructions known as programs after taking the
input from the user. The manipulation of data is handled by
the CPU of the computer. CPU is considered as the brain of
the computer because it controls the execution of various
instructions. The raw data entered by the user through
input devices is processed by the CPU to generate
meaningful information.
• Storing the data The data is stored in the main memory of
a computer in its processed form. The various external
storage devices—such as hard disk and magnetic disk—can
also be used for storing the processed data so that it can
again be fetched later.
• Delivering the output The processed data is delivered as
useful information to the user with the help of output
devices, such as printer and monitor.
Computer Memory
A computer system needs memory to store the data and instructions
for processing. Whenever we talk about the ‘memory’ of a computer
system, we usually talk about the main or primary memory. The
secondary memory (also called storage device) is used to store data,
instructions and results permanently for future use.
Types of Memory
Human beings memorise many things over a lifetime, and recall from
memory to make a decision or some action. However, we do not rely
on our memory completely, and we make notes and store important
data and information using other media, such as notebook, manual,
journal, document, etc. Similarly, computers have two types of
memory
— primary and secondary.
(A) Primary Memory
Primary memory is an essential component of a computer system.
Program and data are loaded into the primary memory before processing.
The CPU interacts directly with the primary memory to perform read or
write operation. It is of two types viz. (i) Random Access Memory
(RAM) and (ii) Read Only Memory (ROM).
RAM is volatile, i.e., as long as the power is supplied to the computer, it
retains the data in it. But as soon as the power supply is turned off, all the
contents of RAM are wiped out. It is used to store data temporarily while
the computer is working. Whenever the computer is started or a software
application is launched, the required program and data are loaded into
RAM for processing. RAM is usually referred to as main memory and it
is faster than the secondary memory or storage devices.
On the other hand, ROM is non-volatile, which means its contents are
not lost even when the power is turned off. It is used as a small but faster
permanent storage for the contents which are rarely changed. For
example, the startup program (boot loader) that loads the operating
system into primary memory, is stored in ROM.
B) Cache Memory
To write the first c program, open the C console and write the
following code:
#include <stdio.h>
#include <conio.h>
void main(){
printf("Hello C Language");
getch();
}
• #include <stdio.h>
includes the standard input output library functions. The
printf() function is defined in stdio.h .
• #include <conio.h>
includes the console input output library functions. The
getch() function is defined in conio.h file.
• void main()
The main() function is the entry point of every program
in c language. The void keyword specifies that it returns no
value.
• printf()
The printf() function is used to print data on the console.
• getch()
The getch() function asks for a single character. Until you
press any key, it blocks the screen.