0% found this document useful (0 votes)
15 views

Module 1 - Introduction To Computing Programming

Uploaded by

sasanktumpati60
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Module 1 - Introduction To Computing Programming

Uploaded by

sasanktumpati60
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

Module 1 - Introduction to

Computer Programming
BITS Pilani Dr. Tejasvi Alladi
Pilani Campus
Department of Computer Science & Information Systems
Module Overview
• General course information

• Objectives of the Course

• Computers and Computing

• Introduction to Programming

• The C language

• Program and Process Execution


Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus

General Course Information


CS F111 - Team
Instructors for Lecture Session

Dr. Asish Dr. Tejasvi Dr. Vinti


Bera Alladi (I/C) Agarwal

Instructors for Laboratory Sessions


Aravind B S, Arti Jha, Oshin Rawlley, Devika S, Aarti, Anish Khan, Ishita Jain, Shwetha Valavarasu

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
Text Book and Reference Books
Text Book:
Hanly, J.R. and E.B. Koffman. Problem Solving and Program Design in C(7/e).
Pearson Education, 2013

Reference Books:
1. Patt, yale. Introduction to computing systems: from bits & gates to C
&beyond (2/e). Mcgraw hill education, 2017.
2. Forouzan, b.A. And richard F. Gilberg . computer science A structured
programming approach using C (3/e). Cengage learning, 2007
3. Gottfried, B.S. and Jitender chhabra. Programming with C (schaum's
outlines series, 3/e). Mcgraw hill education, 2017.
4. Kernighan, b.W and dennis ritchie. The C programming language (2/e).
Pearson education india, 2015.
5. Das, s. Unix: concepts and applications (4/e). Mcgraw hill education, 2017.
6. Das, Sumitabha. Computer fundamentals and C programming. New delhi,
india: mcgraw hill education. (2018)

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
Course Website

Course Website
• Nalanda – LMS of BITS Pilani
• https://nalanda-aws.bits-pilani.ac.in/

• Nalanda will be used for:


• Uploading Lecture notes and lab sheets
• Course Announcements and notices
• You will get a notification of the announcement on your
registered BITS email ID.

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
Laboratory Sessions

Laboratory Sessions
• Weekly 2 hours. Total 13 lab sessions starting from August 21,
Monday. First 3 labs will be non-evaluative.
• The best 8 of remaining 10 labs will be considered for grading, with
each lab carrying 3 marks.
• Each lab session will have a lab sheet.
• You will have to go through the lab sheet and do the given tasks.
• You will be assisted by a team of 3-4 instructors who would help
you solve the lab sheets and clarify your doubts.
• Lab sessions will be conducted on Ubuntu OS in the IPC/CSIS Dept.
labs. C Programs are to be run using GCC compiler only.
• For home practice - install WSL on your personal computers, along
with the gcc compiler and sublime text editor [DIY] or Ubuntu OS
• Links for video tutorials of lab sheets: shorturl.at/tOWZ1
Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
Evaluation Components

Nature of
component
Component Duration Marks Date & Time
(Close Book/ Open
Book)
Mid-Semester Test 90 Min. 60 12/10 FN2 Closed Book
Comprehensive
180 Min. 100 13/12 AN Closed Book
Examination
Quiz 40 Min. 30 23/09 Closed Book

Programming test 150 Min. 86 19/11 Open Book


120 Min.
Laboratory Sessions 24 -- --
each

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
Makeup Policy
• Make-ups are generally considered only for medical emergencies
leading to hospitalization (or a personal emergency of similar
nature).

• The decision by the Instructor-in-Charge regarding granting make-


ups shall be final.

• No makeup for weekly laboratory sessions. Best 8 of 10 evaluative


labs will be considered for grading.

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
Disciplinary Policy
• If we find you using unfair means during the evaluative
components, the case will be reported to AUGSD and shall be
dealt with very seriously as per the guidelines.

• You can find the AUGSD guidelines for unfair means cases over
here –

https://academic.bits-
pilani.ac.in/Downloads/Unfair_Means_Offence_Revised_02_AUG_2022.pdf

• So don’t indulge in unfair means and BE HAPPY!

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus

Course Objectives
Course Objectives

• Learn about Computers and Computing Methodologies

• Learn basic concepts of programming using the C language

• Construct Solutions to Scientific Problems through


programming

• Systematic techniques and approaches for constructing


programs

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus

Computers and Computing


We have seen Computers…

Desktop Laptop
Computer Computer

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
Smart Devices (Small
Computers)

Smart Phone

Tablet Smart Watch

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
Super Computer…

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
What is a Computer?
A device that takes data as input, does some processing and then
returns an output.
CPU
Control
Unit
Input Output

ALU

Memory

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
What is a CPU?
• CPU stands for Central Processing Unit.
• The CPU is often simply referred to as the
processor.
• The CPU is the brain of a computer, containing all
the electronic circuitry needed to process input,
store data, and output results.
• Essentially CPU executes computer programs.
• It consists of an arithmetic and logic unit (ALU),
and a control unit
• ALU performs arithmetic and logical Intel i7
operations specified by a computer program Processor
• Control Unit directs the operations of the
Processor
Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
What is memory?
• Computer memory is the storage space in the computer, where
“data to be processed” and “instructions required for
processing” are stored.

RAM chips Hard Disk


Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
Types of Memory

Registers (inbuilt on the In this course, we will deal with


Primary memory (RAM) and
processor)
Secondary Memory (DISK) only!

Cost and
Size Cache (inbuilt on the Speed
processor)
Registers, Cache and RAM
are volatile
• Retains data as long as the
Primary (RAM, ROM) voltage is applied

ROM and Secondary devices


Secondary (HDD, SSD, are non-volatile
• Retains data permanently
PenD, Floppy, Tape, CD)
without any voltage
Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
Hardware vs Software

• Hardware is the physical parts of the computer: motherboard, CPU,


RAM, keyboard, monitor, etc.
• Software is a collection of instructions at can be run on the
hardware of the computer. These instructions tell the computer what
to do.
• In other words, Software is a Computer Program.
• Software is not a physical thing, just a bunch of programs.
Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus

Introduction to Programming
What is a Computer Program?

“A Computer Program (or simply a Program) is


a collection of instructions that performs a specific
task when executed by a computer”

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
Where are Programs Used?
• MS Word is a Program

• Google Chrome is a Program

• Skype is a Program

• Hawk’s-eye is a Program

• Windows OS is a Program

Anything we do on a computer requires us to write a program…


Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
Programming Language
• Programs in a computer are written using a Programming Language

• A programming language is a vocabulary and set of grammatical


rules for instructing a computer to perform specific tasks.

• Examples: C, C++, Java, Python, etc.

• Each language has a unique set of keywords (words that it


understands) and a special syntax for organizing program
instructions.

• Programming languages are unambiguous.


Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
Levels of Programming
Languages

High Level Language

Assembly Language Ease of


understanding

Machine language

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
Machine Language

High Level Language


• Language of the machine Ease of
Assembly Language understanding

• Made up of a series of binary Machine language


patterns
Machine Code
• Can be run directly 1001110100001101000000
0110000110100001111011

• Difficult to learn 1000000101111101101110


1111011000101101100010
1000000010011110000110
1001001100011100000001

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
Assembly Language

High Level Language


Ease of
• Uses simple mnemonic Assembly Language understanding

abbreviations Machine language

• Unique to a specific CPU Assembly Code


architecture __start:
mov edx, len
• Requires an assembler add ecx, edx
mov ebx, 1
sub eax, edx
int 0x80

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
High level Language

High Level Language


• English-like Ease of
Assembly Language understanding

• Easier to understand Machine language

• Requires Compiler High-level Code


#include<stdio.h>
int main() {
• Compiler: Generates int a, b, sum;
object/machine code scanf("%d %d", &a, &b);
sum = a + b;
printf("The sum is %d\n", sum);
return 0;
}
Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus

The C Programming Language


The C language
• General Purpose high-level programming language

• Closely associated with the UNIX operating system

• Most versatile as it supports direct access of memory


locations through pointers

• Compiler based language


We will Study
• C programs are known for speed More about C in
and efficiency! this course
Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus

Program and Process Execution


Perform tasks with Programs

You want to perform a specific task using a computer. You will


do the following steps:

• Write a C program specific to your task


• Save it on the computer
• Compile and Run your program

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
What happens to your program?

You write a program…

1. Where is your program saved?

2. What happens to your program when you try to compile and run it?

Before we answer the above questions let us see what is an


operating system…

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
Operating System (OS)
• An OS is a layer of
software interposed User
between the application
programs and the hardware
Application
• OS manages everything on
your computer including
hardware Operating System

• OS is responsible for
executing your program Hardware

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
Basic layout of Computer Hardware

OS Manages
these resources

CPU Disk (Secondary


Memory)

Primary Memory
(RAM)
Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
What happens to your program?

Now let us answer these questions…

1. Where is your program saved?

2. What happens to your program when you try to compile and run it?

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
1. Where is your program saved?

Your program when


saved gets stored on
the disk

Program

CPU Disk (Secondary


Memory)

Primary Memory
(RAM)
Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
What happens to your program?

Now let us answer these questions…

1. Where is your program saved?

2. What happens to your program when you try to compile and run it?

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
2. What happens to your program
when you try to compile and run it?

• OS loads the
program into RAM
• Executes it line by
line on CPU

Program
Program Program

Program is Program
executed gets
CPU on CPU loaded Disk (Secondary
into RAM Memory)

Note: Program under


Primary Memory execution is known as a
(RAM) Process

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus

Thank you
Q&A

You might also like