23-24 Computer Science Principles Unit 4: Understanding Variables, Conditionals, and Functions

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/41

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.

42 Terms

1
New cards

Expression

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

2
New cards

Assignment Operator

allows a program to change the value represented by a variable

3
New cards

Variable

a named reference to a value that can be used repeatedly throughout a program.

4
New cards

Boolean Value

a data type that is either true or false.

5
New cards

Comparison Operators

<, >, <=, >=, ==, != indicate a Boolean expression

6
New cards

Function

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

7
New cards

Function Call

a command that executes the code within a function

8
New cards

Arithmetic operator

part of most programming languages and include addition, subtraction, multiplication, division, and modulus operators.

9
New cards

Boolean Expression

evaluates to either true or false

10
New cards

Concatenation

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

11
New cards

Conditional Statement

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

12
New cards

Evaluate

Expressions are evaluated to produce a single value.

13
New cards

Expression

a programming statement that can consist of a value, a variable, an operator, or a procedure call that returns a value.

14
New cards

Logical operator

NOT, AND, and OR, which evaluate to a Boolean value.

15
New cards

Procedure/Function/Method

a named group of programming instructions that may have parameters and return values.

16
New cards

Comparison (Relational) operator

used to test the relationship between two variables, expressions, or values. A comparison using a relational operator evaluates to a Boolean value. For example: =, ≠, >, <, ≥, and ≤

17
New cards

Selection

determines which parts of an algorithm are executed based on a condition being true or false

18
New cards

String

an ordered sequence of characters.

19
New cards

console.log

prints a result in the console

20
New cards

\n

the new line character

21
New cards

getNumber()

gets a number from a user input that can be used mathematically

22
New cards

var name = "Sonja" ;

declares and assigns an initial value to a variable.

23
New cards

x = 5;

assigns a value to a previously declared variable.

24
New cards

setScreen(screenId)

sets the screen to the given screenId.

25
New cards

if statement

checks if one boolean expression is true. If it is, a piece of code is run. Otherwise the code runs as normally.

26
New cards

if else statement

checks if one boolean expression is true and adds the functionality that if the condition is false it can still run some code before returning to running the program as normal.

27
New cards

if else if statement

checks more than one boolean expression. They will only run the code for the first boolean expression that evaluates to true.

28
New cards

Syntax Error

Your code doesn't follow the rules of the programming language. Writing a variable name in quotes. Using a variable that doesn't exist

29
New cards

Logic Error

Your code follows the rules of the programming language but doesn't do what you intend. Writing if-else-if statements in the wrong order. Updating the property of the wrong element.

30
New cards

Run Time Error

a mistake in the program that shows when running the program.

31
New cards

Overflow Error

an error that occurs when a computer tries to handle a number outside of the defined range of values.

32
New cards

Truth table

used to evaluate the reduced Boolean expression to a single Boolean value.

33
New cards

Creating a variable

Use var only once. You don't need to create variables twice and this can cause errors. Create your variables at the top of your program. This keeps your code organized and easier to read for you and others. Create your variables outside any function or onEvent() blocks.

34
New cards

Debugging Skills/Strategies

Use console.log to get output. Slow down code with the speed slider. Use Watchers to see your variables change values

35
New cards

onEvent

a handler for those UI elements that need user interaction.

36
New cards

Math.round

returns the number rounded to the nearest integer.

37
New cards

getText()

gets the string of text that is found in the element with the given id.

38
New cards

playSound

plays the MP3 sound file from the specified URL.

39
New cards

setText()

sets the text for the specified screen element.

40
New cards

setProperty()

lets your app change any property listed in Design mode for a given UI element

41
New cards

Watchers

will help you track the value of the variable as it changes.

42
New cards

variables

an contain or hold a single value at all times