Programming (Paper 2) Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What are the data types?

A

-INTEGER
-REAL
-CHAR
-STRING
-BOOLEAN

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

What is a variable?

A

A data item held in memory which may change value during the program execution

-It is referred to by its identifier

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

What is an INTEGER?

A

A whole number

Example = 5,10,57,18

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

What is REAL?

A

A number with a decimal point

Example = 1.4, 3.15, 56.0

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

What is CHAR?

A

A single character enclosed in single quotes

Example = ‘A’, ‘+’, ‘1’, ‘@’

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

What is STRING?

A

Zero or more characters enclosed in double quotes

Example = “Yes”, “Hello”, “Marcus”

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

What is BOOLEAN?

A

The logical values TRUE or FALSE

Example = TRUE, FALSE

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

What is a constant?

A

A value that cannot change during the execution of the program

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

How would you write an input output statement in pseudocode?

A

OUTPUT “….”
INPUT ….

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

What are the arithmetic operators and what do they mean?

A

+ = addition

minus symbol = subtraction

/ = division

astrix = multiplication

^ = to the power of

MOD = remainder

=DIV = Quotient

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

What are the logical operators and what do they mean?

A

= = equals

<= less than

<= = less than or equal to

> = greater than

=> = greater than or equal to

<> = not equal to

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

What is a sequence statement?

A

Two or more statements written and executed one after the other in sequence

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

What is a selection statement?

A

A selection statement comprises an IF or CASE statement and a logical expression

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

What do selection statements contain?

A

IF
THEN
ENDIF
IF
THEN
ELSE
ENDIF

or

CASE OF
OTHERWISE
ENDCASE

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

Write a nested if statement

A

Check textbook

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

Write a case statement

A

Check textbook

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

What is an iteration statement?

A

Iteration means repetition and iteration statements comprise of FOR loops or Count controlled loops

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

Write a count controlled loop

A

Check textbook

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

Write a for (count) loop

A

Check textbook

20
Q

Write a NESTED for loop

A

Check textbook`

21
Q

What are examples of condition controlled loops?

A

WHILE
DO
ENDWHILE

or

REPEAT UNTIL

22
Q

Write a while loop

A

Check textbook

23
Q

Write a repeat until loop

A

Check textbook

24
Q

What are examples of string operations?

A

LENGTH()
LCASE()
UCASE()
SUBSTRING()

25
Q

Write an example of a length operation

A

Check textbook

26
Q

What will a length operation return?

A

The number of letters in a string (Including spaces)

27
Q

What will the LCASE operation return?

A

The string in all lowercase letters

28
Q

What will the UCASE operation return?

A

The string in all uppercase letters

29
Q

What will the SUBSTRING operation return?

A

The letters from certain values

(Check textbook if unsure)

30
Q

Write a procedure

A

Check textbook

31
Q

What is a procedure?

A

A procedure is a named block of code separate from the main program which can be called and executed

32
Q

What is a function?

A

Another type of subroutine
It returns a value specified in the statement which calls it

33
Q

Write a procedure

A

Check textbook

34
Q

Write a function

A

Check textbook

35
Q

Write a min algorithm

A

Check textbook

36
Q

Write a totaling algorithm

A

Check textbook

37
Q

Write a max algorithm

A

Check textbook

38
Q

What is a local variable?

A

One that is ONLY contained in a procedure and cannot be accessed in the main program

39
Q

What is a global variable?

A

One that is used in the main program

40
Q

What are things you must do when creating a program?

A

-Use sensible identifiers
-ADD COMMENTS

41
Q

Write an array

A

Check textbook

42
Q

Write a 2D array?

A

Check textbook

43
Q

What is a record in a text file?

A

The lines (rows)

44
Q

What is a field in a text file?

A

The text (columns)

45
Q

Write a program that opens, writes and reads a textfile

A

Check textbook

46
Q

Write a program that opens, writes and closes a textfile

A

Check textbook