paper 2 theory part: Flashcards

1
Q

How should variables and constans be used in a program?

A

have meaningful identifiers so future programmers understand their purpose

both used for data storage

constants store values that never change during the execution of a program

variables contain values that can change during the execution of the program

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

Explain why a programmer would use procedures writing a program.

A

store a collection of programming statements under a single identifier

to allow procedures to be re-used within the program

to make program creation faster

to make programs shorter with less duplicated code

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

Explain why a programmer would use parameters writing a program.

A

to pass values from the main program to a procedure / function to be used in the procedure/ function

allow the procedure / function to be re-used with different data.

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

Describe what happens when a function is called during the execution of a program.

A

A call statement is used, the function is called using its identifier

Parameters may be passed from the main program to the function to be used within the function

The function performs its task

returns a value to the main program

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

Explain why verification checks are used when data is input.

A

To ensure that data has been accurately copied

from one source to another

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

Purpose of test data

A
  • check that the program works as expected
  • check for logic errors
  • check that the program rejects any invalid data that is input
  • check that the program only accepts reasonable data
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

One dimensional array

A

one column of items
of the same data type
stored under a single identifier
with a single index to identify each element

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

purpose on indexing to search for value in array

A
  • using a counter to index the array
  • to check every element in the array using loop
How well did you know this?
1
Not at all
2
3
4
5
Perfectly