Search Header Logo
Functions + Loop Review

Functions + Loop Review

Assessment

Presentation

Computers

9th - 12th Grade

Practice Problem

Medium

Created by

Noah Marestaing

Used 2+ times

FREE Resource

1 Slide • 9 Questions

1

Functions + Loop Review

By Noah Marestaing

2

Multiple Choice

What will get printed?

function math_stuff(a, b, c) {

console.log(a + b + c)

}

math_stuff(1, 4, 5)

math_stuff(2, 2, 2)

1

145

222

2

9

4

3

10

6

4

nothing

3

Multiple Choice

How many times will banana get printed?

var numbers = [1, 5, 6, 7, 8]

for (var i = 0; i < numbers.length; i++) {

console.log("banana")

}

1

5

2

infinite

3

0

4

4

4

Multiple Choice

How many times will this loop?

var a = 5

while (a < 10) {

console.log("abcde")

}

1

0

2

10

3

5

4

infinite

5

Multiple Choice

True or False: This function will work.

function attack(attack_pwr) {

hp = hp - attack_pwr

1

True

2

False

6

Multiple Choice

var name = prompt("what is your name")

name = "Peter"

What will be the value of name?

1

"Peter"

2

whatever the user typed

3

error

4

0

7

Multiple Choice

Which is NOT one of the 3 parts of a loop?

1

condition

2

start

3

format

4

iteration

8

Multiple Choice

var colors = ["orange", "green", "violet"]

Which will add a new color into this array?

1

colors.add("magenta")

2

colors.push("magenta")

3

colors.pop("magenta")

4

add("magenta").colors

9

Fill in the Blanks

Type answer...

10

Multiple Choice

Which will correctly create a function called add which adds two numbers together?

1

function add(a, b)

console.log(a + b)

2

function add(a, b) {

console.log(a + b)

}

3

function add () {

console.log(a + b)

}

4

function add [a, b] (

console.log(a + b)

)

Functions + Loop Review

By Noah Marestaing

Show answer

Auto Play

Slide 1 / 10

SLIDE