Software - Contructs Flashcards

1
Q

Pre-defined function for returning a number of characters from the left hand side of a string
Example the first 4 letters of “Harrison”

A

left(“Harrison”,4)

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

Pre-defined function for returning a number of characters from the right hand side of a string
Example the last 6 letters of “The Burrow”

A

right(“The Burrow”,6)

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

Pre-defined function for returning a number of characters from a specified position in a string
Example extract “Burrow” out of “The Burrow, Waterheads”

A

=mid(“The Burrow, Waterheads”,5,6)

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

Returns an integer, no decimal places

A

INT

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

Converts from a decimal integer to its ASCII equivalent

Example 65

A

Chr(“65”)

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

Converts from ASCII to a decimal integer t

Example A

A

Asc(“A”)

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

Returns the remainder after a number is divided by a divisor

Example 18 divided by 5 has a remainder of 3

A

18 MOD 5

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

Open / Create a file

A

OPEN Filename

CREATE Filename

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

Close a file

A

CLOSE Filename

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

Input items of data in a file and into main memory (Read)

A
(example reads a file into an array with 10 elements)
OPEN Filename
FOR Count FROM 0 to 9 DO
     RECEIVE Array(count) FROM Filename
END FOR
CLOSE Filename
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Output items of data in main memory to a file (Write)

A
(example writes the items in an array with 20 elements to a file)
OPEN FILENAME
FOR Count FROM 0 TO 19 DO
     SEND Array(Count) to Filename
END FOR
CLOSE Filename
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

The details of exam marks for 20 students are loaded from a csv file named Exam_Marks. Each Line contains a student name and a mark, eg Harrison, 100
Write a programme to input all 20 lines

A

DECLARE Student[19] AS ARRAY OF STRING
DECLARE Mark[19] AS ARRAY OF INTEGER
Open Exam_Marks
FOR Line FROM 0 to 19 DO
FOR EACH Comma Separated Item in Line
SET Student[Line] TO Comma Separated Item
SET Mark[Line} TO Comma Separated Item
NEXT FOR EACH
NEXT FOR
CLOSE Exam_Marks

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