Chapter 3 Flashcards Preview

AP Computer Science > Chapter 3 > Flashcards

Flashcards in Chapter 3 Deck (34)
Loading flashcards...
1
Q

the if(condition) must be

A

a boolean, true or false

2
Q

If the condition is true

A

the statement is executed, if not skipped

3
Q

==

A

equals

4
Q

!=

A

does not equal

5
Q

<=

A

less than or equal to

6
Q

> =

A

greater than or equal to

7
Q

else is similar to

A

otherwise

8
Q

Without braces

A

only one statement can follow the if statement

9
Q

a && b

A

if both a and b are true, executes

10
Q

a || b

A

If either a or b are true, executes

11
Q

!a

A

executes if a is false

12
Q

&& and || are

A

binary operators

13
Q

order of logical precedence

A

NOT over AND and OR

14
Q

De Morgan’s theorem

A

When the not (!) is distributed to the variable in the parentheses

15
Q

short circuiting

A

when the left operand of an “&&” statement or “||” is true, other part is not evaluated

16
Q

How to compare strings

A

“equals method” and

“compareTo”

17
Q

lexicographic ordering

A

Compares characters and Strings based on a character set

alphabetical order, and short strings with same prefix as long go first

“book” before “bookcase”

18
Q

increment operator ++

A

adds one to its operand

19
Q

decrement operator –

A

subtracts one from its operand

20
Q

num += count is equal to

A

num = num + count;

21
Q

num -= count is equal to

A

num = num- count

22
Q

num *= count is equal to

A

x = x*y

23
Q

num /= count is equal to

A

x = x/y

24
Q

num %= count is equal to

A

x = x%y

25
Q

can add up

A

assignment operators

26
Q

repetition statements

A

while and for loops

27
Q

If a while loop does not eventually make the condition false

A

it is an infinite loop

28
Q

for loops execute a specific number of times

A

yes

29
Q

how to establish for loop

A

for(initialize; condition; increment)

30
Q

algorithm

A

step by step process for solving a problem

31
Q

psuedo code

A

helps to solve algorithm, mix of English and code

32
Q

top-down development

A

starts at top, priority code, and goes down

33
Q

regression testing

A

running programs over and over to find problem

34
Q

flow of control

A

program runs from one line to the next until program is complete