AP COMPUTER SCIENCE PRINCIPLES Unit 4 Test Review - Code.org, Code.Org Computer Science Principles Unit 4 test, CS Principles Unit 4 Assessment

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/53

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 9:57 PM on 3/5/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

54 Terms

1
New cards

Affects the sequential flow of control by executing different statements based on the value of a Boolean expression.

Conditional Statement

2
New cards

Stores information as a number, String, or Boolean.

Variable

3
New cards

Joins together two or more strings end-to-end to make a new string.

Concatenation

4
New cards

An ordered sequence of characters.

String

5
New cards

True

What is the Output of this Flowchart?

<p>What is the Output of this Flowchart?</p>
6
New cards

"Looking Fresh"

What is the Output of this Flowchart?

<p>What is the Output of this Flowchart?</p>
7
New cards

90

32.2

What is the Output of this Code?

<p>What is the Output of this Code?</p>
8
New cards

100

What is the Output of this Code?

<p>What is the Output of this Code?</p>
9
New cards

Change the line with "var y = y + 1" to

y = y + 1

Y is less than 6" never displays to the console. How would you change the code to fix this?

<p>Y is less than 6" never displays to the console. How would you change the code to fix this?</p>
10
New cards

Classical

What is the Output of this Code?

<p>What is the Output of this Code?</p>
11
New cards

"no you cannot get a cat"

What is the Output of this Code?

<p>What is the Output of this Code?</p>
12
New cards

True

False

False

False

&& operator - Write the Output for each expression

true && true =

true && false =

true && false =

false && false =

13
New cards

True

True

True

False

|| operator - Write the Output for each expression

true || true =

true || false =

false || true =

false || false =

14
New cards

False

True

! operator - Write the Output for each expression

!true =

!false =

15
New cards

A named group of programming instructions. Also referred to as a "procedure".

Function

16
New cards

A command that executes the code within a function.

Function Call

17
New cards

1. Functions can help remove repeated code from a program

2. Functions are declared once

True Statements about functions -

18
New cards

1. Programs with functions run more quickly

2. Functions can only be called once

3. Replacing repeated code with a function will reduce the number of commands the computer needs to run

False Statements about functions -

19
New cards

"a"

"b"

"c"

"b"

"c"

What is the output of this Code?

<p>What is the output of this Code?</p>
20
New cards

D). x = 3, y = 2, z = 1

Answer The Question

<p>Answer The Question</p>
21
New cards

B). The program will be easier for people to read.

D). The programs will be easier to modify in the future.

Answer The Question

<p>Answer The Question</p>
22
New cards

D). (num MOD 2) = 1

Answer The Question

<p>Answer The Question</p>
23
New cards

false

false

false

Answer The Question

<p>Answer The Question</p>
24
New cards

true

(t/f) Variables update line by line.

25
New cards

false

(t/f) Typing "var" before a word only updates a variable.

26
New cards

the last line that is true

What line of an if statement will show in a console.log area?

27
New cards

true

(t/f) A number added to a variable updates it line by line.

28
New cards

true

(t/f) The else statement at the end of an if else only executes if everything else is false.

29
New cards

name, number, variable

Updating a variable gives the variable a new...?

30
New cards

how many times they are called

How many times do functions execute?

31
New cards

in a declared function

Where should you put lines of code that are repeated in an on event?

32
New cards

false

(t/f) It does not matter in what order lines of code are entered.

33
New cards

the same name as the declared function

What name is used to call a function?

34
New cards

equals

What does == mean in code?

35
New cards

false

(t/f) The most limiting statement should come last in code.

36
New cards

they help eliminate repeated code.

why create functions in code?

37
New cards

false

(t/f) && means "or"

38
New cards

conditionals

What statements are executed in sequential order based on the value of Boolean expressions?

39
New cards

true

(t/f) A flow chart is used to trace the path of Boolean expressions.

40
New cards

What number will be output by the console.log command on line 7?

100

<p>100</p>
41
New cards

What number will be output by the console.log command on line 5?

16

<p>16</p>
42
New cards

What number will be output by the console.log command on line 5?

35

<p>35</p>
43
New cards

What text will be output by the program?

30 or more

<p>30 or more</p>
44
New cards

What text will be output by the program?

Output D

<p>Output D</p>
45
New cards

What will be the order of letters printed to the console when this program is run?

a b c b c

<p>a b c b c</p>
46
New cards

"You win!" never displays. What change would fix this issue?

Line 3 - remove var

<p>Line 3 - remove var</p>
47
New cards

When this function is called, the smaller of two numbers is displayed. What Boolean expression would not work in line 12 in order to accomplish this goal?

num1 == num2

<p>num1 == num2</p>
48
New cards

This function chooses the screen to display based on the score. What is the correct way to call this function?

checkWin ( ) ; →

<p>checkWin ( ) ; →</p>
49
New cards

There is repeated code in these onEvent blocks. Choose the correct code for the updateScreen() function which would be called in each of the onEvent blocks.

function updateScreen() {

setText("counter_label", "counter");

if (counter == 0) {

setProperty("counter_label", "font-size", 24);

}

}

50
New cards

A movie theater charges different ticket prices based on a customer's age. The prices are shown in the table below.

The customer's age is stored in the variable age and the price is stored in the variable price. Which piece of code will correctly decide the price for each ticket.

if (age >= 65) {

price = 6;

} else if ((age > 12)) {

price = 8;

} else {

price = 5;

}

51
New cards

A museum charges different prices based on the day of the week and age of the visitor. The pricing rules are shown below.

On Tuesday and Thursday children 10 and under get in free ($ 0).

For all other days and ages the cost is ten dollars ($ 10).

The visitor's age is stored in the variable age, the day of the week is stored in a variable day, and the price in dollars is stored in the variable price. Which piece of code will correctly decide the price for each ticket.

if ((day == "Tuesday" || day == "Thursday") && (age <= 10)){

price = 0;

} else {

price = $10;

}

52
New cards

What will the value of the variable bags be at the end of the flowchart shown here?

2

<p>2</p>
53
New cards

Choose the correct definition for Conditional Statement

affects the sequential flow of control by executing different statements based on the value of a Boolean expression

54
New cards

Which of the following is true of functions?

Functions can help remove repeated code from a program