Preview

08 - Final Test

 1. What is a possible reason for the fact that most computer programs are written in low level languages?
finaltest_programminglanguages_q1.png

  Because low level languages are much easier to understand (from a coder's perspective)

  Because low level languages are much quicker and have larger, more complex files

  Trick question! Most computer programs are written in high level languages as they are easier to understand/work with

  Because the first programs were low level and this ideology stuck with coders

 2. Machine code and Assembly language are both considered…

  to be high level languages

  to be low level languages

  to be portable

  to be machine code replicas

 3. Processors execute machine code and that each type of processor has its own __________________________

  CPU for every single instruction

  computer graphics card for every machine code instruction

  flexible machine code set that can be used by anyone

  specific machine code instruction set.

 4. Assembly language is often used to develop software for _______________ and for controlling specific hardware components.

  embedded systems

  high level games like hang man

  None of the above

  websites

 5. Understand that assembly language has a ______ correspondence with machine code

  three to three (3:3)

  one to one (1:1)

  one to many (1:m)

  two to two (2:2)

 6. Machine code is used in which generation of a programming language?

  2nd Generation

  3rd Generation

  1st Generation

  4th Generation

 7. Which language translator is needed for the 1st generation?

  A basic translator (IBM)

  An assembler

  An interpreter

  No Translator

 8. Which generation would create the fastest code to execute?

  4th Generation

  1st Generation

  3rd Generation

  2nd Generation

 9. An advantage of low level languages is that:

  None of the above

  it produces programs of a relatively smaller file size

  it produces complex large files that are robust and useful for the programmer

  it produces great big programs that are complex and difficult to manage

 10. An advantage of a high level language is that:
Note: remember that ultimately, all low and high level languages need to be converted into machine code

  It is easier to understand (by a programmer)

  It is closer to the machine and machine code

  None of the above

  It is useful for device drivers

 11. Low level languages are said to have a one to many relationship with high level languages

  TRUE

  FALSE

 12. The Little Man Computer is a very simple yet powerful ….
This is a great introductory video to LMC - have a watch if you are able.

  model of the monitor of a computer

  model of a printer

  model of a spacecraft of the future

   model of a computer!

 13. Read the excerpt on LMC and fill in the blanks
LMC is a simulator which has many of the basic features of a 
modern computer that uses the __________________________ (a central 
processing unit consisting of an arithmetic logic unit and
registers, a control unit containing an instruction register 
and program counter, input and output mechanisms and RAM to 
store both data and instructions).

  Cartal model of computers

  spatial awareness meter

  Von Neumann architecture

  None of the above

 14. The LMC is based on the idea of a 'Little Man' acting like the control unit of a CPU, _________________ them as well as managing the input and output mechanisms.

  fetching instructions from RAM, decoding and executing

  None of the above

  catching 1s and 0s as they pass through the computery ether and making

  riding through metaphorical hills and valleys and enjoying

 15. The 100 memory addresses in the computer memory are numbered 0 to 99 and can each contain a________________ instruction or data.

  python code

  gentrified code

  machine code

  C code

 16. Each assembly language instruction is made up of a 3 letter mnemonic usually followed by the memory address of the data the CPU is to act on

  TRUE

  FALSE

 17. One disadvantage or issue with assembly language is that the code only works on a specific CPU family. If you use a different CPU you would

  need to re-write the code using a different version of assembly language

  None of the above

  not need to rewrite the code at all

  need to make a copy of your old CPU

 18. The main advantage of assembly language is that it :

  is soft and cuddly, and therefore programmer's favourite

  runs fast compared to programs written in a high level language as there is less code overall

  runs slow compared to high level languages which makes it easy to follow

  is robust and hardy and cannot ever make a mistake (hence it's popular use in spacecraft)

 19. An example of a program that is typically written in assembly language is:

  a website for a government

  a personal fitness app for Android

  an online shop

  a device driver

 20. Device drivers need to be as ______________ as possible which is why assembly language is perfect

  None of the above

  slow and careful

  easily understandable in terms of the code

  fast and efficient

 21. Which of the following is NOT a typical assembly language command.
add
lock
subtract
load
compare
branch
store

  subtract

  load

   lock

  add

 22. An example of an assembly code mneumonic is LDA 50 which…

  None of the above

  stores the value 50, fifty times into fifty registers in the CPU

  adds the value 50 to the loaded value before it

  stores (loads) the value 50 into a register in the CPU

 23. In this example: LOAD 0004, it can be said that 'LOAD' is the opcode and the second part 0004 is the memory address

  TRUE

  FALSE

 24. In the command MOV AL 34h…the opcode is the __________ instruction and the other parts are called OPERANDS.

  MOV instruction

  34h part of the code

  None of the above

  AL instruction

 25. Operands are…

  tiny bits that are used to code in assembly language

  little bits of beauty

  manipulated directly by a high level language command

  manipulated by the opcode

 26. What does this LMC program do?
INP 
STA A 
INP 
STA B 
LDA A 
ADD B 
OUT 
HLT
A    DAT
b    DAT 
lmc_q1.gif

  takes in three numbers and stores them

  adds two numbers and displays the sum

  None of the above

  take in two numbers and stores them, displaying the first number

 27. This LMC program doesn't add or subtract. What does it do?
INP 
STA A 
INP 
STA B 
LDA A 
SUB B 
BRP isPositive
LDA B
OUT
HLT 
isPositive
LDA A 
HLT
A    DAT
B    DAT 

  finds out if an input number is positive or negative

  sorts three numbers from smallest to largest

  determines the bigger of two numbers by using loops

  loads two letters 'A' and 'B' and determines which one comes first

 28. The LMC can add or subtract numbers, but it can neither multiply nor divide. The multiplication can be carried out with the aid of ……..

  stubborn and persistent hard coding

  subtraction!

  nothing - this cannot be done!

  addition!

 29. Assembly language is written using:

  None of the above

  Hex code

  ASCII code

  Mneumonics

 30. Assembly language instructions like MOV or ADD are called operands

  FALSE

  TRUE