1.2.4 Types Of Programming Languages Flashcards
What is assembly language?
Assembly language is the next level up from machine code and is part of a family of low level languages. This is converted to machine code using an assembler when it is executed.
Why is assembly langauage eaiser to use than direct machine code?
Assembly language uses mnemonics rather than binary, which makes it easier to use than direct machine code.
ADD
Add the value at the given memory address to the value in the Accumulator
SUB
Subtract the value at the given memory address from the value in the Accumulator
STA
Store the value in the Accumulator at the given memory address
LDA
Load the value at the given memory address into the Accumulator
INP
Allows the user to input a value which will be held in the Accumulator
OUT
Prints the value currently held in the Accumulator
HLT
Stops the program at that line, preventing the rest of the code from executing.
DAT
Creates a variable with a label at which data is stored.
BRZ
Branches to a given address if the value in the Accumulator is zero. This is a conditional branch.
BRP
Branches to a given address if the value in the Accumulator is positive. This is a conditional branch.
How do you open a file called sample and read a line from it in pseudocode?
myFile = openRead(“sample.txt”)
line = myFile.readline()
myFile.close()
How do you print every line of a text file called sample in psuedocode?
myFile = openRead(“sample.txt”)
while NOT myFile.endOfFile()
|||print(myFile.readLine()
endwhile
myFile.close
How do you write “Hello World” to a file called sample in psuedocode?
myFile = openWrite(“sample.txt”)
myFile.writeLine(“Hello world”)
myFile.close()
How do you create a new file called sample in pseudocode?
newFile(“sample.txt”)
What are the 6 functions you can perform on a file?
open(…)
.close()
.readLine()
.writeLine(…)
.endOfFile()
newFile()