AP CompSci Unit 4

0.0(0)
studied byStudied by 1 person
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/16

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

17 Terms

1
New cards

Expression:

a combination of operators and values that evaluates to a single value

2
New cards

Variable

holds one value at a time. A reference to a value (or value that results from evaluating an expression) that can be used repeatedly throughout a program

  • Creating variables

    • Create them once (use var once)

    • Put them at the top

    • Create outside functions or onEvents

3
New cards

Global vs. Local Variables:

  • Global

    • Permanent. Can be used anywhere in your code (var is outside onEvent)

  • Local

    • Temporary. Can be used only in the part of the code where it was created, deleted once code is done running (var inside onEvent)

4
New cards

Assignment Operator:

allows a program to change the value represented by a variable (<-- or =)

5
New cards

Debugging

The process of finding and fixing problems in a code

  • Describe the problem

    • What do you expect it to do?

    • What does it actually do?

    • Does it always happen?

  • Hunt for bugs

    • Are there any warnings or errors?

    • What did you change most recently?

  • Try solutions

    • Make a small change

  • Document as you go

    • What have you learned?

    • What strategies did you use?

    • What questions do you have?

6
New cards

Error Types:

  • Syntax Error

    • Your code doesn’t follow the rules of the programming language

      • Name not in quotes, using variable that doesn’t exist…

  • Logical Error

    • Your code follows the rules of the programming language but doesn’t do what you intend

      • If-else statements in wrong order, updating wrong property…

7
New cards

Information can be stored as…

  • Numbers (no quotes)

  • Strings (quotes)

8
New cards

Boolean Expression:

 evaluates to true or false

9
New cards


Boolean Value

True or false

10
New cards

Comparison Operators:

<, >, ==, <=, >=, !=

11
New cards

Logical Operators

&&, ||, ! 

12
New cards

Operator

+, -, x, /

13
New cards

Truth Tables

  • && (and)

    • True &&  True = True

    • True && False = False

    • False && True = False

    • False && False = False

  • || (or)

    • True || True = True

    • True || False = True

    • False || True = True

    • False || False = False

  • ! (not)

    • ! True = False

    • ! False = True

14
New cards

onEvent

used when “when” is used. When the user does something

15
New cards

Conditional Statement:

used if “if” is used. Happens if a boolean expression evaluates to true

16
New cards

Function

a named group of programming instructions. Also referred as a procedure

  • Function updateButton( ) { → 

     setProperty(

     setProperty(

     setProperty(

}

17
New cards

Function Call:

a command that executes the code within a function

  • updateButton( ); →