Search Header Logo
Programming Fundamentals

Programming Fundamentals

Assessment

Presentation

•

Computers

•

8th Grade

•

Easy

Created by

Leslie Brazell

Used 3+ times

FREE Resource

19 Slides • 27 Questions

1

Programming Fundamentals

By Leslie Brazell

2

Interpreters - Interpreted Language​

​Translates and executes program code line by line into machine code.

​

ADVANTAGE: Easier to locate and fix errors.​

DISADVANTAGE: Runs slower​

** There are many, many different types of programming languages.

3

Compilers - Compiled Language​

​Translates, or “compiles” the entire code into machine code and then runs the program, or sets aside to run later.

​

ADVANTAGE: Runs faster

DISADVANTAGES: ​Harder to locate and fix errors.​

4

Multiple Choice

What is an advantage of interpreted language

1

It runs fast

2

It is easy to correct an error

5

Multiple Choice

What is an advantage of compiled language

1

It runs fast

2

It is easy to correct an error

6

Multiple Choice

Which type of programming language translates the entire code before running any of the instructions/steps?

1

compiled

2

interpreted

3

scripting

4

markup

7

Multiple Choice

Which type of programming language translates and executes program code line by line into machine code?

1

compiled

2

interpreted

3

scripting

4

markup

8

NAMING RULES

​Basic Guidelines:

  • Use descriptive names

  • No spaces

  • camelCase (Start with lowercase letter and every next word starts with a capital letter)

  • Cannot start with a number

  • Names are case sensitive!

9

Multiple Choice

Which of the following is an example of camel case?

1

partOfday

2

partOfDay

3

PartOfDay

4

PartofDay

10

media
​Type of Computer Language
Used to design web pages

11

media
​Type of Computer Language
Interpreted language which uses scripts, or a series of commands

​

12

​Type of Computer Language
Used specifically in databases to be able to search and filter the infroamtion in a database.
media

13

Multiple Choice

Which type of language uses a series of commands?

1

HTML

2

Query

3

Scripting

4

Compiled

14

Multiple Choice

Which type of language is used to design web pages?

1

HTML

2

Query

3

Scripting

4

Compiled

15

Multiple Choice

Which type of language is used in databases?

1

HTML

2

Query

3

Scripting

4

Compiled

16

Data Types

integer - contains a number. The number can be positive, negative, or zero. It cannot have a decimal component. (EX: -50, 0, 5)

​

​string - contains text, or a sequence of letters, numbers, punctuation, spaces, etc. (EX: "Hello", world!", "abc123")

​

char (short for character) - contains a single character or punctuation. (EX: a, z, 1, !, #)

​

Boolean - binary and evaluates to either true or false. (EX: true, false)​

​

​

​

17

Multiple Choice

Which data type contains text, or a sequence of letters, numbers, punctuation, spaces, etc.?

1

integer

2

string

3

char

4

Boolean

18

Multiple Choice

Which data type contains a single character or punctuation?

1

integer

2

string

3

char

4

Boolean

19

Multiple Choice

Which data type contains a number that can be positive, negative, or zero but cannot have a decimal component?

1

integer

2

string

3

char

4

Boolean

20

Multiple Choice

Which data type is binary and evaluates to either true or false?

1

integer

2

string

3

char

4

Boolean

21

Variables - can change

​ var myFavoriteNumber = 24;

myFavoriteNumber = 12;

println(myFavoriteNumber);

output

​

12​

22

constant - can NOT change

​ var myFavoriteNumber = 24;

myFavoriteNumber = 12;

​Error Line 2:

Uncaught TypeError​: Assignment to constant variable

​

23

Multiple Choice

What keyword do you need to use to define a variable in JavaScript?

1

variable

2

var

3

const

4

x

24

Multiple Choice

What will be printed as a result of the following code segment?

var firstPlace = "Dylan";

var secondPlace = "Jacob";

firstPlace = "Jacob";

secondPlace = "Julia";

println(firstPlace);

println(secondPlace);

1

Jacob

Dylan

2

Jacob

Julia

3

Julia

Jacob

4

Dylan

25

Multiple Choice

A store has 30 backpacks. How can you store this information in a JavaScript variable?

1

var num backpacks = 30;

2

20 = numBackpacks;

3

var numBackpacks = 30;

4

var numBackpacks ==30;

26

How to write a karel command

​ move( );

​

  • No spaces in commands

  • Need to match exact capitalization

  • Every command ends in ( );

27

Multiple Choice

Which of these is a valid Karel command?

1

turnleft( );

2

TurnLeft( );

3

turnLeft( );

4

(turnLeft);

28

functions

Functions are a way to teach Karel a new command (word).

​

​

​

​Functions allow us to

  • Break our program into smaller parts

  • Make the program easier to understand

  • Avoid repeating code over and over

29

calling "turn around"

Define "Turn around"

Defining and Calling a Function

​function turnAround() { turnLeft(); turnLeft(); }

​turnAround();

turnRight();

move();​

​Defining a function - Writing out the instructions for this new action

​Calling a function - Actually causing the action to happen

30

Multiple Choice

Which of the following is an example of defining a function?

1

function backflip( ) {

turnLeft( );

turnLeft( );

turnLeft( );

turnLeft( );

2

backflip( );

31

Multiple Choice

Which of the following is an example of calling a function?

1

function backflip( ) {

turnLeft( );

turnLeft( );

turnLeft( );

turnLeft( );

2

backflip( );

32

Multiple Choice

Functions are a way to teach Karel a new command.

1

True

2

False

33

Multiple Choice

Which function will teach Karel how to spin in a circle one time?

1

function spin() { turnRight();

}

2

function spin() { turnLeft(); turnLeft(); turnLeft(); turnLeft();

}

3

function spin() { turnLeft(); turnLeft();

}

4

function spin() { move(); move(); move(); move();

}

34

Loops

​For Loops - For loops let Karel repeat a section of code a fixed number of times

​While Loops - While loops allow us to repeat a section of 

code as long as some condition is true.

​for(var i = 0; i < count; i++) {

/* code to execute count times */ }

​// This places ten balls down

for(var i = 0; i < 10; i++)

{ putBall(); }

​while(condition) {

/* code to repeat */

}

​while(frontIsClear()) { move();

}

35

Loops
  • ALL programming has FOR LOOPS​

  • Repeat as long as condition is true.

  • Repeat for an undetermined number of times.​

​For Loops

​While Loops

  • Repeat fixed number of times

  • ​Repeat as long as condition is true

36

For Loops

​move( ); five times

to FOR LOOPS

function start ( ){

move( );​

move( );

move( );

move( );

move( );​

}​

​

​

​

​for (var i = 0; i < 5; i++) {

move( );

}

37

if/else statements

An if-else statement runs some code if a condition is true, 

and a different block of code if that condition is false.

This IF/ELSE statement tells Karel to move forward if it is clear (nothing blocking his way).

​

Else (if something is blocking his way) he will turn left.​

if(frontIsClear( )) {

move( );​

} else {

turnLeft( );

}

38

Multiple Choice

What is the best way for Karel to move 10 times?

1

move(); move(); move(); move(); move(); move(); move(); move(); move(); move();

2

for (var i = 0; i < 10; i++)

{ move();

}

3

move(10);

4

move10();

39

Multiple Choice

What does an if/else statement look like in JavaScript?

1

if (condition) { //code

}

2

for (var i = 0; i < count; i++) { //code

}

3

if (condition) { //code }

if (condition) { //code

}

4

if (condition) { //code

} else {

//code

}

40

Multiple Choice

Why do we use if/else statements in JavaScript?

1

To repeat something for a fixed number of times

2

To do something if a condition is true and do something else if the condition is false

3

To break out of some block of code

4

To repeat something while a condition is true

41

Multiple Choice

If you want to write a program to have Karel put down 50 tennis balls. Which control structure would you use?

1

If statement

2

While statement

3

For loop

4

Nested while loop

42

A fixed container that stores an ordered collection of items.

array -

Arrays

Shopping List

​

bread eggs milk cookies​

0 1 2 3​

​var shoppingList =

["bread", "eggs",

"milk", "cookies"];

​println(shoppingList)[1] );

​eggs

43

Multiple Choice

Given the following list, what would the output be?

var travelList = [Alaska, Australia, Ireland, Argentina];

println(travelList [3]);

1

Alaska

2

Australia

3

Ireland

4

Argentina

44

Multiple Choice

What is an array?

1

a collection of items stored at (row, column) locations.

2

an unordered collection of unique items.

3

a collection of (key, value) pairs.

4

an ordered collection of items.

45

Multiple Choice

In the following array, which of the following statements will change "Argentina" to "Peru"?

var travelList = [Alaska, Australis, Ireland, Argentina];

1

travelList ["Argentina"] = Peru;

2

travelList[4] = "Peru";

3

travelList[3] = "Peru";

4

travelList change [1] = "Peru";

46

Vocabulary

Some text here about the topic of discussion

​code - a term used in programming for the set of instructions that can be run or executed by a computer.

​condition - is code that you put inside an if statement or while-loop.

object - can store combinations of keys and values where the value can be accessed by its associated key. Resizable - One data type

pattern-tertiary
Programming Fundamentals

By Leslie Brazell

Show answer

Auto Play

Slide 1 / 46

SLIDE