Programming (Paper 2) Flashcards
What are the data types?
-INTEGER
-REAL
-CHAR
-STRING
-BOOLEAN
What is a variable?
A data item held in memory which may change value during the program execution
-It is referred to by its identifier
What is an INTEGER?
A whole number
Example = 5,10,57,18
What is REAL?
A number with a decimal point
Example = 1.4, 3.15, 56.0
What is CHAR?
A single character enclosed in single quotes
Example = ‘A’, ‘+’, ‘1’, ‘@’
What is STRING?
Zero or more characters enclosed in double quotes
Example = “Yes”, “Hello”, “Marcus”
What is BOOLEAN?
The logical values TRUE or FALSE
Example = TRUE, FALSE
What is a constant?
A value that cannot change during the execution of the program
How would you write an input output statement in pseudocode?
OUTPUT “….”
INPUT ….
What are the arithmetic operators and what do they mean?
+ = addition
minus symbol = subtraction
/ = division
astrix = multiplication
^ = to the power of
MOD = remainder
=DIV = Quotient
What are the logical operators and what do they mean?
= = equals
<= less than
<= = less than or equal to
> = greater than
=> = greater than or equal to
<> = not equal to
What is a sequence statement?
Two or more statements written and executed one after the other in sequence
What is a selection statement?
A selection statement comprises an IF or CASE statement and a logical expression
What do selection statements contain?
IF
THEN
ENDIF
IF
THEN
ELSE
ENDIF
or
CASE OF
OTHERWISE
ENDCASE
Write a nested if statement
Check textbook
Write a case statement
Check textbook
What is an iteration statement?
Iteration means repetition and iteration statements comprise of FOR loops or Count controlled loops
Write a count controlled loop
Check textbook
Write a for (count) loop
Check textbook
Write a NESTED for loop
Check textbook
What are examples of condition controlled loops?
WHILE
DO
ENDWHILE
or
REPEAT UNTIL
Write a while loop
Check textbook
Write a repeat until loop
Check textbook
What are examples of string operations?
LENGTH()
LCASE()
UCASE()
SUBSTRING()
Write an example of a length operation
Check textbook
What will a length operation return?
The number of letters in a string (Including spaces)
What will the LCASE operation return?
The string in all lowercase letters
What will the UCASE operation return?
The string in all uppercase letters
What will the SUBSTRING operation return?
The letters from certain values
(Check textbook if unsure)
Write a procedure
Check textbook
What is a procedure?
A procedure is a named block of code separate from the main program which can be called and executed
What is a function?
Another type of subroutine
It returns a value specified in the statement which calls it
Write a procedure
Check textbook
Write a function
Check textbook
Write a min algorithm
Check textbook
Write a totaling algorithm
Check textbook
Write a max algorithm
Check textbook
What is a local variable?
One that is ONLY contained in a procedure and cannot be accessed in the main program
What is a global variable?
One that is used in the main program
What are things you must do when creating a program?
-Use sensible identifiers
-ADD COMMENTS
Write an array
Check textbook
Write a 2D array?
Check textbook
What is a record in a text file?
The lines (rows)
What is a field in a text file?
The text (columns)
Write a program that opens, writes and reads a textfile
Check textbook
Write a program that opens, writes and closes a textfile
Check textbook
Write a min algorithm
Check textbook
Write a max algorithm
Check textbook
Write totaling code
Check textbook
Write averaging code
Check textbook
Write a procedure to validate data
Check textbook
Write a procedure to allow the user to input values into an array
Check textbook