0% found this document useful (0 votes)
15 views7 pages

Handout Prog Langs

This document discusses various topics related to computer programming languages including: - Different generations of programming languages from low-level machine languages to high-level languages. - The progression from machine-oriented to portable programs. - Key aspects of assembly language like mnemonics, labels, and operands in assembly code. - Differences between interpreters and compilers in how source code is translated and executed. - Object-oriented programming and how high-level languages must be translated to machine code.

Uploaded by

blosos69
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views7 pages

Handout Prog Langs

This document discusses various topics related to computer programming languages including: - Different generations of programming languages from low-level machine languages to high-level languages. - The progression from machine-oriented to portable programs. - Key aspects of assembly language like mnemonics, labels, and operands in assembly code. - Differences between interpreters and compilers in how source code is translated and executed. - Object-oriented programming and how high-level languages must be translated to machine code.

Uploaded by

blosos69
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

or

1. What language does a computer understand?

2. What do we call the different progressions of languages over the time ?

3. Complete the following table

1st GL 2nd GL 3rd GL 4th GL 5th GL


Low/High

Orientation
Machine/
Problem
Not/User
Friendly
Memory
Requirment
High/Low
Execution
Fast/Slow

Examples

4. Why is certain code machine dependent?


________________________________________________________________________
________________________________________________________________________

5. What is meant by software portability?

________________________________________________________________________
________________________________________________________________________

1|Page
6. Tick in the space provided showing which of these programs are Machine (Computer)
Oriented or Portable.

Programs Machine-Oriented Portable


WinZip
Assembly
Binarly Language
Java / Python
Wordprocessor

7. What are Mnemonics and in which generation level are these used.
________________________________________________________________________
________________________________________________________________________

8. Which generation of languages is also known as procedural or imperative


________________________________________________________________________
________________________________________________________________________

9. Use TEN of the following terms to complete the passage below:

CPU BASIC fetch-execute opcode registers


Address machine-code program-counter disk operands
ALU instruction keyboard execute data

A _________________ instruction is made up of an _________________


specifying the operation to be performed by the _________________, followed by
zero or more _________________, specifying the data on which the operation is
to be performed. At the beginning of a _________________ cycle, the CPU
places the contents of the _________________ on the _____________ bus, and
receives the next instruction over the_________________ bus. The instruction is
stored in the _________________ register while it is being decoded and
_________________.

2|Page
10. What do the following terms refer to:
Machine/object code:______________________________________________________
Source Code: _____________________________________________________________
Executable Code: _________________________________________________________
Byte Code: ______________________________________________________________

11. What extensions are usually associated with these file types:

Machine/object code:__________________

Source Code: _________________________

Executable Code: _____________________

Byte Code: __________________________

12. 4th Generation make use of modules ? What are modules?


________________________________________________________________________
________________________________________________________________________

13. 4th Generation Languages are more user-friendly because they are Interactive,
Integrated and Modular. Expain the terms in bold.
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________

________________________________________________________________________
________________________________________________________________________

3|Page
14. What do you understand by object-oriented programming?

________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________

15. What is the use of an assembler?


________________________________________________________________________
________________________________________________________________________

16. Why do High Level Languages have to be translated to machine code in order for these
to be processed?
________________________________________________________________________
________________________________________________________________________

17. Complete the following table by stating whether the following are qualities of an
interpreter or compliler.

Statement Translator
Programs using this type of translator run faster
Translates and executes the source code line by line
Produces executable code which is stored in a separate file.
When using this translator the program is translated every
time the program is run
Beginners in programming often find this translater more
useful.
This translator is used once most errors have been cleared.

4|Page
18. Use ten of the following terms to complete the passage below:
1GL 2GL 3GL 4GL 5GL
assembler compiler interpreter executed translated
high middle low slow faster
source object bytecode computer portable
interpreted compiled platforms Assembly debugger

Java is a specialized _____. This means it is a _____ level language, widely used
in Internet-related software. It is a/an _______________ language meaning that the
lines of code are _______________ line-by-line – a _____ process.
The Java program that is written by the programmer is called the
__________________ code, depicted by the .java extension. The
__________________ does not directly understand Java, so a Java program has to
be ________________ first into __________________ (or ______________ code)
by a _________________ to create a .class file. When the program is run, every
line of this .class file is then _______________ and _______________, line after
line on a virtual machine.
Unlike a _____ level language such as __________________ language, a Java
program is __________________, meanings that it can be compiled to run on a
variety of processors and _______________.

Python is a general-purpose _____. This means it is a _____ level language, used


in large profile companies like Netflix and Instagram. It is a/an _______________
language meaning that the lines of code are _______________ line-by-line – a
_____ process.
The Python program that is written by the programmer is called the
__________________ code, depicted by the .py extension. The
__________________ does not directly understand Python, so a Python program
has to be _______________ first into _________________ (or ___________ code)
by a _________________ to create a .pyc (or .pyo) file. When the program is run,
every line of this .pyc file is then _______________ and _______________, line
after line on a virtual machine
Unlike a _____ level language such as __________________ language, a Python
program is __________________, meanings that it can be compiled to run on a
variety of processors and _______________.

19. Instructions are divided into two parts, the Function Code, usually known as the
______________ and the Address Code, also known as the ______________. The whole
instructions can be referred to as the ___________________. A number of instructions
is called an ____________________.

5|Page
20. Consider the following routine written in assembly language. A semicolon
indicates a comment:
LDA 1 ; load 1 into the accumulator
STA N ; store the contents of the accumulator in location N
LDA 5 ; load 5 into the accumulator
STA C ; store the contents of the accumulator in location C
Loop: LDA N ; load the contents of location N into the accumulator
MUL C ; multiply the contents of the accumulator by the contents of location C
STA N ; store the contents of the accumulator in location N
LDA C ; load the contents of location C into the accumulator
DEC ; decrement the contents of the accumulator
STA C ; store the contents of the accumulator in location C
JNZ loop ; jump to LOOP if the contents of the accumulator are not zero
RET ; stop

From the assembly language routine shown above, identify


one label: ________________________,
one mnemonic: ________________________,
and one operand:_ ________________________,

21. Consider the following section of an assembly language program

MOV A, value 1 ; copy value 1 to accumulator


CMP A, value 2 ; compare the accumulator with value 2
JLE lab 1 ; jump to lab 1 if accumulator is less than value 2
MOV max, A ; copy accumulator to max
JMP lab 2 ; jump to lab2
Lab 1:MOV A, value 2 ; copy value 2 to accumulator
MOV max, A ; copy accumulator to max
Lab 2: HLT ; stop.

What is the function of this section of the code?

___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________

6|Page
22. Consider the following section of an assembly language

1 MOV A,3 ; move the decimal number 3 to the accumulator


2 STO A,N ; store accumulator contents to memory location N
3 LAB 1 MOV A,X ; move contents of memory location X to accumulator
4 MUL A,2 ; multiply the contents of the accumulator by 2
5 STO A,X ; store accumulator contents to memory location X
6 MOV A,N ; move contents of memory location N to accumulator
7 DEC A ; decrement the accumulator contents by 1
8 STO A,N ; store accumulator contents to memory location N
9 JNZ LAB1 ; jump to LAB1 if accumulator is not zero
10 HLT; halt

(i) Identify the line number where a label is declared.


_______________________________________________________________

(ii) Identify the line number where an instruction refers to a label.


_______________________________________________________________

(iii) Suppose that initially 1 is stored in location X. Write down the contents of
X and N as they change when this code is being executed.
_______________________________________________________________
_______________________________________________________________
_______________________________________________________________
_______________________________________________________________
_______________________________________________________________
_______________________________________________________________
_______________________________________________________________

(iv) Hence (as a consequence) what are the contents of X after execution?
_______________________________________________________________

(iv) What is the function of the above assembly program?


___________________________________________________________________________

7|Page

You might also like