EE171
Introduction to Computers &
Programming for Engineers
1
Degree Programmes:
2
Mode of Delivery
3
❖ Course Weight: 2 Units
❖ Lecture: 2 hours per week
(Tuesday, 15:00 -17: 00 hrs)
❖ Tutorial/Practical: 1 hour per week
Course Assessment
4
❖ Course Work (40%):
• First Test (15%)
• Second Test (15%) Subject to changes
• Lab/Quiz (10%)
❖ University Examination (60%)
Course Outline
5
❖ Computer Basics: Classification of Computers, Computer
Hardware, Computer Software, MS-DOS, Computer Languages,
Computer Number System
❖ Introduction to Computer Programming: Machine, Assembly
and High level languages.
❖ Computer Programming Algorithms: Algorithms, Pseudo-codes,
Flowcharts.
❖ Computer Programming in C: Identifiers, Operators, Basic
structure of a C program
Course Outline
6
❖ Simple Input and Output statements: Input and Output Functions,
Programming Errors in C
❖ Decision Making Statements: if, if-else, nested if-else, switch
❖ Loop Control Statements: for loop, while loop, do-while loop
❖ Jump Statements: goto, break, continue, return
❖ Arrays: Array declaration, one dimension and multi-dimensional arrays,
sorting and searching arrays elements.
Course Outline
7
❖ Strings: String arrays, string manipulation functions, Introduction to
Pointer-Based String Processing
❖ Functions: User defined functions, function declaration, definition,
calling function, built in functions, recursive functions.
❖ Structures and Unions: Declaration, Structure of Arrays, Structures
within Structures
❖ Pointers: Pointer Variable Declarations, Pointer Operators, Passing
Arguments to Functions by Reference, Pointer Arithmetic to simple
data types
Text/Reference Books
8
❖ Sinha P., “Computer Fundamentals”
❖ Kernighan, B. W. and Ritchie, D. M., “The C Programming
Language”, 2nd ed. Prentice-Hall,1988.
❖ Vine, Michael. “C Programming for the Absolute Beginner” 2nd
Ed. 2008
❖ Chaudhary H. “C Programming __ The Ultimate Way to Learn
The Fundamentals of The C Language”, 2014
EE171
Introduction to Computers &
Programming for Engineers
Lecture 1:
Computer Basics
9
What is a Computer?
10
What is a Computer?
11
What is a Computer?
12
❖Computer is an electronic device that accepts input data,
process data, store data and produce output according to a set
of instructions given to it.
❖Computers come in many forms, from the traditional desktop
PC to portable devices (laptop, tablet, smartphone).
❖The basic principles of how a computer operates are generally
the same, irrespective of its purpose.
Characteristics of Computers
13
Characteristics of Computers
14
❖Speed: Process data at very high speed (millions of tasks per second)
❖Accuracy: Performs calculations with almost 100% accuracy.
❖Reliability: Gives consistent result for similar set of data i.e., if we give same set
of input any number of times, we will get the same result.
❖Diligence: Capable of doing any work for a long time without getting tired.
❖Versatility: Performing different tasks at the same time.
❖Memory: Can store and recall massive amount of data stored within their
capacity.
❖No I.Q: Does only what it is programmed to do. It cannot make its own
decision.
Classification of Computers
15
❖ Based on their processing power (speed), cost and size
computers can be classified into four classes:
• Super computers
• Mainframe Computers
• Mini Computers
• Personal Computers
Super Computers
16
❖ Focused on performing tasks involving intense numerical calculations.
❖ Nuclear weapon testing, space exploration, and global weather patterns
Mainframe Computers
17
❖ Not as powerful as supercomputers, but handles bulk data processing.
❖ Data centers, Banks, Telecom
Mini Computers
18
❖ Also called workstations
❖ Used to handle data processing for many users simultaneously who are
connected via terminals
Personal Computers
19
❖ General purpose computer/micro computers.
❖ Designed for general usage like entertainment, education and personal
work
Computer Number System
20
Computer Number System
21
❖ Information in a computer is handled by electronic
components.
❖ Electronic components operate in two possible states
• HIGH (1) / LOW(0)
❖ Handling two possible states simplifies internal circuit design.
❖ However, humans prefer decimal number system when
working with data.
Decimal Binary Hexadecimal
0 0000 0
1 0001 1
2 0010 2
3 0011 3
4 0100 4
5 0101 5
6 0110 6
7 0111 7
8 1000 8
9 1001 9
10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
22
15 1111 F
Decimal Number System
23
❖ Uses ten (10) symbols/digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9).
❖ Each position of a digit represent a specific power of
the base (10)
❖ We use this number system in our day-to-day life.
Binary Number System
24
❖ Has two (2) symbols/digits (0 and 1).
❖ Each position of a digit represent a specific power of
the base (2)
❖ Computers use BINARY numbers for internal data
representation.
Hexadecimal Number System
25
❖ Has sixteen (16) symbols/digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B,
C, D, E, F).
❖ Each position of a digit represent a specific power of the
base (16)
❖ Used to represent binary numbers in compact form.
Number System Conversion
Self Study
Computer Fundamentals_by_Sinha
Chapter 03: Number System
26
Hardware
Computer System
Software
27
Computer System…
28
Hardware Software
Computer Hardware
29
❖ Computer hardware consists of four main components:
Input Devices
30
❖ Feeds data and instructions into a form which the computer understands
Input Devices?
31
• Mouse
• Trackball
• Keyboard
• CD-ROM
• Scanner
• DVD-ROM
• Touch pad
• Bar Code
• Light pen
• Reader
• Joysticks
• Microphones
• Digital
Cameras
• Touch Screen
Output Devices
32
❖ Provide processed information to the user either in softcopy or hardcopy.
Output Devices?
33
• VDU
• Screen monitors
• Printer
• Plotters
• Speakers
• Headphone
• Projectors
Computer Memory
34
❖ Devices that store data or instructions on temporary or permanent
basis.
Computer Memory Sizes
35
• Bit: Smallest unit of computer information(1/0)
• Byte: Smallest addressable memory (8 Bits)
• Kilobyte: A kilobyte (KB) consists of 1024 Bytes
• Megabyte: A megabyte (MB) consists of 1024 KB
• Gigabyte: A gigabyte (GB) consists of 1024 MB
• Terabyte: A terabyte (TB) consists of 1024 GB
• Petabyte: A petabyte (PB) consists of 1024 TB
Types of Computer Memory
36
Primary Memory
37
Random Access Memory (RAM)
❖ The main working memory of the computer that is used to store data
temporarily.
❖ It holds processed data and instructions for processing data.
❖ The CPU utilizes only those instructions and data that are stored in
RAM.
❖ The more RAM a computer has, the more instructions and data can be
processed at a time.
Primary Memory…
38
Read Only Memory (ROM)
❖ A special type of memory chip that holds software which can
be read but not written to.
❖ A good example is the ROM-BIOS chip, which contains read-
only software necessary for power-on startup.
Secondary Memory
39
❖ Designed to retain data even if the computer is shut down.
❖ While secondary memory is much slower than primary memory, it
typically offers greater storage capacity
❖ Unlike primary memory, secondary memory is not accessed directly
by the CPU.
❖ Instead, data accessed from secondary memory is first loaded into
RAM, which is then sent to the processor.
❖ This facilitates data processing speed.
Secondary Memory…
40
CPU RAM Secondary
Storage
Secondary Memory…
41
Solid State Devices (SSD) Magnetic Disk
Uses semiconductor-based Contains circular disc made of metal.
integrated circuits to store Uses magnetic memory store
information. information.
Secondary Memory…
42
Magnetic Tape Optical Storage
• Contains thin plastic ribbon used Data is written and read with a laser
for storing data diode.
• Mainly used for data backups
Central Processing Unit
43
❖ Is an integrated circuit or “chip” which processes instructions and data
Central Processing Unit…
44
❖ The CPU is attached to the system's motherboard, which connects all
the computer's devices together, enabling them to communicate.
Central Processing Unit…
45
❖ Arithmetic and Logical Unit (ALU)
❖ The control unit (CU)
❖ Registers
Central Processing Unit…
46
❖ Arithmetic and Logical Unit (ALU): Performs the arithmetic
operations and the logical comparisons.
❖ Control unit (CU): CPU Controls the entire operation of the
computer. Directs the flow of data through the CPU, to and
from other devices.
❖ Registers: Memory location within CPU which temporarily hold
data and program instructions while they are being processed.
Central Processing Unit…
47
Central Processing Unit…
48
❖ In order to process instructions and data, the CPU needs to
retrieve them from memory.
❖ Registers – saves the most frequently used instructions and data
❖ To do this, it follows a process known as Fetch-Execute Cycle
(or, sometimes, the Fetch-Decode-Execute cycle).
❖ This cycle repeats billions of times each second, giving the illusion
that the CPU is doing many things at the same time when, in reality,
it is really only processing one instruction at a time.
Self Study:
Fetch-Execute Cycle
49
Central Processing Unit…
50
❖ Clock: Ensures synchronization to all activities between components within the
computer.
❖ Decoder: Decodes instructions that are retrieved from memory during the fetch-
execute cycle
❖ Memory Address Register (MAR): Holds the address of the location in memory
where data or an instruction is to be retrieved or stored.
❖ Memory Data Register (MDR): Holds the data or instruction that has been retrieved
from memory or is about to be stored in memory
❖ Accumulator Register (AR): Holds the results of calculations and operations
performed by the ALU
❖ Program Counter(PC): Holds the memory address of the next instruction to be
executed.
System Bus
51
❖ Electronic communication path through which information (data, address,
commands) are transmitted between various components of the
computer.