unit 5 AP compsci

0.0(0)
Studied by 1 person
0%Big Idea 5 Mastery
0%Exam Mastery
Build your Mastery score
multiple choiceMultiple Choice
call kaiCall Kai
Supplemental Materials
Card Sorting

1/16

Last updated 7:02 PM on 12/7/23
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

17 Terms

1
New cards

why do we use functions

helps us understand the code easier

makes code less repetitive and more organized

makes code reusable

2
New cards

Parameters

The inputs/what goes into a function

Order matters

3
New cards

local variables

defined inside a function/loop and can only be used inside that function/loop

4
New cards

global variables

can be used anywhere in the code

ex: constanants

5
New cards

scope

the area of code that a variable can be used in

6
New cards

why do we need scope

differentiate variables with the same name in different parts of code

(cannot have 2 variables with the same name within the same scope)

7
New cards

What does API stand for

Application Programming Interference

8
New cards

what does api do

Set of tools for buliding programs

Helps two programs connect or communicate with each other

Helps devices connect and connects devices to programs

9
New cards

API examples

spotify, twitter

10
New cards

return value

returns the value when the function is called, does not print value unless println is used

11
New cards

What part of the function is bolded?

function start(){

var numApples = 4;

println("Before: " + numApples);

var twiceAsMany = doubleNumber(numApples);

println("After: " + twiceAsMany);

}

function doubleNumber(x){

var doubledX = 2 * x;

return doubledX;

calling the function

12
New cards

What part of the function is bolded?

function start(){

var numApples = 4;

println("Before: " + numApples);

var twiceAsMany = doubleNumber(numApples);

println("After: " + twiceAsMany);

}

function doubleNumber(x){

var doubledX = 2 * x;

return doubledX;

defining the function

13
New cards

What part of the function is bolded?

function start(){

var numApples = 4;

println("Before: " + numApples);

var twiceAsMany = doubleNumber(numApples);

println("After: " + twiceAsMany);

}

function doubleNumber(x){

var doubledX = 2 * x;

return doubledX;

function body

14
New cards

What part of the function is bolded?

function start(){

var numApples = 4;

println("Before: " + numApples);

var twiceAsMany = doubleNumber(numApples);

println("After: " + twiceAsMany);

}

function doubleNumber(x){

var doubledX = 2 * x;

return doubledX;

return value statement

15
New cards

What part of the function is bolded?

function start(){

var numApples = 4;

println("Before: " + numApples);

var twiceAsMany = doubleNumber(numApples);

println("After: " + twiceAsMany);

}

function doubleNumber(x){

var doubledX = 2 * x;

return doubledX;

parameter

16
New cards

syntatic validation

enforces correct syntax on structures fields

ex: 9 digits in SSN, date in correct form

17
New cards

semantic validation

enforces the correctness of the values in the specific business context

ex: start date is before end date

Explore top notes

Explore top flashcards

flashcards
Travel and leisure
112
Updated 325d ago
0.0(0)
flashcards
Module 11
65
Updated 727d ago
0.0(0)
flashcards
Lit - 4th Mid
24
Updated 1074d ago
0.0(0)
flashcards
Unit 3 vocab
20
Updated 1208d ago
0.0(0)
flashcards
Chemistry - Ions and molecules
57
Updated 400d ago
0.0(0)
flashcards
Prefix/Suffix
52
Updated 215d ago
0.0(0)
flashcards
Important Root Words
98
Updated 1117d ago
0.0(0)
flashcards
Travel and leisure
112
Updated 325d ago
0.0(0)
flashcards
Module 11
65
Updated 727d ago
0.0(0)
flashcards
Lit - 4th Mid
24
Updated 1074d ago
0.0(0)
flashcards
Unit 3 vocab
20
Updated 1208d ago
0.0(0)
flashcards
Chemistry - Ions and molecules
57
Updated 400d ago
0.0(0)
flashcards
Prefix/Suffix
52
Updated 215d ago
0.0(0)
flashcards
Important Root Words
98
Updated 1117d ago
0.0(0)