2.2.1 Programming fundamentals

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/14

encourage image

There's no tags or description

Looks like no tags are added yet.

15 Terms

1
New cards

What is a variable?

A value that stored in memory that can change while the program is running.

2
New cards

What is a constant?

A value that is assigned when the program is written and does not change while the program is running

3
New cards

What are advantages of using a constant?

  • The value only needs changing in one place, which avoids errors.

  • It makes the program easier to read


4
New cards

What is assignment?

Giving a variable or constant a value

5
New cards

What is casting?

Converting a variable from one data type to another

6
New cards

What are the three programming constructs?

Sequence, Selection, Iteration

7
New cards

What is sequence?

Instructions carried out in order, one after another.

<p><span>Instructions carried out </span><strong>in order</strong><span>, one after another.</span></p>
8
New cards

What is selection?

The program chooses which code to rundepending on a condition. For example if age >= 18 then … else … endif

<p><span>The program </span><strong>chooses which code to run</strong><span>depending on a condition. For example </span><code>if age &gt;= 18 then … else … endif</code></p>
9
New cards

What is iteration?

Repeating a section of code (a loop).

10
New cards

What are the two types of iteration?

count-controlled loop + condition controlled loop

11
New cards

What is count controlled iteration? Give an example

A loop that repeats a set number of times, known in advance. For example for i = 1 to 10

<p><span>A loop that repeats a </span><strong>set number of times</strong><span>, known in advance. For example </span><code>for i = 1 to 10</code></p>
12
New cards

What is condition controlled iteration? Give an example.

A loop that repeats until a condition is met, because the number of repeats isn't known in advance. For example while answer != "yes"

<p>A loop that repeats <strong>until a condition is met</strong>, because the number of repeats isn't known in advance. For example <code>while answer != "yes"</code></p>
13
New cards

What is the difference between a WHILE loop and a DO … UNTIL loop?

A WHILE loop checks its condition before the code runs, so it may run zero times. A DO … UNTIL loop checks its condition after, so the code always runs at least once.

14
New cards

What is a WHILE loop?

It repeats while a condition is true (until it is false), and the condition is checked before the code runs.

15
New cards