You are on page 1of 29

INSTITUTE - UIE

DEPARTMENT- ACADEMIC UNIT-1


Bachelor of Engineering (Computer Science & Engineering)
Subject Name and Code: Computer Programming
UCT-145
Prepared by Ms. Jasleen Kaur

Introduction to computers and programming DISCOVER . LEARN . EMPOWER


Introduction to
computers and
programming
Course Outcome
CO Title Level
Number

CO1 Identify​ situations where computational methods Understand


would be useful.
CO2 Approach the programming tasks using techniques Remember
learnt and write pseudo-code.
CO3 Choose the right data representation formats based on Understand
the requirements of the problem.
CO4 Use the comparisons and limitations of the various Understand
programming constructs and choose the right one for
the task.

2
• Space for visual (size 24)

CONTENTS

• Introduction: Basic block diagram and


functions of various components of computer
• Introduction to Flow charts and Algorithms
• Examples
• Advantages and Disadvantages

3
COMPUTER
• A computer is an electronic device used to store and process information.
• It plays a major role in our lives.
• You use computers in education and research.
• You also use them for broadcasting news, receiving and sending messages to family and friends, making presentations, maintaining
official and personal records, making weather forecasts, and for various other business and recreation activities.
• By using computers, you save a lot of time, effort, and money.
• The basic functional units of computer are made of electronics circuit and it works with electrical signal. We provide input to the
computer in form of electrical signal and get the output in form of electrical signal.
• Please go to this link for video https://youtu.be/_bVqU4D_MVw

4
BINARY NUMBER SYSTEM
• Computer is a digital device, which works on two levels of signal. We say these two levels of signal as High and Low.
• The High-level signal basically corresponds to some high-level signal (say 5 Volt or 12 Volt) and Low-level signal basically corresponds to
Low-level signal (say 0 Volt)
• These two signals corresponds to two levels of electrical signals, and symbolically we represent them as 0 and 1.
• In our day to day activities for arithmetic, we use the Decimal Number System. The decimal number system is said to be of base, or radix
10, because it uses ten digits and the coefficients are multiplied by power of 10.

• The binary number system is said to be of base 2 or radix 2, because it uses two digits and the coefficients are multiplied by power of 2.
• The binary number 110011 represents the quantity equal to:

5
Figure 1.1 Binary to Decimal conversion [4]

6
INTERNALLY
1. Optical Drive
2. AirPort Extreme Card slot
3. System Blowers
4. Hard Drive
5. Right Speaker
6. I/O Ports
7. Power Supply
8. Diagnostic LEDs
9. Power PC G5 Processor
10. DIMM slots
11. Left Speaker

Figure 1.2 Internal system of computer [3]


7
CONNECTIONS
1. AirPort Antenna
2. Bluetooth Antenna
3. Optical Audio out
4. Optical Audio in
5. Analog Audio out
6. Analog Audio in
7. USB 2.0
8. FireWire 400
9. FireWire 800
10. 10/10/1000BASE-T Ethernet
11. Modem

Figure 1.3 Ports in a computer [3]

8
BLOCK DOAGRAM OF COMPUTER

Figure 1.4 Block diagram of computer [6]


COMPONENTS
INPUT UNIT
Keyboard, mouse, joystick, scanner, touch screen etc
STORAGE UNIT
Primary Devices : e.g. RAM,ROM
Secondary Devices: e.g. HDD, Floppy Disk, CD-ROM, CD-
R, DVD etc.
OUTPUT UNIT
Printers, Monitors, LCD etc.
PROCESSING UNIT
CPU (CU + ALU)

Figure 1.5 Internal system of computer [3]

10
ALGORITHM
• An algorithm is a detailed series of instructions for carrying out an operation or solving a problem.
• It is important to write computer programs without any logical error to generate the proper output.
• So, it is recommended that the programmer prepare a rough design to solve the problem by showing the steps involved in the program.
This is called algorithm.
• So in simple words, an algorithm is a step by step procedure to describe the solution of a particular problem.
• Let’s take a real-world example, a simple algorithm to make a coffee! So, what are the steps involved in making a coffee? Let’s write
down all the steps one by one.

11
ALGORITHM TO MAKE COFFEE
• Wash the kettle.
• Connect the kettle to the power supply.
• Wash the mugs and spoons.
• Fill the kettle with water.
• Switch on the kettle.
• Mix milk powder, sugar and coffee with cold water.
• Wait until the water boils.
• Switch off the kettle and disconnect it from the power supply.
• Pour the hot water into the mug and stir it.
• Serve the coffee.

12
ALGORITHM TO MAKE COFFEE
We repeat the steps from 6 through 9 to serve or prepare more coffee for the amount of water contained in the kettle. When the water is not
sufficient enough, we repeat from step 4 through 9. Here, we apply our logical thinking capability to judge the quantity of water and
temperature of boiled water. We are sure that you can think of a different approach for making coffee.

Now, let’s take another example, an algorithm to find the largest of three numbers with a computer program.

13
The algorithm to find the largest of three
numbers

Figure 1.6 Working of algorithm [3]

14
FLOWCHART
A flow chart is a graphical or symbolic representation of a process. Each step in the process is represented by a different symbol and
contains a short description of the process step.
It uses several geometrical figures to represent the operations, and arrows to show the direction of flow.
The flow chart symbols are linked together with arrows showing the process flow direction.

15
Figure 1.7 Working of flowchart [3]
16
SYMBOLS USED IN FLOWCHART
Oval shaped symbol is used to denote the start/end
of program

This symbol is used to show the I/O performed

This symbol is used to show the process

This symbol represents the point where decision is


made

This symbol is used to show the I/O performed

Oval shaped symbol is used to denote the start/end


of program
Figure 1.8 Symbols in flowchart
17
EXAMPLES OF FLOWCHART AND ALGORITHMS
• Example: Add 10 and 20
• Initialize sum = 0 (PROCESS)
• Enter the numbers (I/O)
• Add them and store the result in sum (PROCESS)
• Print sum (I/O)

Figure 1.9 flowchart for addition of two numbers


18
EXAMPLE: CALCULATE INTEREST OF BANK DEPOSIT
• Algorithm:
• Step 1: Read amount,
• Step 2: Read years,
• Step 3: Read rate,
• Step 4: Calculate the interest with formula
"Interest=Amount*Years*Rate/100
• Step 5: Print interest

Figure 1.10 flowchart to calculate interest rate 19


DETERMINE WHETHER THE NUMBER IS EVEN OR
ODD
• Algorithm:
• Step 1: Read number N,
• Step 2: Set remainder as N modulo 2,
• Step 3: If remainder is equal to 0 then
• number N is even, else number N is odd.
• Step 4: Print output.

Figure 1.11 flowchart for even/odd 20


DETERMINE WHETHER TEMPERATURE IS ABOVE OR
BELOW FREEZING POINT
• Algorithm:
• Step 1: Input temperature,
• Step 2: If it is less than 32,
• then print "below freezing point",
• otherwise print "above freezing point"

Figure 1.12 flowchart to determine temperature


21
DETERMINE WHETHER STUDENT PASSED THE EXAM
OR NOT
• Algorithm:
• Step 1: Input grades of 4 courses M1, M2, M3 and M4,
• Step 2: Calculate the average grade with formula
"Grade=(M1+M2+M3+M4)/4"
• Step 3: If the average grade is less than 60, print "FAIL", else
print "PASS".

Figure 1.13 flowchart to print pass/fail 22


Print Hello World 10 times
• Initialize count = 0 (PROCESS)
• Print Hello World (I/O)
• Increment count by 1 (PROCESS)
• Is count < 10 (DECISION)
• if YES go to step 2
else Stop

Figure 1.14 flowchart to print hello 10 times 23


Key Differences Between Algorithm and Flowchart
• An algorithm involves a combination of sequential steps to interpret the logic of the solution. In contrast, a flowchart is the pictorial
illustration of the algorithm.
• A flow chart is more understandable as compared to the algorithm.
• The algorithm is written in a language that can be perceived by humans. On the other hand, the flowchart is made up using different
shapes and symbols.
• There are no stringent rules are implemented in the algorithms while the flowchart is abode by predefined rules.
• Errors and bugs are easily detected in the algorithm as compared to the flow charts.
• Flow charts are simple to create. On the contrary, the construction of the algorithm is complex.

24
ADVANTAGES OF ALGORITHM AND FLOWCHART
• It identifies the solution process, decision points and variables required to solve the problem.
• It helps in dividing a huge problem into smaller manageable steps of the solution.
• The analysis and specification of the process lead to the efficiency.
• Separation of the steps divides labour and development expertise.
• The flowchart is a good way of conveying the logic of the system.
• Facilitates the analysis of the problem.
• Provides a proper documentation.
• Easy identification of the errors and bugs.
• It directs the program development.
• Maintenance of the program becomes easy.

25
DISADVANTAGES
Disadvantages of the Algorithm
• At a specific point, the algorithm terminates.
• Inability to solve problems that generate non-computational results.
• Consumes a lot of time.

Disadvantages of the Flow Chart


• The complex logic could result in the complex flow chart.
• A flowchart must be recreated to employ modification and alterations.

26
ASSESSMENT PATTERN
Section- A

1. All questions are mandatory. Each question carry 2 marks each


(a) Draw flowchart to find largest among three different numbers.
(b) Draw flowchart to determine whether number is prime or not.
Section- B

Following questions carry 10 marks each


2. Write algorithm for the following :
a) to check whether an entered number is odd / even.
b) to calculate sum of three numbers.
3. Draw a flowchart to find the Fibonacci series till term≤1000.

27
REFERENCES
Books
[1] Balagurusamy, E. (2010). Fundamentals of Computer. Beijing: Tsinghua University
Press.
Websites
[2] Colourbox. (2019). Computer ports type, ... | Stock vector | Colourbox. [online]
Available at: https://www.colourbox.com/vector/computer-ports-type-vector-illustration-
vector-6161708 [Accessed 31 May 2019].
[3] Rapidtables.com. (2019). Online Calculators & Tools - RapidTables.com. [online]
Available at: https://www.rapidtables.com/ [Accessed 17 May 2019].
[4] Khan Academy. (2019). Algorithms | Computer science | Computing |Khan Academy.
[online] Available at: https://www.khanacademy.org/computing/computer-
science/algorithms [Accessed 17 May 2019].
[5] | (2019). Computer Intro.. [online] Ecomputernotes.com. Available at:
http://ecomputernotes.com/fundamental/introduction-to-computer/ [Accessed 31 May
2019].
[6] YouTube. (2019). Introducing How Computers Work. [online] Available at:
https://www.youtube.com/watch?v=OAx_6-wdslM [Accessed 31 May 2019].
28
THANK YOU

For queries
Email: UCT1452019@gmail.com

You might also like