Develop code unit 2 Flashcards

(14 cards)

1
Q

What is the difference between an algorithm and a program?

A

An algorithm is a set of steps to solve a problem, while a program is the algorithm written in code to run on a computer.

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

What is pseudocode?

A

A structured, code-like way of writing an algorithm that’s easier to understand and less strict than real programming code.

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

What are the four basic data types?

A

Integer, Float/Real, Boolean, and Character.

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

What is an integer?

A

A whole number (e.g. 5, -12, 100).

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

What is a float/real?

A

A number with a decimal point (e.g. 3.14, -0.5).

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

What is a Boolean?

A

A data type that has only two values: True or False.

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

What is a character data type?

A

A single letter, digit, or symbol (e.g. ‘A’, ‘7’, ‘#’).

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

Why is selecting the correct data type important?

A

Because it determines what operations can be performed on that variable.

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

Do you have to declare data types in pseudocode?

A

No, but it’s a good habit to do so for clarity.

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

What are the structural components of a program?

A

Variable/type declarations, command sequences, selection, and iteration.

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

What is sequencing in a program?

A

Executing instructions one after the other in order.

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

What is selection in a program?

A

Using conditions to make decisions (e.g. IF…THEN…ELSE).

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

What is iteration in a program?

A

Repeating actions using loops like FOR, WHILE, or REPEAT.

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

Can an algorithm be written in both pseudocode and a high-level language?

A

Yes — it can be first written in pseudocode and then translated into actual code like Python, Java, etc.

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