Search Header Logo
8.1 Programming concepts Lesson Slides

8.1 Programming concepts Lesson Slides

Assessment

Presentation

Computers

9th - 12th Grade

Medium

Created by

Adrian Ortiga

Used 6+ times

FREE Resource

23 Slides • 16 Questions

1

8.1 Programming concepts
Variables and Constants

By Adrian Ortiga

2

A programs needs to store data

For example:

  • The Grades of the students

  • The coins you have in Super Mario

  • Your username of Wechat account

3

Variables and Constant are use to store this data

​666

​X

4

Computer Memory, eg. RAM

media

Data
values

​Memory
location
(address)

5

Each variable and constant is on a different memory location

media

we have number 10

​In memory
location 0

6

Each Var and Const have an identifier (a name to find the value)

media

​Here the identifiers are the memory location

7

Each Var and Const have an identifier (a name to find the value)

But we change it, to more meaningful names

media

8

Fill in the Blank

What is a named memory location that can store data, and the data can change while a program is running?

9

Fill in the Blank

What is a named memory location that can store data, but the data cannot change while a program is running?

10

Fill in the Blank

What is the name given to a variable, constant, data structure (like an array), or subroutine?

In order to identify memory address.

11

Multiple Choice

What is the difference between a constant and a variable?

1
A constant can change, while a variable does not change.
2
Both constants and variables can change at any time.
3
A constant is a type of variable that can change its value.
4
A constant does not change, while a variable can change.

12

Fill in the Blank

What is a type of programming statement that stores data in a variable or constant?

It is used to assign a value to a data address

13

Create, declare, define a variable

media

14

Create, declare, define a variable

media

​Page 200

15

Common Variable Naming Conventions
(Rules for the names of variables.)

media

16

Multiple Choice

Which one of these is a valid variable name?

1

user-name

2

123name

3

user_name

4

name@user

17

Common Variable Naming Conventions
(Rules for the names of variables.)

media

18

Multiple Choice

Which variable name is NOT allowed?

1

firstPlace

2

_winner

3

2ndWinner

4

winner2

19

Common Variable Naming Conventions
(Rules for the names of variables.)

media

20

Multiple Choice

Which variable name is correct?

1

user name

2

username

3

user-name

4

user@name

21

Common Variable Naming Conventions
(Rules for the names of variables.)

media

22

Multiple Choice

Which is the best variable name for storing a person's age?

1

age

2

number1

3

a

4

temp

23

Common Variable Naming Conventions
(Rules for the names of variables.)

media

24

Multiple Choice

Which is an example of camelCase?

1

total_price

2

TotalPrice

3

totalPrice

4

totalprice

25

Common Variable Naming Conventions
(Rules for the names of variables.)

media

26

Multiple Choice

Which variable name is written like a constant?

1

max_speed

2

MaxSpeed

3

MAX_SPEED

4

maxSpeed

27

Common Variable Naming Conventions
(Rules for the names of variables.)

media

28

Multiple Choice

Which variable name is NOT a reserved keyword?

1

if

2

while

3

data

4

for

29

Common Variable Naming Conventions
(Rules for the names of variables.)

media

30

Multiple Choice

In most languages, what is true about Name and name?

1

They are the same.

2

They are different.

3

One is correct, one is wrong.

4

They are both wrong.

31

Common Variable Naming Conventions
(Rules for the names of variables.)

media

32

Multiple Choice

When is it okay to use very short variable names like i or j ?

1

In any program.

2

When naming user accounts.

3

Never.

4

Inside a small loop.

33

Common Variable Naming Conventions
(Rules for the names of variables.)

media

34

Multiple Choice

Why should you use the same style (like camelCase or snake_case) in your code?

1

To make it look cool.

2

To avoid errors.

3

To make the code easy to read.

4

Because the computer requires it.

35

Constants

Constants are the variables that CANNOT be changed.

36

Constants

Some programming languages like Python do not support CONSTANTS.

37

Data types

The data store in Variables and Constants can be of different types.

38

Data types

media

​Page 202

39

Match

Match the following data with its data type

String

Integer

Real, single, double

Bolean

Char

"hello"

666

666.00

False

'h'

8.1 Programming concepts
Variables and Constants

By Adrian Ortiga

Show answer

Auto Play

Slide 1 / 39

SLIDE