0% found this document useful (0 votes)
39 views16 pages

TLE 10 Reviewers

The document provides an overview of the history and evolution of computer programming, highlighting key figures such as Jacques Vaucanson, Charles Babbage, and Ada Lovelace, along with their contributions to early computing devices and programming languages. It discusses fundamental concepts like algorithms, programming languages, binary systems, and flowcharts, as well as examples of programming problems and pseudocode. Additionally, it outlines the characteristics of algorithms and the basic structures of programming logic.

Uploaded by

justmisha134
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views16 pages

TLE 10 Reviewers

The document provides an overview of the history and evolution of computer programming, highlighting key figures such as Jacques Vaucanson, Charles Babbage, and Ada Lovelace, along with their contributions to early computing devices and programming languages. It discusses fundamental concepts like algorithms, programming languages, binary systems, and flowcharts, as well as examples of programming problems and pseudocode. Additionally, it outlines the characteristics of algorithms and the basic structures of programming logic.

Uploaded by

justmisha134
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

1ST QUARTER – TLE 10 • Jacques Vaucanson

RIZAL NATIONAL SCIENCE HIGH SCHOOL 2023-2024 (1740)


• Bouchon’s invention did not
HISTORY OF COMPUTER PROGRAMMING have much success because the
number of needles was not
Programming Language sufficient to allow the weaving
• Language for describing of large designs and he used a
instructions that a computer roll of paper which was not very
can follow to solve a problem practical
• Has a grammar (or syntax) that • The looms of Bouchon and
programmers learn Falcon eliminated mistakes in
• Computers cannot understand the lifting of threads but still
a program if the syntax is even needed and extra operator or
slightly incorrect and will even two of them to operate
complain with a ‘syntax error’ • The loom of Bouchon and
Central Processing Unit (CPU) Falcon was modestly successful:
• Can only perform simple about 40 such looms had been
instructions can do them very sold by 1762
fast • The first first attempt at full
• Can add two whole numbers automation was made by
together billions of times per Jacques Vaucanson in 1745, not
second but cannot recognize a very successful
handwritten digit • Until 1805 that the widely
• To recognize handwriting, Jacquard loom was finally
programmers must break the produced
task down into many simple Charles Babbage
instructions for the computer to (December 26, 1791 - October 18, 1871)
follow. • Mathematician, philosopher,
Joseph Marie Charles inventor, and mechanical
(July 7, 1752 - August 7, 1834) engineer
• French weaver and merchant • “The Father of Computer”
• Invented the Jacquard Loom • Inventor of Difference Engine
The Jacquard Loom No.1 and Analytical Engine
• Mechanical loom that uses Difference Engine No.1
pasteboard cards with punched • Charles Babbage’s first machine
holes and each card • An early calculating machine
corresponding to one row of the verging on being the first
design computer, designed and
• Multiple rows of holes are partially built during the 1820s
punched in the cards and the and ‘30s
many cards that compose the • Designed to automatically
design of the textile are strung calculate and tabulate
together in order mathematical functions called
• Based on earlier inventions by polynomials which have
the Frenchmen: powerful general applications in
• Basile Bouchon (1725) mathematics and engineering
• Jean-Baptiste Falcon • Babbage worked closely with
(1728) Joseph Clement, a master
toolmaker and draftsman who • An American businessman,
was tasked with making the inventor, and statistician
parts • Inventor of the tabulating
• The Difference Engine No.1 had machine
25,000 parts and weighed four • His invention of the punched
tons card tabulating machine,
Analytical Engine patented in 1884, marks the
• Considered the first computer beginning of the era of semi
• Designed and partly built by automatic data processing
Babbage in the 19th Century (he systems, and his concept
worked on it until his death in dominated that landscape for
1871 nearly a century
• The only parts that were Tabulating Machine
assembled were in 1833 as a • Electromechanical machine
demonstration piece for the designed to assist in
Government and can be seen summarizing information stored
now in the Science Museum in on punched cards
London • Was developed to help process
Joseph Clement data for the 1890 U.S. Census
(June 13, 1779 - February 28, 1844) • Later models were widely used
• First Computer Engineer for business applications
• A British engineer and (accounting, inventory control)
industrialists, chiefly • Spawned a class of machines,
remembered as the maker of known as unit record
Charles Babbage’s first equipment, and the data
Difference Engine between 1824 processing industry.
and 1833 Alan Mathison Turing
Augusta Ada King, Countess of (June 23, 1912 - June 7, 1954)
Lovelace Byron • English mathematician,
(December 10, 1815 - November 27, computer scientist
1852) • Father of Theoretical Computer
• First Computer Programmer Science and Artificial
• English mathematician and Intelligence
writer • Provided a formalisation of the
• 1843: Ada Lovelace became the concepts of algorithm and
first person to publish a computation
computer program, a set of Turing Machine
instructions to calculate • Model of a general-purpose
Bernoulli’s Numbers, written for computer
Charles Babbage’s unbuilt • Mathematical model of
Analytical Engine computation that defines an
• Published a sequence of steps abstract machines which
to perform using a computing manipulates symbols on a strip
machine designed by her friend, of tape according to a table of
Charles Babbage rules
Herman Hollerith • Capable of stimulating the
(February 29, 1860 - November 17, algorithm’s logic can be
1929) constructed
John Warner Backus • Set of instructions/rules to be
(December 3, 1924 - March 17, 2007) followed by a computer
• Directed the team that invented program
an implement FORTRAN, the • Contains an Input, process, and
first widely used High-Level output depending on the
Programming Language problem solved
Examples of Programming IPO Model
Language: • Input→Process→Output
1. C# Variables
2. C++ • Math: letter that can represent
3. Php any number
4. Java • Programming: letter/word that
5. JavaScript serve as a temporary storage
6. Swift that can represent any value
7. Python
CHARACTERISTICS OF ALGORITHM
BINARY

Binary 1. Input
• A base -2 number system • zero(0) to more
invented by Gottfried Leibniz 2. Output
• Made up of only 0 and 1 • At least one (1)
• Basis for all binary code, which is 3. Definiteness
used to write data such as the • Instructions must be clear and
computer processor instructions realistic
used every day 4. Finiteness
Gottfried Leibniz • Must terminate and should have
(July 1, 1646 - November 14, 1716) a stopping point
• German mathematician and 5. Effectiveness
philosopher • Instructions must be efficient
• Most prolific inventor in the field and useful
of mechanical calculator GENERAL FORMAT:
• Invented and refined the binary 1. Declare a variable (content and
number system, which is at the amount depends on the
foundation of virtually all digital problem)
computers 2. Let the user input (content
depends on the problem)
UNDERSTANDING ALGORITHM 3. Perform (process depends on
the problem)
Algorithm 4. Perform (process depends on
• Step-by-step procedure in
the problem)
solving a problem 5. Display (content depends on
• Finite set of instructions that
the problem)
specify a sequence of
Note: 1, 2 and 5 are always constant, 1
instructions
is always to declare a variable and 2
Programming Algorithm
is always letting the user input
something and 5 is for displaying the 3. If num1 is greater than num 2,
output. display “greater is”, num 1
Note: Number of steps for a problem 4. If num2 is greater than num1,
depends on the problem display “greater is”, num2
Problem 5: Create a program that
REMEMBER: the last step of the will display the Gender depending on
process is always “End Program” the inputted variable of the user.
Display Male or Female. If not display
ALGORITHM EXAMPLES: Qplus
1. Declare a variable for Gender
Problem 1: Creates a program that 2. Let the user input the Gender
will display the sum of 2 numbers 3. If the gender is Male, display
1. Declare 3 variables, 2 for the “Male”
addends, and 1 for the sum 4. If the gender is Female, display
(input) “Female”
2. Let the user input the addends 5. If the Gender is not Male or
(process) Female, display “Qplus”
3. Perform the addition between
the addends and assign it the
sum (process) Problem 6: Create a program that
4. Display the Sum will display Free or Not Free to enter
Problem 2: Create a program that the resort if free is 3ft and below
will display the average of 2 numbers 1. Declare a variable for height
1. Declare 4 variable, 2 for the 2. Let the user input the height
addends, 1 for the sum, and 1 for 3. If the height is 3ft and below,
the average display “Free”
2. Let the user input the addends 4. If the height is above 3ft, display
3. Perform the addition between “Not Free”
the addends and assign it to the
sum UNDERSTANDING PSEUDOCODE
4. Divide the sum by 2
5. Display the average Pseudocode
Problem 3: Create a program that • Method that allows a
will display Even or Odd depending programmer to represent
on the number inputted by the user algorithm in a more
1. Declare a variable programming related way
2. Let the user input the number • It’s called “false codes” because
3. If the number is even, display it tends to look like a
“Even” programming language but can
4. If the number is odd, display be understand by someone who
“Odd” has little knowledge about
Problem 4: Create a program that programming
will display the greater between 2 How to Write Pseudocode
numbers 1. Capitalize key commands (IF
1. Declare 2 variables. Let variables number is >10 THEN)
be num1 and num2 2. Write one statement per line
2. Let the user input the number 3. Use indentation
4. Be Specific
5. Keep it Simple Display Male if the number entered is
Do’s and Dont’s 1 and Female if 2. If not 1 or 2 display
• Do Qplus
1. Proper naming 1. Let num=0
convention 2. Input num
2. Keep it simple and 3. IF num=1 THEN
concise Output “Male”
• Dont 4. IF num=2 THEN
1. Don’t make it abstract Output “Female”
2. Don’t generalize it 5. IF num!=1 or 2 THEN
PSEUDOCODES EXAMPLE: Output “Qplus”
Problem 6: Create a program that
Problem 1: Create a program that will will display Free or Not Free to enter
display the sum of 2 numbers the resort, if free is 3ft and below
1. Let numOne=0, numTwo=0, and 1. Let height=0
sum=0 2. Input height
2. Input numOne and numTwo 3. IF height <3ft THEN
3. Sum = numOne + numTwo Output “Free”
4. Output sum 4. IF height >3ft THEN
Problem 2: Create a program that Output “Not Free”
will display the average of 2 numbers
1. Let numOne=0, numTwo=0, UNDERSTANDING FLOWCHART
sum=0, and ave=0
2. Input numOne and numTwo Flowchart
3. Sum= numOne + numTwo • Graphical representation of a
4. Ave = sum/2 sequence of operation
5. Output ave • Contains symbols describing
Problem 3: Create a program that how an algorithm or program
will display Even or Odd depending operates
on the number inputted by the user Flow Lines
1. Let num=0 • Indicated by straight lines with
2. Input num arrows to show the direction of
3. IF num is even THEN data flow
Output “Even” • Used to connect by exiting from
4. IF num is odd THEN one and entering another
Output “Odd”
Problem 4: Create a program that
will display the greater between two
numbers
1. Let num1 and num2 =0 •
Terminal block
2. Input num1 and num2
• Ovals or rounded rectangles are
3. IF num1>num2 THEN
used to indicate the start and
Output “greater is”, num1
end of a program
4. IF num2>num1 THEN
Output “greater is”, num2
Problem 5: Create a program that
will display the gender depending on
the inputter variable of the user.

Decision Block
Initialization block • Diamond indicates a decision
• Used for declaring/initializing • It has one exit and exactly two
variables needed to solve a exits from the block
certain process • One exit is the action when the
• Declaration: stating a resultant is TRUE and the other
variable name to be used; exit is the action when resultant
names only is FALSE


• Initialization: to set (a
starting variable); name •
with value Connectors
• Circle is used as a connection
point between two sections of a
flowchart that are not adjacent
or closely located to each other
• Should be used as little as
• possible
Process Block • Should be used to enhance as
• Rectangle indicates a reading
processing block for such things • Used if flowchart is too long
such as calculate, opening, and
closing files



Input/Output Block
• The parallelogram indicates the
input and output operator
conditions is satisfied

3 BASIC FLOWCHART STRUCTURES

Structure
• Basic unit of programming logic
1. Sequence Structure • Do-while Loop
• Performs action in order
• The action/statement is
• No branching or skipping
executed first before
any task asking the condition
2. Selection Structure (decision • Ito yung wala ka pang
structure)
ginagawa mali ka na
• Ask a question, take one
of two actions
• Dual-alternative ifs or
single-alternative ifs
• Single Alternative Selection
Structure
o Even if two responses can
be given only one
response is taken/needed
o
EXAMPLE OF WHILE AND DO-WHILE
• Dual Alternative Selection
Structure
o Performs two different
things when the
condition is true or false

• Multiple Decision (Multiple


Alternative Selection
Structure)

3. Loop/Repetition Structure
• Perform a specific
action/statement a
number of times until a
condition is satisfied
• While Loop
• Statement or block of
statement that is
repeated as long as some

• For Loop
• Executes an
action/statement
repeatedly
• Applications: reading • Unary Plus: represented
through a list of data using symbol +, which
items or initializing an does not change to the
array operant values and
always represents the
operands’ values (Syntax)
• Unary Minus:
represented by using the
symbol -, changes the
sign of its argument
(negative to positive,
positive to negative)
TYPE OF UNARY OPERATORS
1. Unary Minus ( - )
TERMS CONCERNING FOR LOOP 2. Increment ( ++)
3. Decement ( -- )
4. NOT ( ! )
1. Iteration 5. Address of Operator ( & )
• Repeated execution of
6. Size of ()
some groups of code FOR LOOP METHOD A1 (COUNT --)
statements in a program
2. Initialization
• Declare any variables
used to initiate the
procedure
3. Condition
• Is in the middle, it’s here
that you’ll need to specify
the variable’s condition
• Block of code will get
executed if specified
condition is ‘true’, loop is FOR LOOP METHOD A2 (COUNT --)
skipped if ‘false’
4. Increment/Decrement
• The loop’s body is
executed
• Variable is either
increased or
decremented
5. Arithmetic Operators
• Following arithmetic
operators are supported
by C++ language
6. Unary Operators
• Operators that perform
operations on a single
operand to produce a
new value
FOR LOOP METHOD A3 (COUNT --) • Computer cannot understand
direct source code, computer
understands machine code and
executes it
• Considered as fundamental
component of computer
• A set of instructions/commands
and statements which is written
by a programmer by using a
computer programming
language like C, C++, Java,
FOR LOOP METHOD B (COUNT - Python, Assembly language
-) • Statements written in any
programming language is
termed as source code
• High level code or assembly
code that is generated by a
human/programmer
• Easy to read and modify
• Written by a programmer using
any high level language or
intermediate language which is
human-readable
• Contains comments that
programmer place for better
understanding
2ND QUARTER – TLE 10 Object Code
RIZAL NATIONAL SCIENCE HIGH SCHOOL 2023-2024 • Refers to low level code which is
understandable by machine
UNDERSTANDING HOW COMPILER • Generated from source code
WORKS after going through compiler or
other translator
Compiler • It is in executable machine code
• A software that converts the format
source code to the object code • Contains a sequence of machine
• It converts high-level language understandable instructions to
to machine/binary language which Central Processing Unit
• Necessary to perform this step understands and executes
to make the program • We can understand source
executable (computer code but we can not
understands only binary understand object code as it is
language) not in plain text like source code
Source Code rather it is in binary formats
• Provided to language translator Compilation
which converts it into machine • Process of converting the
understandable code which is source code into machine code
called machine code or object • It is done with the help of the
code compiler
• Checks the source code for the • Used to enclose a string of
syntactical or structural errors, character as message to be
and if the source code is error- printed to the screen
free, then it generates the
object code
• Some compiler convert the STRING VARIABLES
high-level language to an
assembly language as an Variables
intermediate step • Used to store up some kind of
• Some others convert it directly data for later use
to machine code • A value that can change
• Examples: depending on conditions or on
• Online C Compilers information passed to the
• OnlineGDB C Compiler program
• Replit • Programming: a letter/word
• Rextester that serves as a temporary
• myCompiler storage that can represent any
• OneCompiler value
• CodeChef Data Type
cout ( Character Output) • A classification that specifies
which type of value a variable
has and what type of
• “c” in cout refers to “character” mathematical, relational, or
• “out” in cout refers to “output” logical operations can be
• Used along with the insertion applied to it without causing an
operator (<<) in order to display error
a stream of characters The Data Types
1. String
C++ manipulator endl function • Sentences or phrases
• used to insert a new line • Alphanumeric characters
character and flush the stream • Used for data values that
• Prints the output of the are made up of ordered
following statement in the next sequence of characters
line such as “hello world”
C++ stream insertion operator ‘<<’ • Can contain any
• Used for output sequence of characters
• Include “” visible or invisible and
Semicolon characters may be
• Lets the compiler know that it’s repeated
reached the end of a command • The number of characters
Pair Opening/Closing in the string is called
Single Quotation marks ( ‘’ ) length
• Used to enclose a single • Comprised of a set of
character characters that can also
• E.g: ‘A’ contain spaces and
Pair Opening/Closing numbers
Double Quotation marks ( “” ) 2. Char
• Short for character
• Holds one character • General Syntax: cin>>varName:
(letter, number etc) of Syntax
data • A computer programming as
• Could be any one- the concept of giving specific
character value such as word sets in specific orders to
‘A’, ‘4, or ‘#’ computer so that they do what
3. Boolean we want them to do
• In computer science, it is • Every programming language
a data type with two uses different word sets in
possible values: true or different orders, which means
false that each programming
• Named after the English language uses its own syntax
mathematician and • In programming, syntax refers
logician George Boole to the rules that specify the
whose algebraic and correct combined sequence of
logical systems are used symbols that can be used to
in all modern digital form a correctly structured
computers program using a given
4. Integer programming language
• A whole number (not a Getline ()
fraction) that can be • In-built function defined in the
positive, negative, or zero <string. h> header file that
• The numbers 10, 0, -25, allows accepting and reading
and 5148 are all integers single and multiple line strings
• Cannot have decimal from the input stream
places
5. Float (Floating point numbers) ARRAY SYNTAX
• Less precise decimals
• Numbers that contain Array
floating decimal points • C++ provided data structure
• Can have 6-7 significant • Stores a fixed-size sequential
digits collection of elements of the
6. Double same type
• More precise decimals • Is used to store a collection of
• Can have 15-16 significant data
digits • A collection of variables of the
same type
C++ PROGRAMS • Consists of contiguous memory
locations
cin (Character Input) • The lowest address corresponds
• Used to accept the input from to the first element and the
the standard input device i.e. highest address to the last
keyboard elements
• “c” in cin refers to “character” Element
• “in” in cin refers to “inputs” • Collection of data in an array
• Used along with the extraction Index
operator (>>) in order to receive • Place value of the element
a stream of characters
FUNCTIONS • The return type is the keyword
void
Void Functions
• Also called non value-returning
functions
• Used just like value-returning
functions except void return
types do not return a value
when the function is executed
• Accomplishes its task and then
returns control to the caller
• Void function call is a stand-
alone statement
• For example, a function that
prints a message doesn’t return
a value. The code in C++ takes
IF ELSE STATEMENTS
the form:
Boolean
• Named after English
Mathematician and Logician
George Boole
• Representing logical values
• Can only be answered by true or
false
If Else Conditional Statement
Function • If the expression or condition is
• A block of organized, reusable
evaluated and if the condition is
code that is used to perform a
True. The statement(s) is/are
single, related action
executed
Return Type • In case the condition is False,
• A function may return a value
the statement(s) is/are not
• Data type of the value the
executed
function returns
• Some functions perform the
desired operations without
returning a value
COMPARISON OPERATORS 5. Returns true is lhs is equal to

Comparison Operators rhs, false otherwise


1. < (Less than)
2. > (Greater than)
3. <= (Less than or Equal to)
4. >= (Greater than or Equal to) 6. Returns true if lhs is not equal to
5. == (Equal to)
6. != (Not Equal to) rhs, false otherwise
Two Way Comparison
• The two-way comparison
operator expressions have the
form:
• LHS - left hand side
• RHS - right hand side
1. Returns true if lhs is less than
rhs, false otherwise

2. Returns true if lhs is greater


than rhs, false otherwise

3. Returns true if lhs is less than or


equal to rhs, false otherwise

4. Returns true if lhs is greater


than or equal to rhs, false otherwise
• Are like Arrays but each element
contains another Array

2D ARRAY
Array
• C++ provides a data structure
• The array stores a fixed-size
sequential collection of
elements of the same type
• Used to store a collection of data
Two Dimensional Array
• Consists of more than one rows
and more than one column
• Each element is refer by two
indexes
• Elements stored in these Arrays
in the form of matrices
• The first index shows a row of
the matrix and the second index
shows the column of the matrix
be true

LOGICAL OPERATORS
&& (AND)
• In order for this to be true both
conditions needs to be true

SWITCH STATEMENTS
Switch Statement
• Allows us to execute a block of
code among many alternatives
• Are like if-else statements
• Consists of cases
• Can only take an integer and
character data type to compare
How does the switch statement
work?
• The expression is evaluated
once and compared with the
values of each case label
• If there is a match, the
corresponding code after the
matching label is executed
• Example: if the value of the
|| (OR)
variable is equal to constant2,
• In order for this to be true either
the code after case constant2: is
one of the conditions needs to
executed until the break
statement is encountered. If
there is no match, the code after
default: is executed
• Note: we can do the same thing
with the if… else… if ladder.
However, the syntax of the
switch statement is cleaner and
much easier to read and write

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy