pseudocode 1D/2D array, procedures, functions, files, strings, rounding

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/26

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 5:01 PM on 4/20/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

27 Terms

1
New cards

how would you store a 1d array

DECALRE <identifier> : ARRAY (<lowerbound> TO <upper bound>) OF <dataype>

2
New cards

would you you declare the array as name, there are 10 names

DECLARE names : ARRAY (1 TO 10) OF STRING

3
New cards

how would you assign the name array as Ethan for the first item in the array

name[1] ←- Ethan

4
New cards

define arrays

fixed length structure of elements that have identical data type.

5
New cards

how would you declare a 2d array

DECLARE <identifier> : ARRAY [<l1>:<u1> , <l2>:<u2>] OF <data type>

6
New cards

what does 1d and 2d arrays indicate

1d arrays indicate number of rows

2d arrays indicate number of columns

7
New cards

how would you make the string all in lower case

LCASE (<identifier>)

8
New cards

how would you make the string all in upper case

UCASE (<identifier>)

9
New cards

how would you calculate the length of the string

LENGTH(<identifier>)

10
New cards

how would you write a substring

SUBSTRING (<identifier>, <start>, <length>)

examples SUBSTRING (“Taylor swift”, 1 6) returns Taylor

11
New cards

how would you round a value

ROUND (<identifier>, place)

examples ROUND (5.5, 0) returns 6

12
New cards

define procedure

reusable block of instructions that perform a specific task, it can be called multiple times of the programs

13
New cards

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()

14
New cards

how would you call a procedure

CALL <identifier>

15
New cards

define paramaters

variables that pass on information into a procedure or function

16
New cards

how would you write out a procedure

PROCEDURE <identifier> (<para1>:<datatype>, <para2>:<datatype>)

d <statement>

ENDPROCEDURE

17
New cards

define functions

functions operate similarly to producers but they return a value

18
New cards

how would you write a function

FUNCTION <identifier> RETURNS <datatype>

d <statement>

ENDFUNCTION

19
New cards

how would you write a parameter in a function

FUNCTION <identifier> (<para1>:<datatype> , <para2>:<datatype>) RETURNS <datatype>

d <statement>

ENDFUNCTION

20
New cards

how would you open a file

OPEN <file identifier> FOR <file mode>

21
New cards

what are the types of file modes

READ

WRITE

22
New cards

define READ file mode

data is read from the file

23
New cards

define WRITE file mode

data is written to the file

24
New cards

How would you close a file

CLOSEFILE <file identifier>

25
New cards

how would you make a file to be read

READFILE <file identifier>, <variable>

26
New cards

how would you make a file to be written

WRITEFILE <file identifier>, <variable>

27
New cards

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”