AI Paper 2 Flashcards
(63 cards)
What does the Terminator symbol represent in a flowchart?
The ‘Start’ and ‘Stop’ of the process
What does the Process symbol represent in a flowchart?
Something being performed or done
What does the Input/Output symbol represent in a flowchart?
The input or output of something into or out of the flowchart
What does the Decision symbol represent in a flowchart?
A decision (Yes/No or True/False) resulting in two possible outcomes
What does the Subroutine symbol represent in a flowchart?
A subroutine call that relates to a separate, non-linked flowchart
What is the pseudocode for setting up a procedure to calculate area?
PROCEDURE calculate_area(length: INTEGER, width: INTEGER)
area ← length * width
OUTPUT “The area is “, area
END PROCEDURE
How do you call a procedure in pseudocode?
CALL calculate_area(5,3)
What is the pseudocode for setting up a function to calculate area?
FUNCTION calculate_area(length: INTEGER, width: INTEGER)
area ← length * width
RETURN area
ENDFUNCTION
How do you use a function in pseudocode?
OUTPUT(calculate_area(5,3))
What is the pseudocode for declaring a variable?
DECLARE Num: INTEGER
What is the pseudocode for declaring a constant?
CONSTANT Num: INTEGER
What is the pseudocode for an IF statement?
IF Answer ← “Yes” THEN
OUTPUT “Correct”
ELSE
OUTPUT “Incorrect”
ENDIF
What does the CASE statement do in pseudocode?
Filters actions based on input values
What is the pseudocode for a FOR loop?
FOR count ← 2 TO 10 STEP 2
OUTPUT “Hello!”
NEXT count
What is the pseudocode for a WHILE loop?
WHILE Colour != “Red” DO
INPUT Colour
ENDWHILE
What is the pseudocode for a REPEAT…UNTIL loop?
REPEAT
INPUT Colour
UNTIL Colour ← “Red”
What is the pseudocode for totalling?
FOR count ← 1 to 10
INPUT Num
TOTAL ← TOTAL + Num
NEXT count
What is the pseudocode for counting?
FOR index ← 1 to 10
INPUT Num
IF Num > 5 THEN
Count ← Count + 1
ENDIF
NEXT index
What is the pseudocode for string handling to find length?
String ← “Hello World!”
OUTPUT LENGTH(String)
What is the pseudocode for substring handling?
Words ← “Hello World!”
OUTPUT SUBSTRING(Words, 1, 3)
What is the pseudocode for converting a string to uppercase?
String ← “Hello World!”
OUTPUT UCASE(String)
What is the pseudocode for converting a string to lowercase?
String ← “Hello World!”
OUTPUT LCASE(String)
What does the MOD function do?
Returns the remainder of a division
What does the DIV function do?
Returns the quotient of a division