What is a Programming Language? 
PS — Introduction © O. Nierstrasz 
1 
• A formal language for describing computation? 
• A “user interface” to a computer? 
• Syntax + semantics? 
• Compiler, or interpreter, or translator? 
• A tool to support a programming paradigm? 
A programming language is a notational 
system for describing computation in a 
machine-readable and human-readable form. 
— Louden
2 
Figure 9.2 Categories of programming languages
Generations of Programming Languages 
1GL: machine codes 
2GL: symbolic assemblers 
3GL: (machine-independent) imperative languages (FORTRAN, 
Pascal, C ...) 
4GL: domain specific application generators 
5GL: AI languages … ( Prolog, OPS5, and Mercury are examples of 
fifth-generation languages.) 
Each generation is at a higher level of abstraction 
PS — Introduction © O. Nierstrasz 
3
CSC141 Introduction to Computer Programming 
Machine language (1GL) 
• The lowest level of language. 
• The language used to program the first-generation 
computers. 
• The instructions in 1GL are made of binary 
numbers, represented by 1s and 0s. 
• 1s and 0s correspond to the on and off states of 
electrical switches. 
• Suitable for the understanding of the machine 
but very much difficult to interpret and learn by 
the human programmer.
Machine Language(contd) 
• is not portable 
• runs only on specific type of computer 
• is made up of binary-coded instructions (strings of 0s 
and 1s) 
• is the language that can be directly used by the 
computer 
5
CSC141 Introduction to Computer Programming 
Assembly language (2GL) 
• Low-level language that allows a programmer to use 
abbreviations or easily remembered words instead of 
numbers. 
• These Observations are called Mnemonics. These 
Mnemonic are Opcode and Operands 
For Example: ADD AX, BX 
MOV CX, AX 
INC CX 
Op-code; ADD, MOV, INC 
Operands AX, BX,CX
CSC141 Introduction to Computer Programming 
Assembly language (2GL) (contd) 
• Programmer can write instructions faster but it is still not 
an easy language to learn. 
• Drawback: The language is specific to a particular 
processor family and environment. (Machine Dependent 
Language) 
• Assembler – A program that translates the assembly 
language program into machine language.
High Level languages (3GL) 
• A High-Level Language is an English-like language. 
• It is a refinement of a second-generation programming 
language. 
• It allowed users to write in familiar notation, rather 
than numbers or abbreviations. 
• Most High-level languages are not Machine Dependent. 
• Translator for High-level languages is either a Compiler 
or an Interpreter. 
• Examples of High-level languages: 
―FORTRON 
―COBOL 
―BASIC 
―C and C++ 
CSC141 Introduction to Computer Programming
High Level Languages (contd) 
• are portable 
• user writes program in language similar to natural 
language 
• examples -- FORTRAN, COBOL, Pascal, 
Ada, Modula-2, C++, Java 
• most are standardized by ISO/ANSI to provide an 
official description of the language 
9
CSC141 Introduction to Computer Programming 
Very-High-Level Languages (4GL) 
• 4GLs are much more user-oriented and allow programmers to 
develop programs with fewer commands compared with 3GLs. 
• Non-Procedural Language; Programmers don’t have to specify all 
the programming logic, only tell the computer what they want 
done. 
• Saves a lot of time. 
• 4GLs consist of report generators, query languages, application 
generators, and interactive database management system 
• For example: 
• RPG III (Report Generator) 
• SQL (Structured Query Language) 
• NOMAD and FOCUS (DBMS)
Domain specific languages(DSL) 
• Specialized to a particular application domain. 
• Contrast to a general-purpose language (GPL), which is broadly 
applicable across domains, and lacks specialized features for a 
particular domain. 
• Wide variety of DSLs, ranging from widely used languages for 
common domains. 
• Sometimes informally called mini-languages. 
• Example: HTML for web pages.
CSC141 Introduction to Computer Programming 
Natural Languages (5GL) 
• Two types 
• Ordinary Human Languages; like English. 
• Programming language that use human language to give 
people a more natural connection with computers. 
• 5GLs are designed to make the computer solve a given 
problem without the programmer. 
• Natural languages are part of the field of study known as 
Artificial Intelligence. 
• Develop machines to emulate human-like qualities such 
as learning, reasoning, communicating, seeing and 
hearing.
What is Computer Programming? 
• It is the process of planning a sequence of steps 
(called instructions) for a computer to follow. 
13 
STEP 1 
STEP 2 
STEP 3 
. . .
Problem Solving 
How do you solve problems? 
Understand the problem 
Devise a plan 
Carry out the plan 
Look back 
14
Strategies 
Ask questions! 
• What do I know about the problem? 
• What is the information that I have to process in order the find the 
solution? 
• What does the solution look like? 
• What sort of special cases exist? 
• How will I recognize that I have found 
the solution? 
15
Strategies 
Ask questions! Never reinvent the wheel! 
Similar problems come up again and again in different guises 
A good programmer recognizes a task or subtask that has been 
solved before and plugs in the solution 
Can you think of two similar problems? 
16
Strategies 
Divide and Conquer! 
Break up a large problem into smaller units and solve each smaller 
problem 
• Applies the concept of abstraction 
• The divide-and-conquer approach can be applied over and over again until 
each subtask is manageable 
17
Algorithms 
Algorithm 
A set of unambiguous instructions for solving a problem or 
subproblem in a finite amount of time using a finite amount of 
data 
Why must instructions be unambiguous? 
Why must time and data be finite? 
18
Computer Problem-Solving 19 
Analysis and Specification Phase 
Analyze 
Specification 
Algorithm Development Phase 
Develop algorithm 
Test algorithm 
Implementation Phase 
Code algorithm 
Test algorithm 
Maintenance Phase 
Use 
Maintain 
Can you 
name 
a recurring 
theme?
Phase Interactions 20 
Should we 
add another 
arrow? 
(What happens 
if the problem 
is revised?)
A Tempting Shortcut? 21 
GOAL 
THINKING 
CODE 
REVISE 
REVISE 
REVISE 
DEBUG 
DEBUG 
DEBUG 
TEST 
CODE
Developing an Algorithm 
Two methodologies used to develop computer solutions to a problem 
• Top-down design focuses on the tasks to be done 
• Object-oriented design focuses on the data involved in the solution 
But first, let's look at a way to express algorithms: pseudocode 
22
An Algorithm is . . . 
• a step-by-step procedure for solving a problem in 
a finite amount of time. 
23
Pseudocode 
Pseudocode 
A way of expressing algorithms that uses a mixture of English 
phrases and indention to make the steps in the solution explicit 
There are no grammar rules in pseudocode 
Pseudocode is not case sensitive 
24
Example of algorithm 
• In this example, we design an algorithm to find the perimeter and 
area of a rectangle. 
• To find the perimeter and area of a rectangle, you need to know 
the rectangle’s length and width. 
• The perimeter and area of the rectangle are then given by the 
following formulas: 
• perimeter = 2 * (length + width) 
• area = length * width
The algorithm to find the perimeter and area of 
the rectangle is: 
1. Get the length of the rectangle. 
2. Get the width of the rectangle. 
3. Find the perimeter using the following equation: 
perimeter = 2 * (length + width) 
4. Find the area using the following equation: 
area = length * width
Problem-Solving Phase 
• ANALYZE the problem and SPECIFY what the 
solution must do 
• develop a GENERAL SOLUTION (ALGORITHM) to 
solve the problem 
• VERIFY that your solution really solves the 
problem 
27
Implementation Phase: 
Program 
• translating your algorithm into a programming 
language is called CODING 
• with C++, you use 
Documentation -- your written comments 
Compiler -- translates your program 
into machine language 
Main Program -- may call subalgorithms 
28
Implementation Phase: Test 
• TESTING your program means running (executing) 
your program on the computer, to see if it produces 
correct results 
• if it does not, then you must find out what is wrong 
with your program or algorithm and fix it--this is called 
debugging 
29
Maintenance Phase 
• USE and MODIFY the program to meet changing 
requirements or correct errors that show up in 
using it 
• maintenance begins when your program is put 
into use and accounts for the majority of effort on 
most programs 
30
Some C++ History 
• 1972 : Dennis Ritchie at Bell Labs designs C and 90% of UNIX is 
then written in C 
• Late 70’s : OOP becomes popular 
• Bjarne Stroustrup at Bell Labs adds features to C to form “C 
with Classes” 
• 1983 : Name C++ first used 
• 1998 : ISO/ANSI standardization of C++ 
31
Three C++ Program Stages 
32 
myprog.cpp myprog.obj myprog.exe 
SOURCE OBJECT EXECUTABLE 
other code 
from libraries, 
etc. 
written in 
machine 
language 
written in 
machine 
language 
written in 
C++ 
via compiler via linker
Basic Control Structures 
• a sequence is a series of statements that execute 
one after another 
• selection (branch) is used to execute different 
statements depending on certain conditions 
• Looping (repetition) is used to repeat statements 
while certain conditions are met. 
• a subprogram is used to break the program into 
smaller units 
33
SEQUENCE 34 
Statement Statement Statement . . .
SELECTION (branch) 35 
IF Condition THEN Statement1 ELSE Statement2 
Statement1 
Statement 
Condition . . . 
Statement2
LOOP (repetition) 36 
WHILE Condition DO Statement1 
Statement 
Condition 
. . . 
False
SUBPROGRAM (function) 37 
SUBPROGRAM1 . . . 
SUBPROGRAM1 
a meaningful collection 
of SEQUENCE, 
SELECTION, LOOP, 
SUBPROGRAM
Computer Components 
Central Processing Unit ( CPU ) 
38 
Control Unit 
Arithmetic Logic Unit 
Peripherals 
Auxiliary 
Storage 
Device 
Memory Unit ( RAM & Registers ) 
Input Device 
Output Device
Memory Organization 
• two circuit states correspond to 0 and 1 
• bit (short for binary digit) refers to a single 0 or 1. 
Bit patterns represent both the computer 
instructions and computer data 
• 1 byte = 8 bits 
• 1 KB = 1024 bytes 
• 1 MB = 1024 x 1024 = 1,048,576 bytes 
39
How Many Possible Digits? 
• binary (base 2) numbers use 2 digits: 
JUST 0 and 1 
• decimal (base 10) numbers use 10 digits: 0 
THROUGH 9 
40

More Related Content

PDF
Introduction to compilers
PPTX
INTRODUCTION TO C++, Chapter 1
PPTX
Algorithms - Introduction to computer programming
PPTX
An introduction-to-programming
PPT
Introduction to programming principles languages
PPTX
Cmp2412 programming principles
PPTX
Principles of programming
PDF
Principles of-programming-languages-lecture-notes-
Introduction to compilers
INTRODUCTION TO C++, Chapter 1
Algorithms - Introduction to computer programming
An introduction-to-programming
Introduction to programming principles languages
Cmp2412 programming principles
Principles of programming
Principles of-programming-languages-lecture-notes-

What's hot (20)

PPTX
DMA113 Chap1
PPTX
Ch1 language design issue
PDF
Ppl for students unit 1,2 and 3
PPTX
Algorithms and flow charts
PDF
Principles of programming languages. Detail notes
PPT
Basic Programming Concept
PDF
Programming Fundamentals and basic knowledge
PPTX
Imperative programming
PPTX
Week10 final
PPTX
Computer programing 111 lecture 2
PPTX
Cp 111 lecture 2
PDF
Graphical programming
PDF
Computer programing 111 lecture 1
PPTX
Unit 1. Problem Solving with Computer
PPTX
introduction to programming
PPTX
Programming language
PDF
The Programming Process
PDF
Lecture 1 Compiler design , computation
PDF
C Programming - Refresher - Part I
PPT
Introduction to Programming
DMA113 Chap1
Ch1 language design issue
Ppl for students unit 1,2 and 3
Algorithms and flow charts
Principles of programming languages. Detail notes
Basic Programming Concept
Programming Fundamentals and basic knowledge
Imperative programming
Week10 final
Computer programing 111 lecture 2
Cp 111 lecture 2
Graphical programming
Computer programing 111 lecture 1
Unit 1. Problem Solving with Computer
introduction to programming
Programming language
The Programming Process
Lecture 1 Compiler design , computation
C Programming - Refresher - Part I
Introduction to Programming
Ad

Similar to Mcs lec2 (20)

PDF
Fundamentals of programming with C++
PPT
01CHAP_1.PPT
PPT
Lecture 1-3.ppt
PPT
Chapter 1- C++ programming languages +.ppt
PDF
Problem Solving and Programming using C.pdf
PPTX
Computer programming
PPTX
lecture Slides - Week 1.programming fundamentals
PDF
BCA 1st semester Problem Solving Notes using C.pdf
PDF
Introduction to computer programming language
PPT
Computer Programming Computer Programming
PPT
CHAPTER-1.ppt
PPT
C++ programming program design including data structures
PPTX
Programming Language
PDF
C_Dayyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy1.pdf
PPTX
Lecture 1-2_Programming fundamentals.pptx
PPTX
Computer and programing basics.pptx
PPTX
Introduction To Computer Programming
PPTX
Introduction to Programming kkkkkkkkkkkkk
PPTX
Pf lec 01 intro
Fundamentals of programming with C++
01CHAP_1.PPT
Lecture 1-3.ppt
Chapter 1- C++ programming languages +.ppt
Problem Solving and Programming using C.pdf
Computer programming
lecture Slides - Week 1.programming fundamentals
BCA 1st semester Problem Solving Notes using C.pdf
Introduction to computer programming language
Computer Programming Computer Programming
CHAPTER-1.ppt
C++ programming program design including data structures
Programming Language
C_Dayyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy1.pdf
Lecture 1-2_Programming fundamentals.pptx
Computer and programing basics.pptx
Introduction To Computer Programming
Introduction to Programming kkkkkkkkkkkkk
Pf lec 01 intro
Ad

Recently uploaded (20)

PDF
LEARNERS WITH ADDITIONAL NEEDS ProfEd Topic
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
PPTX
Computer Architecture Input Output Memory.pptx
PDF
FOISHS ANNUAL IMPLEMENTATION PLAN 2025.pdf
PDF
BP 505 T. PHARMACEUTICAL JURISPRUDENCE (UNIT 2).pdf
DOCX
Cambridge-Practice-Tests-for-IELTS-12.docx
PPTX
Education and Perspectives of Education.pptx
PPTX
Unit 4 Computer Architecture Multicore Processor.pptx
PDF
Skin Care and Cosmetic Ingredients Dictionary ( PDFDrive ).pdf
PDF
International_Financial_Reporting_Standa.pdf
PDF
My India Quiz Book_20210205121199924.pdf
PDF
IP : I ; Unit I : Preformulation Studies
PDF
Literature_Review_methods_ BRACU_MKT426 course material
PPTX
Core Concepts of Personalized Learning and Virtual Learning Environments
PDF
English Textual Question & Ans (12th Class).pdf
PDF
AI-driven educational solutions for real-life interventions in the Philippine...
PDF
LIFE & LIVING TRILOGY - PART - (2) THE PURPOSE OF LIFE.pdf
PDF
Race Reva University – Shaping Future Leaders in Artificial Intelligence
PDF
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
PDF
Journal of Dental Science - UDMY (2021).pdf
LEARNERS WITH ADDITIONAL NEEDS ProfEd Topic
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
Computer Architecture Input Output Memory.pptx
FOISHS ANNUAL IMPLEMENTATION PLAN 2025.pdf
BP 505 T. PHARMACEUTICAL JURISPRUDENCE (UNIT 2).pdf
Cambridge-Practice-Tests-for-IELTS-12.docx
Education and Perspectives of Education.pptx
Unit 4 Computer Architecture Multicore Processor.pptx
Skin Care and Cosmetic Ingredients Dictionary ( PDFDrive ).pdf
International_Financial_Reporting_Standa.pdf
My India Quiz Book_20210205121199924.pdf
IP : I ; Unit I : Preformulation Studies
Literature_Review_methods_ BRACU_MKT426 course material
Core Concepts of Personalized Learning and Virtual Learning Environments
English Textual Question & Ans (12th Class).pdf
AI-driven educational solutions for real-life interventions in the Philippine...
LIFE & LIVING TRILOGY - PART - (2) THE PURPOSE OF LIFE.pdf
Race Reva University – Shaping Future Leaders in Artificial Intelligence
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
Journal of Dental Science - UDMY (2021).pdf

Mcs lec2

  • 1. What is a Programming Language? PS — Introduction © O. Nierstrasz 1 • A formal language for describing computation? • A “user interface” to a computer? • Syntax + semantics? • Compiler, or interpreter, or translator? • A tool to support a programming paradigm? A programming language is a notational system for describing computation in a machine-readable and human-readable form. — Louden
  • 2. 2 Figure 9.2 Categories of programming languages
  • 3. Generations of Programming Languages 1GL: machine codes 2GL: symbolic assemblers 3GL: (machine-independent) imperative languages (FORTRAN, Pascal, C ...) 4GL: domain specific application generators 5GL: AI languages … ( Prolog, OPS5, and Mercury are examples of fifth-generation languages.) Each generation is at a higher level of abstraction PS — Introduction © O. Nierstrasz 3
  • 4. CSC141 Introduction to Computer Programming Machine language (1GL) • The lowest level of language. • The language used to program the first-generation computers. • The instructions in 1GL are made of binary numbers, represented by 1s and 0s. • 1s and 0s correspond to the on and off states of electrical switches. • Suitable for the understanding of the machine but very much difficult to interpret and learn by the human programmer.
  • 5. Machine Language(contd) • is not portable • runs only on specific type of computer • is made up of binary-coded instructions (strings of 0s and 1s) • is the language that can be directly used by the computer 5
  • 6. CSC141 Introduction to Computer Programming Assembly language (2GL) • Low-level language that allows a programmer to use abbreviations or easily remembered words instead of numbers. • These Observations are called Mnemonics. These Mnemonic are Opcode and Operands For Example: ADD AX, BX MOV CX, AX INC CX Op-code; ADD, MOV, INC Operands AX, BX,CX
  • 7. CSC141 Introduction to Computer Programming Assembly language (2GL) (contd) • Programmer can write instructions faster but it is still not an easy language to learn. • Drawback: The language is specific to a particular processor family and environment. (Machine Dependent Language) • Assembler – A program that translates the assembly language program into machine language.
  • 8. High Level languages (3GL) • A High-Level Language is an English-like language. • It is a refinement of a second-generation programming language. • It allowed users to write in familiar notation, rather than numbers or abbreviations. • Most High-level languages are not Machine Dependent. • Translator for High-level languages is either a Compiler or an Interpreter. • Examples of High-level languages: ―FORTRON ―COBOL ―BASIC ―C and C++ CSC141 Introduction to Computer Programming
  • 9. High Level Languages (contd) • are portable • user writes program in language similar to natural language • examples -- FORTRAN, COBOL, Pascal, Ada, Modula-2, C++, Java • most are standardized by ISO/ANSI to provide an official description of the language 9
  • 10. CSC141 Introduction to Computer Programming Very-High-Level Languages (4GL) • 4GLs are much more user-oriented and allow programmers to develop programs with fewer commands compared with 3GLs. • Non-Procedural Language; Programmers don’t have to specify all the programming logic, only tell the computer what they want done. • Saves a lot of time. • 4GLs consist of report generators, query languages, application generators, and interactive database management system • For example: • RPG III (Report Generator) • SQL (Structured Query Language) • NOMAD and FOCUS (DBMS)
  • 11. Domain specific languages(DSL) • Specialized to a particular application domain. • Contrast to a general-purpose language (GPL), which is broadly applicable across domains, and lacks specialized features for a particular domain. • Wide variety of DSLs, ranging from widely used languages for common domains. • Sometimes informally called mini-languages. • Example: HTML for web pages.
  • 12. CSC141 Introduction to Computer Programming Natural Languages (5GL) • Two types • Ordinary Human Languages; like English. • Programming language that use human language to give people a more natural connection with computers. • 5GLs are designed to make the computer solve a given problem without the programmer. • Natural languages are part of the field of study known as Artificial Intelligence. • Develop machines to emulate human-like qualities such as learning, reasoning, communicating, seeing and hearing.
  • 13. What is Computer Programming? • It is the process of planning a sequence of steps (called instructions) for a computer to follow. 13 STEP 1 STEP 2 STEP 3 . . .
  • 14. Problem Solving How do you solve problems? Understand the problem Devise a plan Carry out the plan Look back 14
  • 15. Strategies Ask questions! • What do I know about the problem? • What is the information that I have to process in order the find the solution? • What does the solution look like? • What sort of special cases exist? • How will I recognize that I have found the solution? 15
  • 16. Strategies Ask questions! Never reinvent the wheel! Similar problems come up again and again in different guises A good programmer recognizes a task or subtask that has been solved before and plugs in the solution Can you think of two similar problems? 16
  • 17. Strategies Divide and Conquer! Break up a large problem into smaller units and solve each smaller problem • Applies the concept of abstraction • The divide-and-conquer approach can be applied over and over again until each subtask is manageable 17
  • 18. Algorithms Algorithm A set of unambiguous instructions for solving a problem or subproblem in a finite amount of time using a finite amount of data Why must instructions be unambiguous? Why must time and data be finite? 18
  • 19. Computer Problem-Solving 19 Analysis and Specification Phase Analyze Specification Algorithm Development Phase Develop algorithm Test algorithm Implementation Phase Code algorithm Test algorithm Maintenance Phase Use Maintain Can you name a recurring theme?
  • 20. Phase Interactions 20 Should we add another arrow? (What happens if the problem is revised?)
  • 21. A Tempting Shortcut? 21 GOAL THINKING CODE REVISE REVISE REVISE DEBUG DEBUG DEBUG TEST CODE
  • 22. Developing an Algorithm Two methodologies used to develop computer solutions to a problem • Top-down design focuses on the tasks to be done • Object-oriented design focuses on the data involved in the solution But first, let's look at a way to express algorithms: pseudocode 22
  • 23. An Algorithm is . . . • a step-by-step procedure for solving a problem in a finite amount of time. 23
  • 24. Pseudocode Pseudocode A way of expressing algorithms that uses a mixture of English phrases and indention to make the steps in the solution explicit There are no grammar rules in pseudocode Pseudocode is not case sensitive 24
  • 25. Example of algorithm • In this example, we design an algorithm to find the perimeter and area of a rectangle. • To find the perimeter and area of a rectangle, you need to know the rectangle’s length and width. • The perimeter and area of the rectangle are then given by the following formulas: • perimeter = 2 * (length + width) • area = length * width
  • 26. The algorithm to find the perimeter and area of the rectangle is: 1. Get the length of the rectangle. 2. Get the width of the rectangle. 3. Find the perimeter using the following equation: perimeter = 2 * (length + width) 4. Find the area using the following equation: area = length * width
  • 27. Problem-Solving Phase • ANALYZE the problem and SPECIFY what the solution must do • develop a GENERAL SOLUTION (ALGORITHM) to solve the problem • VERIFY that your solution really solves the problem 27
  • 28. Implementation Phase: Program • translating your algorithm into a programming language is called CODING • with C++, you use Documentation -- your written comments Compiler -- translates your program into machine language Main Program -- may call subalgorithms 28
  • 29. Implementation Phase: Test • TESTING your program means running (executing) your program on the computer, to see if it produces correct results • if it does not, then you must find out what is wrong with your program or algorithm and fix it--this is called debugging 29
  • 30. Maintenance Phase • USE and MODIFY the program to meet changing requirements or correct errors that show up in using it • maintenance begins when your program is put into use and accounts for the majority of effort on most programs 30
  • 31. Some C++ History • 1972 : Dennis Ritchie at Bell Labs designs C and 90% of UNIX is then written in C • Late 70’s : OOP becomes popular • Bjarne Stroustrup at Bell Labs adds features to C to form “C with Classes” • 1983 : Name C++ first used • 1998 : ISO/ANSI standardization of C++ 31
  • 32. Three C++ Program Stages 32 myprog.cpp myprog.obj myprog.exe SOURCE OBJECT EXECUTABLE other code from libraries, etc. written in machine language written in machine language written in C++ via compiler via linker
  • 33. Basic Control Structures • a sequence is a series of statements that execute one after another • selection (branch) is used to execute different statements depending on certain conditions • Looping (repetition) is used to repeat statements while certain conditions are met. • a subprogram is used to break the program into smaller units 33
  • 34. SEQUENCE 34 Statement Statement Statement . . .
  • 35. SELECTION (branch) 35 IF Condition THEN Statement1 ELSE Statement2 Statement1 Statement Condition . . . Statement2
  • 36. LOOP (repetition) 36 WHILE Condition DO Statement1 Statement Condition . . . False
  • 37. SUBPROGRAM (function) 37 SUBPROGRAM1 . . . SUBPROGRAM1 a meaningful collection of SEQUENCE, SELECTION, LOOP, SUBPROGRAM
  • 38. Computer Components Central Processing Unit ( CPU ) 38 Control Unit Arithmetic Logic Unit Peripherals Auxiliary Storage Device Memory Unit ( RAM & Registers ) Input Device Output Device
  • 39. Memory Organization • two circuit states correspond to 0 and 1 • bit (short for binary digit) refers to a single 0 or 1. Bit patterns represent both the computer instructions and computer data • 1 byte = 8 bits • 1 KB = 1024 bytes • 1 MB = 1024 x 1024 = 1,048,576 bytes 39
  • 40. How Many Possible Digits? • binary (base 2) numbers use 2 digits: JUST 0 and 1 • decimal (base 10) numbers use 10 digits: 0 THROUGH 9 40