

Programming Concepts P1
Presentation
•
Computers
•
10th - 11th Grade
•
Medium
Mr London
Used 12+ times
FREE Resource
14 Slides • 18 Questions
1
Programming Concepts
Programming

2
Objectives
Understand and use data types: integer, real, Boolean, character and string
Declare and use constants and variables
Use input, output and assignment statements
Use arithmetic operators including MOD and DIV
Use string handling and conversion functions
3
Open Ended
What is a variable?
4
What is a variable?
A variable is a storage location paired with an associated symbolic name, which contains some known or unknown quantity of information referred to as a value
Name = “Mr London”
Today = “07/02/2021”
X = 11
Y = X + 35
5
Multiple Choice
What is a variable?
A variable is a storage location paired with a value, which contains some known or unknown quantity of information referred to as an associated symbolic name
A variable is a storage location paired with an associated symbolic name, which contains some known or unknown quantity of information referred to as a value
A variable is a known or unknown quantity paired with a value, which contains some storage locations of information referred to as an associated symbolic name
A variable is a storage location paired with an associated symbolic name, which contains some values of information referred to as a known or unknown quantity
6
Variable types
Variable types typically include integer, real, Boolean, character and string
In many programming languages, variables have to be declared at the start of the program so that the appropriate amount of memory can be reserved for them
7
Declaring Variable types
Var
numberOfStudents : integer;
circleArea : real;
found : Boolean;
answer : char;
studentName : string
8
Data Types
9
Multiple Choice
What type of data is this?
"A"
Integer
Float or Real
Boolean
String
Character or Char
10
Multiple Choice
What type of data is this?
21
Integer
Float or Real
Boolean
String
Character or Char
11
Multiple Choice
What type of data is this?
3.142
Integer
Float or Real
Boolean
String
Character or Char
12
Multiple Choice
What type of data is this?
TRUE
Integer
Float or Real
Boolean
String
Character or Char
13
Multiple Choice
What type of data is this?
"I like Computer Science"
Integer
Float or Real
Boolean
String
Character or Char
14
Multiple Choice
What is a variable?
A variable is a storage location paired with a value, which contains some known or unknown quantity of information referred to as an associated symbolic name
A variable is a storage location paired with an associated symbolic name, which contains some known or unknown quantity of information referred to as a value
A variable is a known or unknown quantity paired with a value, which contains some storage locations of information referred to as an associated symbolic name
A variable is a storage location paired with an associated symbolic name, which contains some values of information referred to as a known or unknown quantity
15
Open Ended
What is a constant?
16
What is a constant?
A constant is a value that cannot be altered by the program during normal execution, i.e., the value is constant and doesn't change.
This is contrasted with a variable, which is an storage location with a value that can be changed during normal execution, i.e., the value is variable.
17
Multiple Choice
What is a constant?
a storage location that can change a value during normal program execution
a storage location that can't change a value during normal program execution
18
Constants
As well as variables, you can define constants in a program
const
PI = 3.14157926535
MONTHLYTARIFF = 15.60
var
totalBill :real
Constants are typically shown in UPPERCASE
19
Open Ended
Why declare a constant instead of a variable?
20
Why declare a constant instead of a variable?
Constants are used when you want to assign a value that doesn't change. This is helpful because if you try to change this, you will receive an error.
You use a constant, when the value of a variable never changes during the lifetime of your program. Once you defined a constant x, you can't change it's value anymore.
21
Multiple Choice
What is a constant?
a storage location that can change a value during normal program execution
a storage location that can't change a value during normal program execution
22
Input and output statements
Most programs accept data from the user, process it in some way, and output a result
print (“How many hours a night do you sleep?”)
hoursPerNight = input()
hoursPerWeek = hoursPerNight * 7
print (“That’s”, hoursPerWeek, “per week!”)
23
INPUT statement
In some languages, such as Python, you can combine a user prompt with an INPUT statement:
firstname = input (“What is your name? ”)
This statement first displays the message “What is your name?” and then waits for the user to enter some text and press Enter
The response is then assigned to the variable
firstname
24
Arithmetic operators (Revisit)
The operators +, -, * and / are used for addition, subtraction, multiplication and division
The operator DIV is used for integer division
(5 DIV 2 = 2)
MOD is used to find the remainder when dividing one integer by another
(5 MOD 2 = 1)
25
Fill in the Blanks
Type answer...
26
Fill in the Blanks
Type answer...
27
Priority of operators (Maths link!)
Remember BODMAS? Or BIDMAS
•Brackets
•Orders or pOwers ----- Indices
•Division
•Multiplication
•Addition
•Subtraction
28
Fill in the Blanks
Type answer...
29
Multiple Choice
Does this equation need brackets?:
x = (5 – 2) + (16 – 6/2)
Yes
No
I'm not sure
30
Fill in the Blanks
Type answer...
31
Poll
How have you found this style of lesson? (Be honest please!)
Same as normal (Good)
Same as normal (Bad)
Better than normal
Worse than normal
Best style so far
32
Now complete Worksheet 1 Tasks 1 and 2
Programming Concepts
Programming

Show answer
Auto Play
Slide 1 / 32
SLIDE
Similar Resources on Wayground
24 questions
Uso y Búsqueda de Información en Internet
Presentation
•
10th Grade
25 questions
LECȚIE: Decalogul sau Cele zece porunci
Presentation
•
10th Grade
25 questions
CELULA
Presentation
•
10th Grade
25 questions
P.7E Optics Vocabulary Intro
Presentation
•
11th Grade
25 questions
Bohr Models
Presentation
•
10th - 12th Grade
24 questions
Empirical, Molecular and Percent Comp.
Presentation
•
10th - 12th Grade
27 questions
World War 1
Presentation
•
10th Grade
25 questions
Network Security
Presentation
•
10th Grade
Popular Resources on Wayground
24 questions
PBIS-HGMS Day 10
Quiz
•
6th - 8th Grade
10 questions
HCS SCI 03 Summer School Review 3
Quiz
•
3rd Grade
11 questions
Home Scope
Quiz
•
7th - 8th Grade
15 questions
HCS SCI 05 Summer School Assessment 3 Review
Quiz
•
5th Grade
35 questions
Lufkin Road Middle School Student Handbook & Policies Assessment
Quiz
•
7th Grade
18 questions
Geo 11.3 Area of Circles and Sectors
Quiz
•
9th - 11th Grade