Presentatio
n Title
Lorem ipsum dolor sit amet,
consectetur adipiscing elit.
Overview of
computers and
programming
Week 1 | CSC 1401 Computer programming
Objectives
• Recognize the importance of computer programming in modern society
• To learn about the different components of computers
• To understand the role of each component in a computer
• To learn how to solve a programming problem in a careful, disciplined way
• To learn the difference between machine language, assembly language, and
higher-level languages
• To differentiate between compiled and interpreted programming languages
2
CSC 1401 Computer programming
Part 1: Overview of Part 2: Overview of
computers’ architecture computer programming
• What is a computer ? • Problem-solving processes
• Types of computers • Classification of computer languages
• General architecture of a computer • What is a computer program?
o Input and output devices
o The System Unit basic components
o How is data represented in the storage ?
o Computer software
3
Part 1 -
Overview of
computers’
architecture
4
Types of
computers
• Specific-purpose computers
Specific-purpose computers • General-purpose computers
• Servers (midrange computers)
designed for managing network
resources, hosting websites,
providing access to specific files,
etc.
• Embedded computers (Cars, ATM
machine, …), designed for very
specific purposes.
• Supercomputers: The most
powerful type of computers (e.g.,
IBM’s Blue Gene
IBM’s Blue Gene supercomputer) supercomputer
• Mainframe computers https://en.wikipedia.org/wiki/IBM_Blue_Gene
• …
5
Types of
computers
• Specific-purpose computers
Personal Computers • General-purpose computers
They are General-purpose computers.
There are 5 types:
• Desktops (Tower computer)
• Laptops
o Two-in-one laptops
o Gaming laptops
o Ultrabooks
o ...
• Tablets
• Smartphones
• Wearable computers
More affordable
Designed to be operated directly by an end user
Speed, capacity, and flexibility determine the power of personal
computers.
Knowledge of a computer’s power allows you to make good buying
decisions and to determine if your current system is adequate for 6
the target application.
STOP TO
REFLECT...
What is a
computer ?
https://www.youtube.com/watch?v=Cu3R5it 7
4cQs
General architecture of a
computer
A computer is a combination of hardware and software
components
Computer hardware
• Hardware refers to the physical components of a computer,
these devices are categorized according to their functionality
on the computer.
• The common physical components of a computer system that
will be discussed are input devices (keyboard, mouse),
storage devices(hard drive), memory (RAM), processing
(CPU, GPU), output (monitor, printer) and communication
(Network Interface Card, modems).
Computer software
• There are two categories of Software:
Application software (Apps): User-centered
System software: System-centered.
They refer to the programs used to direct the operation of a
computer and execution of apps.
E.g: Operating systems, utilities (antivirus, troubleshooting 8
programs…), device drivers, language translantors, etc.
General architecture of a
called IPOS (Input, Processing, Output and Storage) computer
• Basically, all computers function according to the information processing cycle
• The computer receives input processes the input as per user instructions
(software) and provides output and can be stored in a desired format.
• Computer input is a raw data and the output obtained after processing it, is called
information.
• Computers also have communication devices, such as modems or NIC, to connect
to the network in a wired or wireless manner
9
Inside the System Unit
Microprocessor
• Central Processing Unit (CPU) or microprocessor
is the brain of the computer.
• CPU Chip capacities are expressed in term of
word size and Clock Speed
• Explore more !
Multicore processing
Parallel processing
Specialized Coprocessors; example GPU
10
Inside the System Unit
Memory is NOT storage
# Memory
Stored program concept
a computer’s ability to store program
instructions in main memory for execution
Memory cell
an individual storage location in memory
Address of a memory cell
the relative position of a memory cell in
the computer’s main memory
Contents of a memory cell
the information stored in a memory cell,
either a program instruction or data
11
STOP TO
REFLECT..
.
HOW IS DATA REPRESENTED?
https://www.youtube.com/watch?v=USCBCmwMCDA
12
Any
Lorem ipsum dolor sit amet, consectetur
adipiscing elit. Questions ??
13
Part 2 -
Overview of
computer
programming
14
Week 2 | CSC 1401 Computer programming
Objectives
• To learn how to solve a programming problem in a careful, disciplined way
• To learn the difference between machine language, assembly language, and
higher-level languages
• To understand what processes are required to run a C program
15
Week 2 | CSC 1401 Computer programming
Part 2: Overview of computer programming
• Problem-solving processes
• What is an algorithm?
• Flowcharts
• Computer programming
o What is a computer program?
o Classification of computer languages
16
What is Computer Programming?
Computer programming is the process
of designing and writing computer
programs to solve real-life problems
What are some examples of
real-life problems?
17
Examples of Real-life Problems
• Find relevant documents among billions of
available resources
• Find a suitable flight, with complex criteria
(dept/dest, time, connections, price, etc.) for the
next trip and book one
• Have a live audiovisual conversation with a friend
who lives in a different part of the planet
• Check the weather condition for the upcoming 10
days
• Allow a doctor to perform a surgery on a patient 18
What is Computer Programming?
Computer programming is the
process of designing and writing
computer programs to solve real-life
problems.
Real-life problems usually exhibit
constraints.
What are constraints?
What are examples of
19
Examples of Real-life Problems
→ Constraints
• Find relevant documents among billions of available
resources
• Find a suitable flight, with complex criteria
(dept/dest, time, connections, price, etc.) for the
next trip and book one
• Have a live audiovisual conversation with a friend
who lives in a different part of the planet
• Check the weather condition for the upcoming 10
days
• Allow a doctor to perform a surgery on a patient
even though the doctor and the patient are not 20
What people are looking for
• Accuracy
• Convenience/minimum effort
• Speed
• Instantaneous and remote access
• Cost-effectiveness
21
Constraints
• Huge amounts of data
• Complex and tedious operations
• Distance/Latency
22
How to solve a
problem??
… Problem-solving
processes
23
Problem-solving
processes
How to solve a problem in real
life? Define
○ What problem are you trying to solve?
○ What are your constraints?
○ What does success look like? (success criteria)
Prepare
○ Brainstorm / research possible solutions
○ Compare pros and cons
○ Make a plan
Try
○ Put your plan into action
Reflect / Adjust
○ How do your results compare to the goals you set
while defining the problem?
○ What can you learn from this or do better next time?
○ What new problems have you discovered?
24
Problem-solving
processes
Solving problem in Computer
Science is a problem-solving activity. To solve a problem using a
Programming
computer, you need to:
• Define – Problem Analysis: Think carefully about the problem.
- Analyze the problem
- Define problem specifications: Specify the problem requirements
and constraints
!! Ask Questions, and look for clarifications
• Prepare – Algorithm Design: Brainstorm a possible solution and Plan it
out beforehand (write an algorithm)
• Try :
1. Check the algorithm over to see that it addresses the problem and modify the
solution if necessary!!
2. Write the program: Implement the algorithm in a programming language (e.g., 25
Python, C)
Specifications include, but are not limited to the
following:
- Does the problem require interaction with the user?
- Does the problem manipulate data?
What is the input data & how it is represented?
- Does the problem produce output?
How the results should be generated and formatted?
=> The user might want the solution as an integer, or with a floating
point, etc…
- Are there any constraints on the required solution?
- What are the required formula for solution? Develop the 26
Prepare - Algorithm Design
• Design an algorithm for the problem.
• If the problem is divided into smaller sub-problems,
then design an algorithm for each sub-problem.
• The algorithm would consist of at least the following
tasks (IPO Structure):
1- Input (Read the data)
2- Processing (Perform the computation)
3- Output (Display the results)
27
Try - Part 1: Algorithm Testing
– Desk Check your algorithm: You need to check the
algorithm for correctness
– Use sample data for algorithm testing
Part 2: Program design
– Write the program: Implement the algorithm in a
programming language. This is achieved by
converting every algorithm step into the
programming language
The algorithm is language independent!!!
If you spend enough time and effort on writing the
algorithm, you will save time and effort during 28
implementation.
Evaluate – Testing and Maintenance
Testing the completed program to make sure it works
correctly
Should try the program with different sets of input!
Maintenance: modify the program to solve previously
undetected errors.
Update: Keep the program up to date and adapt to
new company policies (customer policies)
29
Example 1:
Determine the total cost of apples given the
number of kilos of apples purchased and the cost
per kilo of apples.
We can summarize the information contained in the
problem statement as follows:
• Problem Input:
- Quantity of apples purchased (in kilos)
- Cost per kilo of apples (in dirham per kilo)
• Problem Output:
- Total cost of apples (in dirham)
• Formula:
Total cost = Number of kilos of apples × Cost per
kilo
Example 2:
E-Book : Case study “Converting Miles
to Kilometers”. pages 56 - 59
Planning the
Solution …
Algorithms
32
What is an “Algorithm” ?
What is an algorithm?
• An algorithm is a precise, step-by-step set of instructions for solving a task.
• An algorithm does not solve a task; it gives you a series of steps that, if
executed correctly, will result in a solution to a task.
How can we represent an
algorithm?
Pseudo-code
o Pseudocode is an aid for members of the computer profession
Pseudo-code
o It has a compact and informal high-level description of a
computer program algorithm example
o Intended for human reading rather than machine reading set grade to 20
o Pseudocode typically omits details that are not essential for get grade from user
human understanding of the algorithm print result to user
etc…
Flowcharts
33
A visual
representation of
the Solution …
Flowcharts
34
Flowcharts
What is a flowchart?
• A flowchart is a collection of connected graphic symbols, where
each symbol represents a specific type of instruction to be
executed.
• The connections between symbols determine the order in which
instructions are executed.
35
Flowcharts
Components Used in Flowcharts
Denotes the beginning or the end of the program
Denotes an input and an output operation
Denotes a process to be carried out
e.g., addition, subtraction, multiplication
Denotes a decision(a branch) to be made. The program should
continue a long one of two routes(if/else)
Denotes the direction flow of the program
Repetition (Loops ) Denotes a Loop (iteration) control statement that
allows you to repeat one or more statements until some condition
becomes true
36
Flowcharts using Raptor -- Input
• An input symbol allows the user of a program to enter a data
value into a program variable.
• When defining an input, usually you prompt the user with
some message and then store the value user types in a symbol
using GET command.
• Input symbol is a parallelogram with arrow coming into it.
“Enter a number”
GET n
37
Flowcharts using Raptor - Output
• An output symbol outputs a value when it is executed.
• Output symbol is a parallelogram with arrow coming out from
it.
PUT n
38
Flowcharts using Raptor -- Assignment
• The assignment symbol is used to perform a computation
and then store the results in a variable.
• A computations is a combination of values (either constants
or variables) and operators.
• Assignments are drawn in rectangles.
• The example below illustrates the following computation:
x=2m
X 2*m
39
Flowcharts using Raptor– Assignment Operations
The following table shows some operations that are
used to construct a valid computation in an
assignment.
Operation Description
+ Addition
- Subtraction
* Multiplication
/ Division
** Exponentiation
% Remainder (eg.
7%2=1)
Sqrt() Square root (eg.
sqrt(9)=3)
40
Example 1: Let’s make a flowchart
Task: Make a flowchart that asks the user for 2
numbers and returns the sum as the output.
Start
“Enter 1st number”
GET n
“Enter 1st number”
GET m
result n
+m
“The sum is ”
PUT result
End
41
More Practice Exercises
Inputs, Outputs and Assignment
• Exercise 1: Define an algorithm and draw a
flowchart that takes user input and then just prints
it.
• Exercise 2: Define an algorithm and draw a
flowchart that displays the product of two numbers.
• Exercise 3: Define an algorithm and draw a
flowchart that calculates the volume of a room and
display the result in m3 then cm3. The user needs to
specify the value of the height, the length and the
width of the room in meters.
• Exercise 4: Define an algorithm and draw a
flowchart to calculate the = 0 roots of a quadratic
equation assuming ∆ is strictly positive. 42
More Practice Exercises
Inputs, Outputs and Assignment
Exercise 4 - Correction
Pseudo Code: Algorithm:
Input the coefficients (a, b, c) Input a, b, c
of the quadratic equation.
Calculate
(Assuming >0) Print
Calculate the solutions Print
Print
43
More Practice Exercises
Inputs, Outputs and Assignment
Exercise 4 - Correction
44
Flowcharts using Raptor -- Selections
• A selection allows you to make "decisions"
about the current state of your program's
data and then take one of two alternative
paths to a "next" statement.
• All decisions are stated as "yes/no"
questions. When a program is executed, if
the answer to a decision/condition is "yes"
(or true), then the left branch of control is
taken. If the answer is "no" (or false), then
the right branch of control is taken.
45
Flowcharts using Raptor -- Selections
• In the following example, if the user enters 1 as a value of x
variable, the flowchart will follow the “yes” branch and then
display “You win”. Otherwise, if the user enters a value that
is different to 1, the flowchart will display “You lose”.
Pseudo-code
get x
if x equals 1 then
display "you win’’
else
display ‘’you lose ’’
46
Flowcharts using Raptor -- Selections
• To use selections, we needed to do a test that either gave a
true or false. An expression that gives a result of true or
false is called a Boolean expression.
• Boolean expressions can be combined into bigger and more
complicated expressions using the logical operators and, or,
and not. Operatio Description
n
= "is equal to"
!= "is not equal to“
< "is less than"
<= "is less than or equal to"
> "is greater than"
>= "is greater than or equal
to"
and Yes(true) if both are Yes
or Yes(true) if either are Yes
47
Example 3 -- Selections
Modify the previous algorithm and draw a
flowchart to calculate the roots of a quadratic
equation considering all cases of .
=0
Pseudo Code: Algorithm:
Input the coefficients (a, b, c) of the Input a, b, c
quadratic equation .
Calculate If >0, then
If >0, Calculate the solutions &
then Print Print & Print
If 0, Calculate the solution & then If 0, then
Print
If 0, Print “No real sol” Print
If 0, then print “No real solution”
48
More Practice Exercises
Selections
• Exercise 1: Define an algorithm and draw a flowchart
that takes user input and then checks if it is odd or
even.
• Exercise 2: Define an algorithm and draw a flowchart
that displays the min and max of three positive inputs
given by the user.
• Exercise 3: Define an algorithm and draw a flowchart
that checks if a student is eligible to apply for an
exchange program. The decision is based on student’
total number of credits. A student is eligible if his/her
number of credits is strictly greater than 35.
• Exercise 4: Define an algorithm and draw a flowchart
that calculates the square of only positive number 49
given by the user.
More Practice Exercises
Selections
• Exercise 5: Let’s make a guessing game. The
number to be guessed is 7.
Requirements:
• ask the user to guess 3 numbers one after the
other.
• check if any of the numbers is 7.
• if one or more of the numbers is 7, give the
message to the user that they won.
• if none of the guesses is 7, tell the user they lost.
50
More Practice Exercises
Selections
• Exercise 6: Let’s make the same guessing game in
exercise 5 more interactive with some modification, as
explained below.
Requirements:
• ask the user to guess a number.
• if the number is 7, tell the user they won.
• otherwise ask them to guess a number again.
• if the number is 7, tell the user they won, otherwise they
get asked to ask a number again.
• if they guess 7, tell them they won, otherwise tell them “You
had 3 guesses and you didn’t get the correct number.”
51
Flowcharts using Raptor -- Loops
• A loop symbol allows you to make a set of
statements in your flow chart execute again and
again for a fixed number of times, or as long as some
condition is true.
• For example, if we want to print something 5 times,
we can do that using a loop.
• Another example: if we want to keep saying to a
user that your number is not correct as long as he
doesn’t enter “3”, then we can do that using a loop.
52
Practice Exercises
Loops
• Example 1: Draw a flowchart that displays "Hello
World" 3 times.
• Example 2: Draw a flowchart that computes the
average of 5 long assignment scores.
• Example 3: Draw a flowchart that classifies 10
students into "President’s List“ (GPA >= 3.9),
"Dean List" (3.9> GPA >= 3.8), or "Others" (GPA <
3.8).
• Example 4: Draw a flowchart that computes the
following: 53
Try your Solution …
Computer
programming
54
Computer programming
What is a computer program?
• When an algorithm is coded using any programming language, then it
is called a program.
• The program is a set of instructions that can be executed by the
computer.
55
What is Computer Programming?
Computer programming is the process
of designing and writing computer
programs to solve real-life problems
56
Our Focus
• We are not here to build computers!
• We are not here to understand the internals of
computers
• We are here to leverage the full power of
computers, by designing and writing programs
that run in these computers
57
Computer programming
Classification of computer languages – High-level
vs Low-level languages
• High-level languages
o Combine algebraic
expressions and
symbols from the
English language
o Programs do not depend
on the type of processor
that runs them
One inconvenient: must
go through a translator
58
Computer programming
Classification of computer languages – Compiled
vs Interpreted
Compiled
Programming
Language
Example: C
Interpreted
Programming
Language
Example: Python
59
Partial History of Programming Languages
1957 – Fortran 1972/4/8 – SQL 1993 – Lua 2002 – Scratch
1958 – Algol 1973 -- ML 1994 – R 2003 – Groovy
1958 – Lisp 1975 – Scheme 1994 – CLOS 2003 – Scala
1957/9 – Cobol 1983 – ADA 1995 – Ruby
2005 – F#
1964 – Basic 1983 – C++, 1995 – Ada 95
1995 – Java
2009 – Go
1969 – B Objective C
1970 – Pascal 1984 – MATLAB 1995 – Delphi 2010 – Rust
1970 – Forth 1987 Perl (Object Pascal) 2011 – Dart
1972 – C 1990 Haskell 1995 – JavaScript 2011 – Kotlin
1972 – Smalltalk 1991 – Python 1995 – PHP 2012 – TypeScript
1972 – Prolog 1991 – Visual Basic 2001 – C# 2014 – Swift
2015 – Rust
2021 – Microsoft
List of Programming Languages, History of Programming Languages
Power Fx
Timeline of Programming Languages 1849 – 2022,
The History of Programming Languages in 5 Minutes (video),
The Evolution of The Most Popular Programming Languages 1965 – 2023
60
(video)
EXERCISE - Individual (at home)
• Read one of the articles linked in the previous page and watch
one of the videos
• What strikes you most about the history of programming
languages?
• Submit this in Canvas (2 pages max)
61
Some Breakthroughs in Computing ( see Links)
• 1969: Apollo Guidance Computer for the
Apollo 11 - The first Moon landing missio
n
• 1996: IBM Deep Blue (a chess-playing co
mputer) won against Kasparov (the reigni
ng world champion)
• 2011 IBM Watson wins at Jeopardy!
• 2019: Towards quantum supremacy
• 2022: ChatGPT and large language
models (LLMs) 62
Pervasive Computing Today
• Pervasive computing (ubiquitous computing): integration of
computing into everyday objects and environments.
• Key idea: technology becomes seamless, context-aware, and
often invisible, supporting users with minimal interaction.
• Examples
o Smart homes where lights, heating, and security adjust
automatically.
o Wearable health monitors that track vital signs and send alerts.
o Cars that connect to traffic systems to optimize routes.
o Retail environments with smart sensors and personalized
recommendations
63
Pervasive Computing Today
• In short: Pervasive computing means computing is
everywhere, always available, and embedded into the
environment so naturally that it becomes part of daily
life.
• Explore these:
● Smart homes
● Smart cities
● Smart/self-driving vehicles
● Augmented reality
64
The People in
computing
Computer Scientists who
Made History
65
Computer Scientists who Made History
Andrew Ng Daphne Koller Stuart Geoffrey
(1976-…) (1968…) Russell(1962- Hinton
…) (1947-…) 66
Computer Scientists who Made History
Bill Gates Steve Jobs Steve Tim Berners-
(1955-…) (1955-2011) Wozniack Lee
(1950-…) (1955-…)
67
Computer Scientists who Made History
Dennis Ritchie Brian James Gosling Linus Torvalds
(1941-2011) Kernighan (1955-…) (1969-…)
(1942-…)
68
Computer Scientists who Made History
Alan Turing John von John McCarthy Donald Knuth
(1912-1954) Neumann (1927-2011) (1938-…)
(1903-1957)
And let’s not forget …
محمد بن موسى Ada Lovelace Kathleen Grace Murray
(née Byron) Booth Hopper
الخوارزمي
(1815-1852) (1922'2022) (1906-1992)
70
c. 780 – c. 850
EXERCISE – Individual Work (at home)
• Select 3 people from the several above
• Write 1 thing they for which they are known
• Submit to Canvas (1 page max)
71
Any
Lorem ipsum dolor sit amet, consectetur
adipiscing elit. Questions ??
72