program structure Flashcards

1
Q

A fragment of code that produces a value is called an _________.

A

expression

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

If an expression corresponds to a sentence fragment, a JavaScript _________ corresponds to a full sentence.

A

statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

To catch and hold values, JavaScript provides a thing called a _______, or variable

A

binding

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q
let caught = 5 * 5;
which in the sentence is a binding?
A

caught

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

After a binding has been defined, its name can be used as an ____________.

A

expression

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Bindings or variable names can start with numbers. T/F

A

false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Bindings can include numbers. T/F

A

true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Bindings can include the $ sign. T/F

A

true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Bindings can not include the _ sign. T/F

A

false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Bindings can’t use any punctuation and special characters other than $ and _. T/F

A

true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

The collection of bindings and their values that exist at a given time is called the __________.

A

environment

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

A _______ is a piece of program wrapped in a value.

A

function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Values given to functions are called __________.

A

arguments

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Executing a function is called ______, ______, or ______ it.

A

invoking, calling, or applying

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

When a function produces a value, it is said to _______ that value.

A

return

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Not all programs are straight roads. We may, for example, want to create a branching road, where the program takes the proper branch based on the situation at hand. This is called _________ ____________.

A

conditional execution

17
Q

Conditional execution is created with the _____ keyword in JavaScript.

A

if

18
Q

A statement starting with the keyword _______ creates a loop.

A

while

19
Q

A ___ _____ always executes its body at least once, and it starts testing whether it should stop only after that first execution.

A

do loop

let yourName;
do {
  yourName = prompt("Who are you?");
} while (!yourName);
console.log(yourName);
20
Q

The parentheses after a for keyword must contain two semicolons. The part before the first semicolon ______ the loop, usually by defining a binding. The second part is the expression that ________ whether the loop must continue. The final part _______ the state of the loop after every iteration.

A

initializes
checks
updates

21
Q
what does "break" do in the following code:
for (let current = 20; ; current = current + 1) {
  if (current % 7 == 0) {
    console.log(current);
    break;
  }
}
A

break that has the effect of immediately jumping out of the enclosing loop

22
Q

When ___________ is encountered in a loop body, control jumps out of the body and continues with the loop’s next iteration.

A

continue

23
Q

What is the shortcut for:

counter = counter + 1;

A

counter += 1;
or
counter++;

24
Q

Instead of a long sequence of if statements on a binding, a _______ statement can be used instead.

A

switch

25
Q

Single line comments are made with?

A

//

26
Q

Multiple line comments begin with __ and end with __.

A

/* */