Search Header Logo
Programming Concepts P1

Programming Concepts P1

Assessment

Presentation

Computers

10th - 11th Grade

Medium

Created by

Mr London

Used 12+ times

FREE Resource

14 Slides • 18 Questions

1

Programming Concepts

Programming

Slide image

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?

1

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

2

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

3

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

4

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

Slide image

Data Types

9

Multiple Choice

What type of data is this?


"A"

1

Integer

2

Float or Real

3

Boolean

4

String

5

Character or Char

10

Multiple Choice

What type of data is this?


21

1

Integer

2

Float or Real

3

Boolean

4

String

5

Character or Char

11

Multiple Choice

What type of data is this?


3.142

1

Integer

2

Float or Real

3

Boolean

4

String

5

Character or Char

12

Multiple Choice

What type of data is this?


TRUE

1

Integer

2

Float or Real

3

Boolean

4

String

5

Character or Char

13

Multiple Choice

What type of data is this?


"I like Computer Science"

1

Integer

2

Float or Real

3

Boolean

4

String

5

Character or Char

14

Multiple Choice

What is a variable?

1

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

2

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

3

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

4

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?

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?

1

a storage location that can change a value during normal program execution

2

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?

1

a storage location that can change a value during normal program execution

2

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 Blank

What is the result of the following operations?

y = 32 DIV 5

26

Fill in the Blank

What is the result of the following operations?

x = 32 MOD 5

27

Priority of operators (Maths link!)

Remember BODMAS? Or BIDMAS

•Brackets

Orders or pOwers ----- Indices

•Division

•Multiplication

•Addition

•Subtraction

28

Fill in the Blank

Calculate: x = (5 – 2) + (16 – 6/2)

29

Multiple Choice

Does this equation need brackets?:

x = (5 – 2) + (16 – 6/2)

1

Yes

2

No

3

I'm not sure

30

Fill in the Blank

Calculate: y = 7 * 3 + 10 / 2

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

Slide image

Show answer

Auto Play

Slide 1 / 32

SLIDE