320x Filetype PDF File size 2.08 MB Source: galgotiacollege.edu
Lecture Notes-Module Wise
Programming for Problem Solving (KCS-101/KCS-201)
Sarvesh Kumar Swarnakar
Lecture Notes||Programming for Problem Solving (KCS-101/KCS-201)||S.K. Swarnakar@IT-GCET 1
INDEX
S.No Topic/Syllabus Page Module
Number
1. Introduction to components of a computer system: Memory, 3
processor, I/O Devices, storage
2. Operating system –functions and services 10
3. Concept of assembler, compiler, interpreter, loader and linker 15
4. Idea of Algorithm: Representation of Algorithm, Flowchart, 17
Pseudo code with examples, From algorithms to programs, M1
source code. Introduction
5. Programming Basics: Structure of C program, Syntax , errors 22
6. Components of C language, Standard I/O in C, Fundamental 24
data types, Variables and memory locations
7. Storage classes 30
8. Arithmetic expressions and precedence: Operators and 34
expression using numeric and relational operators, mixed M2
operands, type conversion, logical operators, bit operations, (Arithmetic
assignment operator, operator precedence and associability. expressions &
9. Conditional Branching: Applying if and switch statements, 43 Conditional
nesting if and else, use of break and Default with switch. Branching)
10. Iteration and loops: use of while, do while and for loops, 47 M3
multiple loop variables, use of break and (Loops &
11. Functions- Introduction, types of functions, functions with array, 54 Functions)
passing parameters to functions, Call by value, call by reference
12. Recursion 60
13. Arrays- Array notation and representation, manipulating array 63
elements, using multi dimensional arrays, passing arrays to
functions M4
14. Basic Algorithms: Basic Sorting Algorithms (Bubble, Insertion 73 (Arrays &
and Selection) Basic
15. Character arrays and strings 82 Algorithms)
16. Structure, Use of pointers in self-referential structures Structure 87
Array of structures
17. Union, enumeration 89
18. Notion of order of complexity 91
19. Pointers- Introduction, declaration, applications 93 M5
20. Introduction to dynamic memory allocation (malloc, calloc, 97 ( Pointer& File
realloc, free) Handling)
21. Notion of linked list (no implementation) 101
22. File handling: File I/O functions 103
23. Standard C preprocessors, defining and calling macros, 106
command-line arguments Conditional compilation, passing
values to the compiler
24. Important Programs with solution 113
25. Questions Bank 142
Lecture Notes||Programming for Problem Solving (KCS-101/KCS-201)||S.K. Swarnakar@IT-GCET 2
Module – 1: (Introduction to Programming)
Topic: Introduction to components of a computer system: Memory, processor, I/O
Devices, storage
INTRODUCTION TO COMPUTERS
Any programming language is implemented on a computer. Right from its inception, to the present
day, all computer system (irrespective of their shape & size) perform the following 5 basic
operations. It converts the raw input data into information, which is useful to the users.
1. Input: It is the process of entering data & instructions to the computer system.
2. Storing: The data & instructions are stored for either initial or additional processing, as & when
required.
3. Processing: It requires performing arithmetic or logical operation on the saved data to convert it into
useful information.
4. Output: It is the process of producing the output data to the end user.
5. Controlling: The above operations have to be directed in a particular sequence to be completed.
Based on these 5 operations, we can sketch the block diagram of a computer.
Block Diagram of a Computer
Input Unit:
We need to first enter the data & instruction in the computer system, before any computation
begins. This task is accomplished by the input devices. (The data accepted is in a human readable
form. The input device converts it into a computer readable form.
Input device: The input device is the means through which data and instructions enter in a
computer.
1. Camera - most cameras like this are used during live conversations. The camera transmits a
picture from one computer to another, or can be used to record a short video.
Lecture Notes||Programming for Problem Solving (KCS-101/KCS-201)||S.K. Swarnakar@IT-GCET 3
2. Compact Disc (CD) - CDs store information. The CD can then be put into another computer,
and the information can be opened and added or used on the second computer. Note: A CD-R or
CD-RW can also be used as an OUTPUT device.
3. Keyboard - The keyboard is a way to input letters or numbers into different applications or
programs. A keyboard also has special keys that help operate the computer.
4. Mouse - The mouse is used to open and close files, navigate web sites, and click on a lot of
commands (to tell the computer what to do) when using different applications.
5. Microphone - A microphone is used to record sound. The sound is then saved as a sound file
on the computer.
6. Scanner - A scanner is used to copy pictures or other things and save them as files on the
computer.
7. Joystick - A joystick is used to move the cursor from place to place, and to click on various
items in programs. A joystick is used mostly for computer games.
8. Bar Code Scanner - A bar code scanner scans a little label that has a bar code on it. The
information is then saved on the computer. Bar code scanners are used in libraries a lot.
Storage Unit:
The data & instruction that are entered have to be stored in the computer. Similarly, the end results
& the intermediate results also have to be stored somewhere before being passed to the output unit.
The storage unit provides solution to all these issues. This storage unit is designed to save the initial
data, the intermediate result & the final result. This storage unit has 2 units: Primary storage &
Secondary storage.
Primary Storage:
The primary storage, also called as the main memory, holds the data when the computer is currently
on. As soon as the system is switched off or restarted, the information held in primary storage
disappears (i.e. it is volatile in nature). Moreover, the primary storage normally has a limited
storage capacity, because it is very expensive as it is made up of semiconductor devices.
Lecture Notes||Programming for Problem Solving (KCS-101/KCS-201)||S.K. Swarnakar@IT-GCET 4
no reviews yet
Please Login to review.