Unit 4- Variables Conditionals, and Functions Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Expression:

A

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

Alternate Definition:

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What do expressions always do?

A

Evaluate/return to a single value!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What symbol is an assignment operator?

A

=

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Assignment operator definition

A

allows a program to change the value represented by a variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Arithmetic operator:

A

part of most programming languages and include addition, subtraction, multiplication,
division, and modulus operators (Which we haven’t learned yet)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Variable:

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Boolean Value:

A

a data type that is either true or false.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Comparison Operators:

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Function (Procedure)

A

a named group of programming instructions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
  • Function Call
A

a command that executes the code within a function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Boolean Expression:

A

evaluates to either true or false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Concatenation:

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Conditional Statement:

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Evaluate:

A

Expressions are evaluated to produce a single value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Logical operator:

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Relational operator:

A

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 ≤
-THE SAME AS A COMPARISON OPERATOR

17
Q

Selection:

A

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

18
Q

String:

A

an ordered sequence of characters.

19
Q

What does getText/getNumber do?

A

Usually used in an onevent, gets input data from a specified UI element

20
Q

What does a concatenation operator do?

A

Combines multiple strings into one

21
Q

What does a \n new line operator do?

A

creates a new line of text

22
Q

what is an assignment operator

A

(=) Gets the value of a variable, and changes the value of a variable in a program

23
Q

Comparision operator

A

evaluates whether an expression setting 2 variales equal to each other is true or false (boolean, ==)

24
Q

What is an if-else statement?

A

a conditional garunteed exactly 1 of 2 instructions of code will execute

25
Q

What is an if-statement?

A

A conditional that will execute its code if and only if the expression is true. otherwise, the entire section of code is skipped.

26
Q

What is a nested if statement?

A

AP pseudo code for if- else-if

27
Q

What does it mean to assign a variable

A

-giving a variable an initial value using an assignment operator

28
Q

What also means to assign a variable?

A

-initializing a variable

29
Q

What does it mean to declare a variable

A

-creating a variable ALWAYS using var, which is only used for declaring variables

30
Q

What also means to declare a variable?

A

defining a variable

31
Q

What does calling a variable mean?

A

-referencing/using a variable in a program statement

32
Q

What is variable reassignment

A

Giving a variable a new value after it’s been assigned one.

33
Q

What happens if a variable is defined/declared in a function

A

It is local, so it does not leave the function. Therefore, it cannot be used in code, and the function will cause an error, or it will be skipped altogether.