High Level Code and Machine Code, Lecture notes of Programming Languages

A lesson plan for a 60-minute class on programming languages. The lesson focuses on the difference between high level code and machine code, the need for translators to convert high level code to machine code, and the characteristics of an assembler, a compiler, and an interpreter. The class includes activities such as writing down computer programming languages, watching videos, completing a worksheet, and using an on-screen simulator. The document also includes answers to the worksheet and a plenary to summarize the learning points.

Typology: Lecture notes

2021/2022

Uploaded on 05/11/2023

alfred67
alfred67 🇺🇸

4.9

(20)

328 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Lesson Plan
High level code and
machine code
Teacher’s Notes
Time (min) Activity Further Notes
5 Ask the students to quickly write down the names of any
computer programming languages that they know.
Ask selected students for their ideas and ask if they know
the difference between the terms ‘low level language’ and
‘high level language’.
Show students the link to the specification. Explain the
purpose and objectives of the lesson.
Stress that the methods shown used sound, light and the
fixed positions of flags to encode letters which are then
decoded by the recipient.
Computers use binary digits to do the same thing.
Show students the link to the specification. Explain the
purpose and objectives of the lesson.
Other examples are available on
YouTube.
15 Watch the set of videos.
5Ask some questions about the video to assess learning.
e.g.
• Whatistheonlylanguagethatacomputerunder-
stands?
• Whydon’tprogrammersusuallywriteprogramsusing
machine code?
• Namethetypesoftranslatorsthatareusedtoconvert
other languages to machine code.
Machine code.
Difficult to visualize a program that is just a
stream of 1s and 0s.
Assemblers, compilers, interpreters.
20 Worksheet 1
Students to complete Worksheet 1 either on paper or
on computer using knowledge gained from video and
internet research.
Ask individual students for their answers and discuss
with the class so that all students will have the correct
answers entered on their worksheets.
Answers provided.
Length 60 mins Specification Link 2.1.7/cde Programming languages
Learning objective
Students should be able to
(a) explain the difference between high level code and machine code
(b) explain the need for translators to convert high level code to machine code
(c) describe the characteristics of an assembler, a compiler and an interpreter
x
®
pf3
pf4
pf5

Partial preview of the text

Download High Level Code and Machine Code and more Lecture notes Programming Languages in PDF only on Docsity!

Lesson Plan

High level code and

machine code

Teacher’s Notes

Time (min) Activity Further Notes 5 Ask the students to quickly write down the names of any computer programming languages that they know. Ask selected students for their ideas and ask if they know the difference between the terms ‘low level language’ and ‘high level language’. Show students the link to the specification. Explain the purpose and objectives of the lesson. Stress that the methods shown used sound, light and the fixed positions of flags to encode letters which are then decoded by the recipient. Computers use binary digits to do the same thing. Show students the link to the specification. Explain the purpose and objectives of the lesson. Other examples are available on YouTube. 15 Watch the set of videos. 5 Ask some questions about the video to assess learning. e.g.

  • What is the only language that a computer under- stands?
  • Why don’t programmers usually write programs using machine code?
  • Name the types of translators that are used to convert other languages to machine code. Machine code. Difficult to visualize a program that is just a stream of 1s and 0s. Assemblers, compilers, interpreters. 20 Worksheet 1 Students to complete Worksheet 1 either on paper or on computer using knowledge gained from video and internet research. Ask individual students for their answers and discuss with the class so that all students will have the correct answers entered on their worksheets. Answers provided. Length 60 mins Specification Link 2.1.7/cde Programming languages Learning objective Students should be able to (a) explain the difference between high level code and machine code (b) explain the need for translators to convert high level code to machine code (c) describe the characteristics of an assembler, a compiler and an interpreter

x

Time (min) Activity Further Notes 10 Activity Explain to the students that they are now going to use Assembly language in an on-screen simulator. (http://www.cambridgegcsecomputing.org/weblink19) Explain that they will be using mnemonics to input two numbers which will then be added together. Explain that they will use the mnemonics: INP – input STA – store a number in a memory address ADD – add numbers in accumulator OUT – output the results HLT – halt the program The students should now use the demonstration run-through to carry out this activity. Ask the students to carry out research to find the mnemonics for further actions and carry out other examples on the website. Extension Challenge/Homework The students should complete and submit Worksheet 2. 5 Plenary Remind students of the learning points to take away, based on those discussed earlier e.g.

  • What is the only language that a computer understands?
  • Why don’t programmers usually write programs using machine code?
  • Name the types of translators that are used to convert other languages to machine code and the differences between them. Machine code. Difficult to visualize a program that is just a stream of 1s and 0s. Assemblers, compilers, interpreters.

(a) What are ‘high level languages’?

High level languages are called ‘high-level’ because they are closer to human languages and

are further removed from machine languages than assembly language.

There is no one-to-one relationship between the instructions in a high level language and

machine language as there is with assembly language.

(b) List three examples of a high level language.

Basic, C, Fortran, Python, Ada etc.

(c) List three advantages of assembly language over a high level language.

It requires less memory and execution time.

It allows hardware-specific complex jobs in an easier way.

It is suitable for time-critical jobs.

It is most suitable for writing interrupt service routines and other memory resident programs.

(d) List three advantages of using a high level language over assembly language.

Faster program development – it is less time consuming to write and then test the program.

It is not necessary to remember the registers of the CPU and mnemonic instructions.

Portability of a program from one machine to other. Each assembly language is specific to

a particular type of CPU, but most high-level programming languages are generally portable

across multiple architectures.

Compilers and interpreters are needed to translate the high level code into machine

code. What is the difference between a compiler and an interpreter?

Give an advantage and disadvantage of each.

A compiler reads the whole high level code and translates it into a complete machine code

program which is output as a new file and can be saved.

The biggest advantage of this is that the translation is done once only and as a separate

process. The program that is run is already translated into machine code so is much faster in

execution. The disadvantage is that you cannot change the program without going back to

the original source code, editing that and recompiling.

An interpreter reads the source code one instruction or line at a time, converts this line into

machine code and executes it. The machine code is then discarded and the next line is read.

The advantage of this is it’s simple and you can interrupt it while it is running, change the

program and either continue or start again.

The disadvantage is that every line has to be translated every time it is executed, even if it is

executed many times as the program runs. And because of this interpreters tend to be slow.

Complete the following diagrams by labelling the boxes.

You may use the following words:

source code, interpreter, assembler, object code, compiler

translator

source code

assembler complier interpreter

object code

translator