7. Programming (3) Flashcards

1
Q

Is button bounce an issue for a light switch?

A

No, the light will just light up or not and bounce won’t effect the overall result.

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

When would button bounce be an issue?

A

When the button is used for setting a program on a system. At each press the machine toggles to the next available program. Button bounce will be an issue because we don’t want the system advancing a random number of programs each time the button is pressed.

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

What does a rounded rectangle mean?

A

Beginning or end of a process

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

What does a rectangle mean?

A

A generic program step

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

What does a parallelogram represent?

A

An input/output

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

What does a diamond mean?

A

A decision. This will have two arrows coming from it: one for yes and one for no.

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

What does a rectangle with double vertical edges represent?

A

Subroutines

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

What do arrows show?

A

Direction of flow

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

What are the steps towards writing a program?

A
  1. Establish/write down the requirements
  2. Use a flowchart to show how the requirements can be met
  3. Then you are ready to start writing code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is an initialization block?

A

The beginning of the flow chart: start -> set initial states

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

What is the main loop?

A

The main loop is where all of the main requirements are met

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

How is a decision step written in C?

A
Using the if statement:
if(condition)
{ 
// things to do if true
}
else
{
// things to do if false
} 
Where the 'else' part is optional.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does == do?

A

tests for equality

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

what does != do?

A

tests for inequality

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

what does > do?

A

tests for greater than

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

what does >= do?

A

tests for greater than or equal to

17
Q

what does

A

tests for less than

18
Q

what does

A

tests for less than or equal to

19
Q

what does if (buttonstate) do?

A

true if buttonstate is non-zero, fales if butonstate is zero

20
Q

What is the scope of a variable in a C program>

A

Scope describes where the variable can be seen and cannot be seen.

21
Q

What is file scope?

A

A variable defined at the top of the file has file scope, and can be seen and used by any function in the program. For a single file program such as we will be writing, file scope == global scope.

22
Q

What is a variable with global scope called?

A

A global variable

23
Q

What is function scope?

A

A variable defined within a function can only be seen within that function. Another function cannot make use of this variable. Generally a good thing, can sometimes be a nuisance.