Chapter 13: Pseudocode Flashcards
1
Q
Declaration of variables
A
- DECLARE Number1: INTEGER
* DECLARE YourName: STRING
2
Q
Declaration and assignment of constants
A
•CONSTANT PI=3.14
3
Q
Assignment of variables
A
•A
4
Q
Arithmetic operators
A
• + | - | * | / | ^ | DIV | MOD
5
Q
Outputting information
A
•OUTPUT “Hello” , YourName “ . YourNumber is “, Number1
6
Q
Getting input from the user
A
•INPUT “Prompt: “ A
7
Q
Data types
A
- INTEGER
- REAL
- CHAR
- STRING
- BOOLEAN
- DATE
- CURRENCY
- ARRAY
8
Q
Boolean expressions
A
- =
- <>
- >
- <
- > =
- <=
- AND | NOT | OR
9
Q
Selection statements
A
IF x<0 THEN OUTPUT “Negative” ELSE IF x=0 THEN OUTPUT “Zero” ELSE OUTPUT “Positive” ENDIF ENDIF
10
Q
CASE statements
A
CASE of Grade “A”: OUTPUT “Top grade” “F” , “U”: OUTPUT “Fail” “B” ... “E”: OUTPUT “Pass” OTHERWISE OUTPUT “Invalid grade” ENDCASE
11
Q
Count-controlled loops
A
FOR i
12
Q
Post-condition loops
A
REPEAT
INPUT “Enter Y or N: “ Answer
UNTIL Answer=“Y”
13
Q
Pre-condition loops
A
Answer “Y”
INPUT “Enter Y or N: “ Answer
ENDWHILE
14
Q
Creating 1D arrays
A
- DECLARE List1: ARRAY [1:3] OF STRING
* DECLARE List2: ARRAY [0:5] OF INTEGER
15
Q
Accessing 1D arrays
A
- NList[25]=0
* AList[3]=“D”