0% found this document useful (0 votes)
41 views20 pages

UNIT 1 CS m3

The document discusses what a computer is and its basic functional blocks. It explains that a computer accepts data as input, processes it, produces output and stores results. The main components are the central processing unit (CPU), memory, input and output devices. The CPU consists of the arithmetic logic unit (ALU) and control unit. An operating system controls the hardware and allows interaction between the user, applications and computer resources.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views20 pages

UNIT 1 CS m3

The document discusses what a computer is and its basic functional blocks. It explains that a computer accepts data as input, processes it, produces output and stores results. The main components are the central processing unit (CPU), memory, input and output devices. The CPU consists of the arithmetic logic unit (ALU) and control unit. An operating system controls the hardware and allows interaction between the user, applications and computer resources.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

RTMNU ENGINEERING THEORY NOTES

COMPUTER SCIENCE
UNIT 1- WHAT IS COMPUTER

NOTE - TAP ON ABOVE IMAGES COPY GROUP LINK & JOIN TELEGRAM GROUPS FOR ENGINEERING (BEE)

GUYS THIS IS OUR FIRST SERIES OF PROVIDING YOU NOTES FOR YOUR UNIVERSITY EXAMINATION
POINT OF VIEW.

➢ Click here for Joining official FY 2023 Notes Group


@RTMNUNOTESFY2023
➢ Click here for Joining Discussion Notes Group
➢ @RTMNUFYFRIENDCIRCLE
➢ Click here for Joining official ALL YEAR Notes
Group
➢ @Rtmnupdates2023

Computational Skills Page 1


Unit-I What is a Computer?

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 −

1 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.

2 PROCESSING THE INFORMATION


Operations on the input data are carried out based on the instructions provided in the
programs.

3 STORING THE INFORMATION


After processing, the information gets stored in the primary or secondary storage
area.

What is computer? Explain functional blocks of computer system.

Computer systems consist of three components as shown in below image:


Central Processing Unit, Input devices and Output devices. Input
devices provide data input to processor, which processes data and
generates useful information that’s displayed to the user through output
devices. This is stored in computer’s memory.

Computational Skills Page 2


4 CENTRAL PROCESSING UNIT

The Central Processing Unit (CPU) is called "the brain of computer" as it


controls operation of all parts of computer. It consists of two components:
Arithmetic Logic Unit (ALU), and Control Unit

5 ARITHMETIC LOGIC UNIT (ALU)

Data entered into computer is sent to RAM, from where it is then sent to ALU,
where rest of data processing takes place. All types of processing, such as

Computational Skills Page 3


comparisons, decision-making and processing of non-numeric information
takes place here and once again data is moved to RAM.

6 CONTROL UNIT

As name indicates, this part of CPU extracts instructions, performs execution,


maintains and directs operations of entire system.

7 FUNCTIONS OF CONTROL UNIT


Control unit performs following functions −

• It controls all activities of computer


• Supervises flow of data within CPU
• Directs flow of data within CPU
• Transfers data to Arithmetic and Logic Unit
• Transfers results to memory
• Fetches results from memory to output devices

8 MEMORY UNIT

This is unit in which data and instructions given to computer as well as results
given by computer are stored. Unit of memory is "Byte".
1 Byte = 8 Bits

9 PRODUCING OUTPUT
The processed information and other details are communicated to the outside
world through output devices like monitor, printer, etc.

Basics of Operating System

Computational Skills Page 4


10 OPERATING SYSTEM
Operating system is software that controls system’s hardware and interacts
with user and application software.
In short, an operating system is computer’s chief control program.

11 FUNCTIONS OF OPERATING SYSTEM


The operating system performs the following functions −
It offers a user interface.
• Loads program into computer’s memory.
• Coordinates how program works with hardware and other software.
• Manages how information is stored and retrieved from the disk.
• Saves contents of file on to disk.
• Reads contents of file from disk to memory.
• Sends document to the printer and activates the printer.
• Provides resources that copy or move data from one document to
another, or from one program to another.
• Allocates RAM among the running programs.
• Recognizes keystrokes or mouse clicks and displayes characters or
graphics on the screen.

Sr.No. Operating System Concepts & Description

1
Types of Operating System
There are four types of operating systems.

2
Basics of Popular Operating Systems
Windows Operating System is developed by Microsoft
Corporation, Linux is a multitasking operating system that
supports various users and numerous tasks. It is open source,
i.e., code for Linux is available for free of cost

Computational Skills Page 5


3 User Interface
While working with a computer, we use a set of items on
screen called "user interface". In simple terms, it acts as an
interface between user and software application or program

4 Running an Application
The operating system offers an interface between

programs and user, as well as programs and other computer


resources such as memory, printer and other programs.

5
Operating System Simple Setting
We will learn different settings in Operating System such as
changing system date and time, changing display properties,
etc.

6
File and Directory Management
File is nothing but a collection of information. The information
can be of numbers, characters, graphs, images, etc. Directory is
a place/area/location where a set of file(s) will be stored.

7
File Management System
The file management system is a software which is used to
create, delete, modify and control access and save files.

8
Types of Files
There are five types of files such as Ordinary files,
Directory files, Device files, FIFO files

What is Compiler?
The compiler is software that converts a program written in a high- level
language (Source Language) to low-level language

Computational Skills Page 6


(Object/Target/Machine Language).

Introduction to Algorithms:

What is Algorithm? Algorithm Basics

The word Algorithm means “a process or set of rules to be followed in


calculations or other problem-solving operations”. Therefore Algorithm refers to
a set of rules/instructions that step-by-step define how a work is to be executed
upon in order to get the expected results. OR
Algorithm is a step by step procedure to perform a specific task.
It can be understood by taking an example of cooking a new recipe. To cook a
new recipe, one reads the instructions and steps and execute them one by one,
in the given sequence. The result thus obtained is the new dish cooked perfectly.
Similarly, algorithms help to do a task in programming to get the expected
output.

Computational Skills Page 7


The Algorithm designed are language-independent, i.e. they are just plain
instructions that can be implemented in any language, and yet the output will
be the same, as expected.
What are the Characteristics of an Algorithm?

• Clear and Unambiguous: Algorithm should be clear and unambiguous. Each


of its steps should be clear in all aspects and must lead to only one meaning.
• Well-Defined Inputs: If an algorithm says to take inputs, it should be well-
defined inputs.
• Well-Defined Outputs: The algorithm must clearly define what output will
be yielded and it should be well-defined as well.
• Finite-ness: The algorithm must be finite, i.e. it should not end up in an
infinite loops or similar.
• Feasible: The algorithm must be simple, generic and practical, such that it
can be executed upon with the available resources. It must not contain some
future technology, or anything.
• Language Independent: The Algorithm designed must be language-
independent, i.e. it must be just plain instructions that can be implemented
in any language, and yet the output will be same, as expected.
Advantages of Algorithms:

Computational Skills Page 8


• It is easy to understand.
• Algorithm is a step-wise representation of a solution to a given problem.
• In Algorithm the problem is broken down into smaller pieces or steps hence,
it is easier for the programmer to convert it into an actual program.

Disadvantages of Algorithms:

• Writing an algorithm takes a long time so it is time-consuming.


• Branching and Looping statements are difficult to show in Algorithms.

How to Design an Algorithm?

In order to write an algorithm, following things are needed as a pre- requisite:

1. The problem that is to be solved by this algorithm.


2. The constraints of the problem that must be considered while solving the
problem.
3. The input to be taken to solve the problem.
4. The output to be expected when the problem the is solved.
5. The solution to this problem, in the given constraints.

Algorithm 1: Add two numbers entered by the user

Step 1: Start
Step 2: Declare variables num1, num2 and sum.
Step 3: Read values num1 and num2.
Step 4: Add num1 and num2 and assign the result to sum.
sum←num1+num2
Step 5: Display sum
Step 6: Stop

Algorithm 2: Find the largest number among three numbers

Computational Skills Page 9


Step 1: Start
Step 2: Declare variables a,b and c.
Step 3: Read variables a,b and c.
Step 4: If a > b
If a > c
Display a is the largest number.
Else
Display c is the largest number.
Else
If b > c
Display b is the largest number.
Else
Display c is the greatest number.
Step 5: Stop

Computational Skills Page 10


12 FLOW CHART
Diagrammatic representation of an algorithm is called flow chart. Symbols
used in flowchart are mentioned below –

Name Symbol Purpose

Terminal start/stop/begin/en
d

Oval

Input/outpu Input/output of data


t

Parallelogram

Process Any processing to


be performaed can
be represented

Rectangle

Computational Skills Page 11


Decision box Decision operation
that determine
which of the
alternative paths to
be followed

Diamon

Connector Used to connect


different parts of
flowchart

Circle
Flow Join 2 symbols and
also represents
flow of execution

Arrows

Pre defined Module (or)


process subroutines
specified else
where
Double Sided Rectangle

Computational Skills Page 12


Page Used to connect
connector flowchart in 2
different pages

Pentagon

For loop shows initialization,


symbol condition and
incrementation of
loop variable

Hexagon

Document Shows the data that


is read

Printout

13 EXAMPLE
Given below is the flowchart for finding an average of three numbers −

Computational Skills Page 13


14 DATA TYPES IN C
A data type specifies the type of data that a variable can store such as integer, floating,
character, etc.

Computational Skills Page 14


There are the following data types in C language.

Types Data Types

Basic Data Type int, char, float, double

Derived Data Type array, pointer, structure, union

Enumeration Data Type enum

Void Data Type void

15 BASIC DATA TYPES


The basic data types are integer-based and floating-point based. C language
supports both signed and unsigned literals.

The memory size of the basic data types may change according to 32 or 64bit
operating system.

Data Types Memory Size Range

char 1 byte −128 to 127

signed char 1 byte −128 to 127

unsigned char 1 byte 0 to 255

short 2 byte −32,768 to 32,767

signed short 2 byte −32,768 to 32,767

unsigned short 2 byte 0 to 65,535

int 2 byte −32,768 to 32,767

signed int 2 byte −32,768 to 32,767

unsigned int 2 byte 0 to 65,535

Computational Skills Page 15


short int 2 byte −32,768 to 32,767

signed short int 2 byte −32,768 to 32,767

unsigned short int 2 byte 0 to 65,535

long int 4 byte -2,147,483,648 to 2,147,483,647

signed long int 4 byte -2,147,483,648 to 2,147,483,647

unsigned long int 4 byte 0 to 4,294,967,295

float 4 byte

double 8 byte

long double 10 byte

1. int main()
2. {
3. int a=10;
4. int A=20;
5. printf("Value of a is : %d",a);
6. printf("\nValue of A is :%d",A);
7. return0;
8. }

Output

Value of a is : 10
Value of A is :20

16 COMMENTS IN C

Comments in C language are used to provide information about lines of code. It


is widely used for documenting code. There are 2 types of comments in the C
language.

1. Single Line Comments

Computational Skills Page 16


2. Multi-Line Comments

17 SINGLE LINE COMMENTS

1. #include<stdio.h>
2. int main(){
3. //printing information
4. printf("Hello C");
5. return
0; 6. }

18 MULTI LINE COMMENTS


Multi-Line comments are represented by slash asterisk \* ... *\. It can occupy
many lines of code, but it can't be nested. Syntax:

1. /*
2. code
3. to be commented
4. */
5.
6. #include<stdio.h>
7. int main(){
8. /*printing information
9. Multi-Line Comment*/
10. printf("Hello C");
11. return 0;
12. }

18.1 PROGRAMMING ERRORS IN C

Errors are the problems or the faults that occur in the program, which makes
the behavior of the program abnormal, and experienced developers can also
make these faults. Programming errors are also known as the bugs or faults,
and the process of removing these bugs is known as debugging.

Computational Skills Page 17


These errors are detected either during the time of compilation or execution.
Thus, the errors must be removed from the program for the successful
execution of the program.

There are mainly five types of errors exist in C programming:

o Syntax error o
Run-time error o
Linker error o
Logical error o
Semantic error

Syntax error:

Syntax errors are also known as the compilation errors as they occurred at the
compilation time, or we can say that the syntax errors are thrown by the
compilers. These errors are mainly occurred due to the mistakes while typing
or do not follow the syntax of the specified programming language. These
mistakes are generally made by beginners only because they are new to the
language. These errors can be easily debugged or corrected.

For example:

1. If we want to declare the variable of type integer,


2. int a; // this is the correct form
3. Int a; // this is an incorrect form.
Commonly occurred syntax errors are:

o If we miss the parenthesis (}) while writing the code.


o Displaying the value of a variable without its declaration.
o If we miss the semicolon (;) at the end of the statement.

Let's understand through an example.

1. #include <stdio.h>
2. int main() 3. {
4. a = 10;
5. printf("The value of a is : %d", a);
6. return
Computational Skills Page 18
0; 7. }
Logical error:

The logical error is an error that leads to an undesired output. These errors
produce the incorrect output, but they are error-free, known as logical errors.
These types of mistakes are mainly done by beginners. The occurrence of these
errors mainly depends upon the logical thinking of the developer. If the
programmers sound logically good, then there will be fewer chances of these
errors.

Let's understand through an example.

Example 1: A student has written a program to find the average of their test
results.
#include<stdio.h>
void main()
{
int test1,test2,test3; int average;
average = test1 + test 2 + test3 / 3
printf(“average=%d”, average);
getch();
}
When the student runs the program, they get results that are obviously incorrect.
It is not a syntax error as the code can be compiled and run. What is the logic
error?
The program is dividing test3 by 3 and then adding it to test1 and test2.

18.2 SHOULD BE (TEST1 + TEST2 + TEST3)/3

Example 2: The student is also having problems with the following code.
int first_number; int
second_number; int
result;
result = first_number * second_number

Computational Skills Page 19


He inputs 13.5 as the first number and 3 as the second number but the result is 39
and not 40.5 as he was expecting. What is the logic error?
The student has declared all of the variables as integers and so the computer will treat
13.5 as 13. Hence the result is 39.

The student should have declared them as variables able to hold decimal
numbers e.g. as float or double.

NOTE :-
➢ AS I AM PROVIDING YOU THIS NOTES BY AIMED YOU JUST HAVE TO BE PREPARED FOR YOUR
UNIVERSITY EXAMINATION

➢ IF YOU NEED ANY EXTRA MATERIAL FOR STUDY ND EXAM REFERANCE THEN ALSO YOU CAN MSG
MI PERSONALLY HERE :- FYNOTESPROVIDER

➢ WE’VE ALSO CREATED A GROUP IN THAT YOU CAN DISCUSS YOUR DOUBTS WITH YOUR FRIENDS
FROM DIFFERENT COLLEGES STUDENTS OF SAME UNIVERSITY :- rtmnuFYfriendcircle

➢ THE LAST REQUEST FROM MY SIDE IS THAT GUYS YOU JUST HAVE TO SHARE THIS NOTES WITH
YOUR COLLEGE FRIENDS ND DO CONTINUOUSLY SUPPORT TO THIS PLATFORM.

WHATS APP GROUP LINK :- CLICK HERE TO JOIN

Computational Skills Page 20

You might also like