Search Header Logo
Computer Science Principles Unit 7 Review

Computer Science Principles Unit 7 Review

Assessment

Presentation

Computers

9th - 12th Grade

Practice Problem

Medium

Created by

Cory Bougher

Used 55+ times

FREE Resource

15 Slides • 13 Questions

1

Computer Science Principles Unit 7 Review

Parameters & Libraries

Slide image

2

Modulo

  • the remainder of a division problem

  • will be either even or odd

  • called MOD

  • shown as %

Slide image

3

Multiple Choice

Which of the following shows an EVEN modulo?

1

num % 2 = 0

2

num % 2 = 1

4

Multiple Choice

What is printed in the console for (17 % 6)?

1

1

2

2

3

3

4

4

5

Procedural Abstraction

When you don't need to know/understand every detail of a block of code - just the overall functionality

Slide image

6

Modularity

separating the functionality of a program into independent, interchangeable modules

Slide image

7

Multiple Choice

Which term refers to a solution to a large problem that is based on the solutions of smaller subproblems?

1

modularity

2

library

3

procedural abstraction

4

API

8

Multiple Choice

Dividing a program into separate subprograms (such as libraries) is known as:

1

modularity

2

library

3

procedural abstraction

4

API

9

Algorithms

10

Multiple Choice

Algorithms can be created in all the following ways EXCEPT:

1

combining existing algorithms

2

removing sequencing, selection, and iteration from an algorithm

3

modifying existing algorithms

11

Multiple Choice

Using existing algorithms as building blocks for new algorithms has all the following benefits EXCEPT:

1

removes procedural abstraction

2

simplifies debugging

3

reduces development time

12

Libraries

13

Multiple Choice

What is one of the benefits of using a library in a program?

1

increases development time

2

simplifies creating a complex program

3

removes all testing

4

reduces abstractions in the program

14

Debugging Tips

  • check for spelling/capitalization errors

  • check for symbol errors ( { [ " ' ; : & ==

  • is something blank?

  • is a variable named but not called?

  • is the loop infinite?

  • then check your logic sequentially

  • use console.logs to see what is running

15

Functions, Parameters, Values, Returns

  • function should be named for what it does

  • parameter with a value or argument will be passed to the function to return something

  • return should also be descriptive

Slide image

16

Functions that use Loops with Booleans

This function called "filter" is using a loop to run through length of a list and compare something in the list to a specific criteria. If true, certain code runs. If false, another code runs instead.

Slide image

17

Slide image

18

Multiple Choice

Question image

This function checks if a character is a vowel. If it is, it returns true. Otherwise, it returns false. Where should return false; be written in the code?

1

OPTION A

2

OPTION B

3

OPTION C

19

Slide image

20

Multiple Choice

Question image

What will be printed to the console after this program runs?

1

[2, 7, 6, 4, 5]

2

[5, 3, 1, -1, 9]

3

[2, 5, 3, 1, 6]

21

Slide image

22

Multiple Choice

Question image

This function finds the minimum number in a list. What should <MISSING CODE SEGMENT> be replaced with in order for this function to operate as expected?

1

numList[i] = min;

2

min = numList[i];

3

min = numList;

4

numList = min;

23

Slide image

24

Multiple Choice

Question image

You have imported a library with the anniversaryYear() function. Based on the API, how many strings are imputed to calculate the anniversary month?

1

0

2

1

3

2

4

3

25

API & Consistent Syntax

This API describes how to move an element. When the function is called, the id, direction, and amount should be programmed consistently (use strings or numbers in the same way throughout).

Slide image

26

Multiple Choice

Question image

Which syntax of the function correctly follows the instructions laid out in the API?

1

moveElement("button1", 2, 23);

2

moveElement("button1", "up", 25);

3

moveElement("button1", "left", "thirty");

4

moveElement("button1", 30, "two");

27

Slide image

28

Multiple Choice

Question image

Here is the API for a robot library. Which code segment will guarantee that the robot makes it to the grey square without hitting a wall or a barrier (black square)?

1
2
3

Computer Science Principles Unit 7 Review

Parameters & Libraries

Slide image

Show answer

Auto Play

Slide 1 / 28

SLIDE