Software Development Flashcards

1
Q

What is an example of a record structure

A

Public Structure ‘Example’
Dim value1 as integer
Dim value2 as integer

end structure

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

What is an example of a Parallel 1D array

A

Dim record(10) as example

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

What is ab example of declaring a 2D array

A

Dim my2Darray(8, 5) As Integer

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

What is the Insertion Sort algorithm?

A
PROCEDURE insertion_sort(list)
DECLARE value INITIALLY 0
DECLARE index INITIALLY 0
FOR i = 1 to length(list)-1 DO
SET value TO array[i]
SET index TO i
WHILE (index > 0) AND (value < list[index-1]) DO
SET list[index] TO list[index-1]
SET index TO index - 1
END WHILE
SET list[index] TO value
END FOR
END PROCEDURE
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the Bubble Sort algorithm?

A
PROCEDURE bubble_sort(list)
DECLARE n INITIALLY length(list)
DECLARE swapped INITIALLY TRUE
WHILE swapped AND n >= 0
SET swapped TO False
FOR i = 0 to n-2 DO
IF list[i] > list[i+1] THEN
SET temp TO list[i]
SET list[i] TO list[i+1]
SET list[i+1] TO temp
SET swapped TO TRUE
END IF
END FOR
SET n TO n - 1
END WHILE
END PROCEDURE
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the Binary Search algorithm?

A
PROCEDURE binary_search(list,target)
DECLARE low INITIALLY 0
DECLARE high INITIALLY length(list)-1
DECLARE mid INITIALLY 0
DECLARE found INITIALLY FALSE
WHILE NOT found AND low <= high
SET mid TO (low+high)/2
IF target = list[mid] THEN
SEND "Found at position"&mid TO DISPLAY
SET found TO TRUE
ELSE IF target > list[mid] THEN
SET low TO mid+1
ELSE
SET high TO mid–1
END IF
END WHILE
IF found = FALSE THEN
SEND "Target not found" TO DISPLAY
END IF
END PROCEDURE
How well did you know this?
1
Not at all
2
3
4
5
Perfectly