1/26
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
how would you store a 1d array
DECALRE <identifier> : ARRAY (<lowerbound> TO <upper bound>) OF <dataype>
would you you declare the array as name, there are 10 names
DECLARE names : ARRAY (1 TO 10) OF STRING
how would you assign the name array as Ethan for the first item in the array
name[1] ←- Ethan
define arrays
fixed length structure of elements that have identical data type.
how would you declare a 2d array
DECLARE <identifier> : ARRAY [<l1>:<u1> , <l2>:<u2>] OF <data type>
what does 1d and 2d arrays indicate
1d arrays indicate number of rows
2d arrays indicate number of columns
how would you make the string all in lower case
LCASE (<identifier>)
how would you make the string all in upper case
UCASE (<identifier>)
how would you calculate the length of the string
LENGTH(<identifier>)
how would you write a substring
SUBSTRING (<identifier>, <start>, <length>)
examples SUBSTRING (“Taylor swift”, 1 6) returns Taylor
how would you round a value
ROUND (<identifier>, place)
examples ROUND (5.5, 0) returns 6
define procedure
reusable block of instructions that perform a specific task, it can be called multiple times of the programs
how would you write a procedure
PROCEDURE <identifier>
d <statements>
ENDPROCEDURE
examples
PROCEDURE DisplayMenu ()
d OUTPUT “1.Add item”
d. OUTPUT “2.delete item”
d OUTPUT “3.view items”
d OUTPUT “4.exit”
ENDPROCEDURE
CALL Display menu()
how would you call a procedure
CALL <identifier>
define paramaters
variables that pass on information into a procedure or function
how would you write out a procedure
PROCEDURE <identifier> (<para1>:<datatype>, <para2>:<datatype>)
d <statement>
ENDPROCEDURE
define functions
functions operate similarly to producers but they return a value
how would you write a function
FUNCTION <identifier> RETURNS <datatype>
d <statement>
ENDFUNCTION
how would you write a parameter in a function
FUNCTION <identifier> (<para1>:<datatype> , <para2>:<datatype>) RETURNS <datatype>
d <statement>
ENDFUNCTION
how would you open a file
OPEN <file identifier> FOR <file mode>
what are the types of file modes
READ
WRITE
define READ file mode
data is read from the file
define WRITE file mode
data is written to the file
How would you close a file
CLOSEFILE <file identifier>
how would you make a file to be read
READFILE <file identifier>, <variable>
how would you make a file to be written
WRITEFILE <file identifier>, <variable>
there are two files, FileA.text and FileB.text. How would you copy a line from FileA.text to FileB.text
DECLARE Lineoftext : STRING
OPENFILE “FileA.text” FOR READ
OPENFILE “FileB.text” FOR WRITE
READFILE “FileA.text”, Lineoftext
WRITE FILE “FileB.text”, lineoftext
CLOSEFILE “FileA.text”
CLOSEFILE “File.text”