← Back to Dashboard

1.2.4 Types of programming language

A-Level Computer Science

1. Fig. 1 shows assembly code written using the Little Man Computer (LMC). The program calculates and outputs the total amount that is donated to the charity in any particular day. Depending on the amount, an additional bonus may be added to each amount donated.
Question Image
a) The program shown in Fig. 1 is run once using three different inputs. Therefore, while the program is running once, it will output the updated total three times. Give the total values that are output when the values 10, 50 and 120 are input into this program
[3]
Login to save your answers
/ 3
b) Write LMC code that will reset the value of the memory location labelled total to zero and then stop the program
[4]
Login to save your answers
/ 4
2. A program is written using an object-oriented programming paradigm and uses a class called video to organise the videos that are streamed to customers. The class video has these attributes:
• name
• number of views
• star rating.
The constructor method will set the name attribute to the name that is passed in as a parameter. The constructor will also initially set the number of views to 0 and the star rating to 3.
a) Write program code or pseudocode to declare the class video and initialise the required
attributes as private. You should include both the attribute definitions and the constructor method in your answer
[7]
Login to save your answers
/ 7
b) A public method called updateviews() will update the number of views after a video
has been viewed. This method is defined inside the video class.
Write program code or pseudocode for the method updateviews() to increase the number of views by one.
[2]
Login to save your answers
/ 2
3. A team of programmers create a robot that will be used in a factory. The robot will be able to do the work of multiple humans. The programmers discuss whether to write the instructions for the robot in assembly language or a high-level language.
Describe two differences between assembly language and high-level languages.
[4]
Login to save your answers
/ 4
Please login to save your answers and marks.