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

Lec1 - Introduction To Computers

Uploaded by

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

Lec1 - Introduction To Computers

Uploaded by

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

Introduction to Computer Programming

L EC T URE 1 (I N T RODUC TION TO COM P U TERS)


BY
P ROF. D R. M . FA RHA N SHA FI Q U E

1
Introduction
Course Title: Programming Fundamentals
Course Code: CSC103
Course Instructor: Prof. Dr. M. Farhan Shafique
Contact me at
[email protected]
◦ 051-9049250
◦ Office 417, Academic Block 1, ECE Building Top floor

2
GRADING POLICY
THEORY ( 75/100)
Mid Term 25%
Assignment 10%
Quizzes 15%
Final exam 50%
LAB(25/100)
Lab assignments
Lab mid
Lab terminal
project

3
Programmers vs Developers vs Software Engineers
A software engineer is much more focused on the
architecture side i.e. crafting the final product bringing all
the system together (system integration). Software
Engineer has skills to do all levels of software development
(including development and programming)
whereas a developer concentrates more on individual
tasks inside of that development. Like different modules of
a software system. The software developer is also capable
of programming. However developer can not do system
integration.
The programmer is the most focused role in software
development. He is capable to make pseudocode and
translate the logic into a programing code. However the
programmer (coder) doesn’t have any idea about whole
system and structure of the software

4
Books and Resources
Recommended Books
1. Let us C by Yashavant P. Kanetkar
2. C, How to program by Dietel & Dietel

Online lectures and Resources


https://tinyurl.com/2fhb8xej

5
Lecture breakdown
• Computers and components of computers
• Hardware and software
• Computer operation
• Networks
• Operating system
• Software languages

6
Computers
Computer are integral part of our everyday existence
◦ Be it school, banks, shops, railway stations, hospital or your own home

As they are such integral parts of our lives


◦ we must know what they are and how they function

Let us start with defining the term computer formally.


The literal meaning of computer is a device that can calculate.
◦ However, modern computers can do a lot more than calculate.

Computer is an electronic device that


◦ receives input
◦ stores or processes the input as per user instructions,
◦ and provides output in desired format.

7
Computer - Components
A computer system has three main components:
◦ Hardware: The physical equipment associated with a computer system
◦ Software: is a set of instructions that tells the hardware what to do
◦ User: who uses the power of the computer for some purpose
◦ A user may or may not be a person.

A computer is an electronic device,


◦ operating under the control of instructions stored in its own memory
◦ that can accept data (input),
◦ process the data according to specified rules,
◦ produce information (output), and
◦ store the information for future use

8
Hardware vs Software

9
Data and Information
Data are Facts and figures which relay something specific
◦ not organized in any way, and
◦ provide no further information regarding patterns, context, etc.
◦ "unstructured facts and figures that have the least impact on the typical manager“

Information is data with relevance and purpose


◦ For data to become information, it must be
◦ contextualized, categorized, calculated and condensed.
◦ Information thus paints a bigger picture
◦ It may convey a trend in the environment, or
◦ perhaps indicate a pattern of sales for a given period of time.
◦ Essentially information is found "in answers to questions that begin with such words as who, what,
where, when, and how many"

https://www.just.edu.jo/~mqais/CIS99/PDF/Ch.01_Introduction_%20to_computers.pdf

10
Computer - Operations
At the core, the operations performed by a computer are:
Arithmetic operations − Examples include calculaKons like addiKon, subtracKon, differenKals,
square root, etc.
Logical operations − Examples include comparison operaKons like greater than, less than, equal
to, opposite, etc.

11
Computer – Basic Parts
Input Unit − Devices like keyboard and mouse that are used to
◦ Input data and instructions to the computer
Output Unit − Devices like printer and visual display that are used to
◦ Provide information to the user in desired format
Control Unit − Controls all the funcKons of the computer.
◦ All devices or parts of computer interact through the control unit
Arithmetic Logic Unit − This is the brain of the computer where all arithmeKc operaKons and
logical operations take place.
Memory
◦ All input data, instructions and data interim to the processes are stored
◦ Memory is of two types – primary memory and secondary memory
◦ Primary memory resides within the CPU and secondary memory is external to it

12
Components of Computers

13
Computer – Characteristics
Speed − A computer can carry out a few billion instrucKons per second.
Accuracy − Computers exhibit a very high degree of accuracy.
◦ Errors may occur due to inaccurate data, wrong instructions or bugs
Reliability − Computers can carry out same type of work repeatedly
◦ Without throwing up errors, due to tiredness or boredom, unlike humans
Versatility − Computers can carry out a wide range of work from
◦ data entry and ticket booking to
◦ complex mathematical calculations and continuous astronomical observations
◦ If the user can input the necessary data with correct instructions
◦ computer will do the processing.

Storage Capacity − Computers can store a large amounts of data


◦ at a fraction of cost of traditional storage of files
◦ Data is safe from normal wear and tear associated with paper

14
Characteristics of Computer

15
Computers – Advantages and Disadvantages
Computers can take up routine tasks
◦ while releasing human resource for more intelligent functions

Computers have no intelligence of their own


◦ they follow the instructions blindly, without considering the outcome

Regular electric supply is necessary to make computers work


◦ which could prove difficult in developing nations and remote locations

16
Computers - Booting
Starting a computer or a computer-embedded device
◦ is referred to as booting

As a result, all applications are in a state of readiness


Booting may involve following steps
◦ Switching on power supply
◦ Loading Basic Input Output System (BIOS)
◦ Loading Operating System (OS) into computer’s main memory

BIOS is a low-level piece of software, often referred to as firmware


◦ Performs necessary test, initiates hardware devices and loading OS

17
Computer – Networks
A computer network allow connection between multiple computers
◦ To allow communication and sharing of services

These services may include


◦ Printing and storage on the local network
◦ Email, web hosting and file sharing on a remote computer

Internet in the most widely recognized and used computer network

18
Computer – size and use
Desktop Laptop Tablet Server Main frame

Mainframe
◦ Serve a large number of users

Supercomputer
◦ Very high performance
◦ to solve complex problems

19
Computer – Hardware
Hardware - Any physical component of a computer system
◦ That contains circuit board, ICs, or other electronics and storage media
◦ Monitor, keyboard, mouse, printer, projector, and usb thumb/flash drive etc.
◦ CPU, HDD/SSD , fans, modem, motherboard, network card, RAM etc.

Without any hardware, a computer cannot exist, and


◦ Software could not be used, Minimum H/W:
◦ CPU/Processor, motherboard, RAM, video card, HDD/SSD
◦ power supply, keyboard/mouse, monitor and
◦ power/connecting cables

Hardware upgrade
◦ Possible in Desktop and similar computers
◦ replacing an existing hardware with a newer one

What’s a cloud then??

20
A Computer System Unit
A computer system unit or cabinet
◦ Contains most of the devices

Components
◦ Motherboard
◦ Microprocessor
◦ Memory
◦ RAM
◦ ROM
◦ CMOS
◦ Storage Disk Drives

21
Computer – Memory/Storage
The basic unit used in computer data storage is called a bit (binary digit)
◦ A bit can either take a value of 0 or 1
◦ Computer use this binary number system to store numbers
◦ For example, 22 in base-10 is 0001 0110 is base-2 (binary) Unit name Unit Symbol Description
Bit b 0 or 1
Eight bits make a computer byte
Byte B 8 bits
◦ Can represent a number, for example 0 to 255
Kilobyte KB 1024 bytes
Megabyte MB 1024 kilobytes
Gigabyte GB 1024 megabytes
Terabyte TB 1024 gigabytes

22
Computer – Software
The hardware devices need user instructions to function
◦ A set of instructions that achieve a single outcome
◦ is called program or procedure.
◦ Many programs functioning together to do a task make a software
◦ Example 1: A word-processing software enables the user
◦ to create, edit and save documents
◦ Example 2: A web browser enables the user to
◦ view and share web pages and multimedia files.

A software can be put in to one of the three categories


◦ System Software – Platform for other software: BIOS, Operating System etc.
◦ Application Software – Word Processor, Photoshop
◦ Utility Software – Manage/maintain computer: Antivirus, backup software etc.

23
Operating System (1/2)
Operating system (OS) is the lifeline of computer
◦ Co-ordinates between different devices
◦ Schedules multiple tasks as per priority
◦ Allocates resource to each task
◦ Enables computer to access network
◦ Enables users to access and use application software

One of the earliest operating systems was MS-DOS


◦ developed by Microsoft for IBM PC.
◦ It was a Command Line Interface (CLI) OS that revolutionized the PC market

Nowadays, commonly used operating Systems Windows


◦ Has a Graphical User Interface (GUI)

24
Operating System (2/2)
Performs various hardware resource management tasks like
◦ Processor Management – ensure optimum utilization of the CPU
◦ Manages multiple threads/programs trying to access the CPU
◦ Memory Management
◦ Manages primary and secondary memory, fast loading and execution of programs
◦ Involves loading of input/output data and instructions for each program
◦ Once execution is complete, the allocated memory space is cleared
◦ When the memory is full, employs paging, which is utilization of HDD as memory
◦ File Management
◦ Device Management
◦ Manages hardware devices via device drivers and provide access to other software

25
Computer – Software Language Processor (1/2)
A language processor is a system software, which
◦ Converts all user instructions into machine understandable language

Computer languages have three types:


◦ Machine-level: in the form of 1s and 0s, completely machine dependent
◦ Highest performance, infeasible for humans to write even small programs
◦ Assembly Level: in English like words, machine dependent
◦ replace an instruction of 1s and 0s with somewhat understandable mnemonics
◦ Useful only for small programs, high performance
◦ mnemonics are English like words MOV, LOAD, ADD and SUB etc.
◦ A simple program converts it to machine language, called an assembler
◦ High-level language: English like statements, independent of machines
◦ Easy to create/read/understand programs for humans
◦ A complex software is needed to convert into assembly, called a compiler
◦ Performance depends on the compiler

26
Computer – Software Language Processor (2/2)
A program written in a high-level language like C, C++, Java etc.
◦ is called source code

A set of instructions in machine reader form is called


◦ Object code or machine code

System software that coverts source code to object code


◦ Is called language processor

There are three types of language processors


◦ Assembler – converts assembly to machine code
◦ Interpreter – converts high-level program to machine level, line by line
◦ Conversion and execution goes alongside,
◦ Compiler – converts high-level program to machine level before, at once
◦ Conversion is performed before execution

27
Computer – Software – Compiler
System software that store the complete program
◦ scans it and translates the complete program into object code, and
◦ then creates an executable code is called a compiler
Compilers are generally more complex than Interpreters
◦ Compilers need more memory space
◦ Take longer in compiling source code
◦ Execution of the generated machine code is faster

28
Goals of this course
This course is about computer Programming
◦ Developing software in C (a High-level language )
◦ Which will be translated to instructions (and input data)
◦ An executed on the computer to obtain correct/expected output
◦ Various features provided by C language and computer
languages in general

29
A C language code Example
#include <stdio.h>
int main()
{
int n, c, row, t = 1;
printf("Enter a number in range (2 to 30): "); Enter a number in range (2 to 30): 2
1
scanf("%d", &n);
232

for (row = 1; row <= n; row++) {


for (c = 1; c <= n - row; c++) Enter a number in range (2 to 30): 5
printf(" "); 1
Compile/ 232
t = row;
34543
for (c = 1; c <= row; c++) { execute 4567654
printf("%d", t%10); 567898765
t++;
}
Enter a number in range (2 to 30): 10
t = t - 2;
1
232
for (c = 1 ; c < row; c++) { 34543
printf("%d", t%10); 4567654
t--; 567898765
} 67890109876
printf("\n"); 7890123210987
} 890123454321098
return 0; 90123456765432109
0123456789876543210
}

30

You might also like