CSC 101-CSC 111 - Introduction To Computer Science - Lecture 4
CSC 101-CSC 111 - Introduction To Computer Science - Lecture 4
ASSISTANT LECTURER,
DEPARTMENT OF COMPUTER SCIENCE AND MATHEMATICS
MOUNTAIN TOP UNIVERSITY, OGUN STATE, NIGERIA
▪ Definition of Computer
▪ History and Overview of Computing and Computers
▪ Evolution of Ideas and Machines from Mechanical Computer to Multimedia Computer
▪ Introduction to computing system
▪ Basic elements of a computer system hardware
▪ Block diagram, data/instruction flow, control flow
▪ File management in Windows and basic word processors, spreadsheets, presentation, graphics
and other applications
▪ Introduction to programming:
▪ Statements, symbolic names, arrays, expressions and control statements
2
3
▪ Problem Solving is the sequential process of analysing information related to a
given solution and generating appropriate response options.
▪ There are six (6) steps that should be followed in problem solving:
▪ Understand the problem
▪ Formulate the model
▪ Develop an algorithm
▪ Write a program
▪ Test the program
▪ Evaluate the solution
4
▪ Understanding the Problem
▪ The first step to solving any problem is to make sure that you
understand the problem that you are trying to solve.
▪ Many problems break down into smaller problems that require some kind of
simple mathematical computations in order to process the data.
▪ Often, however, the problem breaks down into simple computations that we well
understand.
▪ Condition – making decision and doing one thing or something else depending on the
outcome of the decision
10
▪ Repetition – repeating something a fixed number of times or until some conditions
occurs
▪ Storage – storing information for use in instructions further down the list
11
▪ Write the Program
▪ Writing a program is often called writing code or implementing an algorithm.
▪ The code (or source code) is actually the program itself.
▪ In the figure below, the code looks quite similar in structure to the pseudocode,
however, the processing code is less readable and seems somewhat more
mathematical.
▪ It is also possible that when you examine your results, you realize that you need
additional data to fully solve the problem.
▪ Or, perhaps you need to adjust the results to solve the problem more efficiently.
▪ It is important to remember that the computer will only do what you told it to do.
▪ It is up to you to interpret the results in a meaningful way and determine whether or not it solves
the original problem.
▪ It may be necessary to re-do some of the steps again, perhaps going as far back as step 1 again,
if data was missing 14
15
▪ Data representation is a major part of the software-hardware interface.
▪ The Bit is short for Binary digit – the smallest amount of meaningful information
stored on a computer.
▪ The advantage includes:
▪ Too little information per bit (each bit stores 2 possible states)
▪ In order to store more information, one needs more bits.
▪ Decimal Representations
▪ If a number is in base 10, then the number 56432 can be represented as:
(5× 104 ) + (6 × 103 ) + (4 × 102 ) + (3 × 101 )+(2 × 100 )
▪ Binary Representations
▪ If a number is in base 2, then the number 101012 can be represented as:
(1× 24 ) + (0 × 23 ) + (1 × 22 ) + (0 × 22 )+(1 × 20 )
17
▪ The general idea behind positional numbering systems is that a numeric value is
represented through increasing powers of a radix (or base number).
18
▪ Convert 10410 to base 3 using ▪ Convert 14710 to base 2 using
the division-remainder method the division-remainder method
▪ 10410 = 102123
▪ 14710 = 100100112
19
▪ Other bases can be converted to base 10 using the standard polynomial
expressions shown earlier.
▪ For example,
▪ Consider, a set of digits 𝑎𝑖 occurring after the decimal point of a fraction expressed
in a given base, b; the fraction can be converted to decimal fraction according to:
(𝑎1 × 𝑏 −1 ) + (𝑎2 × 𝑏 −2 ) + ⋯ + (𝑎𝑛−1 × 𝑏 −(𝑛−1) )+(𝑎𝑛 × 𝑏 −𝑛 )
▪ Where n is the number of digits on the right hand side of the decimal point
▪ For example,
▪ 𝟎. 𝟏𝟏𝟎𝟏𝟐 = (1× 2−1 ) + (1 × 2−2 ) + (0 × 2−3 ) +(1 × 2−1 ) = 0.5+0.25+0+0.0625
▪ For example:
▪ For example,
▪ Convert (0.513)10 to octal (base 8)
▪ 0.513 x 8 = 4.104
▪ 0.104 x 8 = 0.832
▪ 0.832 x 8 = 6.656
▪ 0.656 x 8 = 5.248
▪ 0.248 x 8 = 1.984
▪ 0.984 x 8 = 7.872
∴ (𝟎. 𝟓𝟏𝟑)𝟏𝟎 = (𝟎. 𝟒𝟎𝟔𝟓𝟏𝟕 … )𝟖
23
▪ Strings unlike numbers are sequences of characters (alphabets and special
symbols).
▪ e.g. player, #saveLara, McLaren, steven123, etc..
25
▪ Extended Binary-Coded Decimal Interchange Code (EBCIDIC)
▪ In 1964, BCD was extended to an 8-bit code, Extended Binary-Coded Decimal
▪ Interchange Code (EBCDIC).
▪ EBCDIC was one of the first widely-used computer codes that supported upper
and lowercase alphabetic characters, in addition to special characters, such as
punctuation and control characters.
▪ EBCDIC and BCD are still in use by IBM mainframes today.
26
27
28
▪ Both EBCDIC and ASCII were built around the
Latin alphabet.
▪ In 1991, a new international information exchange
code called Unicode was created.
▪ Unicode is a 16-bit alphabet that is downward
compatible with ASCII and Latin-1 character set.
▪ Because the base coding of Unicode is 16 bits, it
has the capacity to encode the majority of
characters used in every language of the world.
▪ Unicode is currently the default character set of
the Java programming language.