Chapter 13: Pseudocode Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Declaration of variables

A
  • DECLARE Number1: INTEGER

* DECLARE YourName: STRING

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

Declaration and assignment of constants

A

•CONSTANT PI=3.14

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

Assignment of variables

A

•A

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

Arithmetic operators

A

• + | - | * | / | ^ | DIV | MOD

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

Outputting information

A

•OUTPUT “Hello” , YourName “ . YourNumber is “, Number1

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

Getting input from the user

A

•INPUT “Prompt: “ A

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

Data types

A
  • INTEGER
  • REAL
  • CHAR
  • STRING
  • BOOLEAN
  • DATE
  • CURRENCY
  • ARRAY
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Boolean expressions

A
  • =
  • <>
  • >
  • <
  • > =
  • <=
  • AND | NOT | OR
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Selection statements

A
IF x<0
  THEN
    OUTPUT “Negative”
  ELSE
    IF x=0
      THEN
        OUTPUT “Zero”
      ELSE
        OUTPUT “Positive”
    ENDIF
ENDIF
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Count-controlled loops

A

FOR i

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

Post-condition loops

A

REPEAT
INPUT “Enter Y or N: “ Answer
UNTIL Answer=“Y”

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

Pre-condition loops

A

Answer “Y”
INPUT “Enter Y or N: “ Answer
ENDWHILE

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

Creating 1D arrays

A
  • DECLARE List1: ARRAY [1:3] OF STRING

* DECLARE List2: ARRAY [0:5] OF INTEGER

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

Accessing 1D arrays

A
  • NList[25]=0

* AList[3]=“D”

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

Creating 2D arrays

A

Board [1:6 , 1:7] OF INTEGER

17
Q

Accessing 2D arrays

A

Board [3,4]=0

18
Q

Built-in functions

A
  • ThisString[P]
  • CHAR(i)
  • ASCII(ch)
  • LENGTH(s)
  • LEFT(S,L)
  • RIGHT(S,L)
  • MID(S,P,L)
  • CONCAT(S1,S2)
19
Q

Witing a text file

A

OPENFILE Text FOR WRITE
WRITEFILE Text, FileData
CLOSEFILE

20
Q

Reading from a text file

A

OPENFILE Text FOR READ
READFILE Text, FileData
CLOSEFILE

21
Q

Appending to a text file

A

OPENFILE Text FOR APPEND
WRITEFILE Text, FileData
CLOSEFILE

22
Q

EoF marker

A
OPENFILE Text FOR READ
WHILE NOT EOF(Text)
  READFILE Text , TextString
  OUTPUT TextString
ENDWHILE
CLOSEFILE Text