Worksheet Chapter 4 PDF - O1 CS 0478
Document Details
Uploaded by UnforgettableBowenite7519
2021
O1 CS
Tags
Summary
This worksheet from O1 CS 0478 (2021) is a past paper covering topics related to programming languages. Questions and exercises on high-level and low-level programming are included. It discusses concepts of translators and integrated development environments. The document is intended for secondary school students studying computer science.
Full Transcript
Chapter 4 Worksheet Name_______________________ O1 CS 0478 Here are the stages that occur when an interrupt is serviced by the C...
Chapter 4 Worksheet Name_______________________ O1 CS 0478 Here are the stages that occur when an interrupt is serviced by the CPU. Order the stages. The first one has been done for you. Stage Order number The CPU checks the priority of the next interrupt to see if it has a higher priority than the current task being processed. If the priority is lower, it leaves the interrupt in the interrupt queue and carries on processing. If it is higher, the CPU stops and stores the current task being processed and fetches the interrupt into the CPU to be processed. When the CPU completes its current fetch-decode-execute cycle, it checks the 1 interrupt at the front of the interrupt queue. The interrupt service routine (ISR) is called to handle the interrupt When the interrupt is serviced, the CPU either fetches the task it stored back into the CPU to be processed, or services another interrupt from the queue if it has a higher priority. The CPU checks the source of the interrupt. 4.2 Types of programming language, translators and integrated development environments (IDEs) Different types of programming language can be categorised as high-level or low-level languages. Exercise 1 High-level and low-level languages 1 Describe a high-level programming language. 2 Describe a low-level programming language. 3 Tick (✔) to show whether each statement applies to a high-level or low-level language. High-level Low-level Statement language language (✔) (✔) Programs written in this type of language are portable. Assembly language is an example of this type of language. This type of language can be used to directly manipulate the hardware. This type of language is normally easier for humans to understand. One statement in this type of language can be used to perform several instructions. Translators convert the different types of languages into machine code. This allows the program to be processed by the computer, as the computer can only process binary data. Software IGCSE_CS_WB_Ch 4.indd 46 26/01/21 8:06 PM Chapter 4 4 Here are three example of programs. Can you identify whether they are an example of High-level language, assembly language or machine code? Example program Type of language or code INP ADD 5 OUT 01100000 11001100 11111111 number = input(“Please enter the number you want to search for:“ print (“You want to search for number“ + number) 5 What are three reasons why a programmer may choose to use a high-level language, rather than a low-level language to write a computer program? Reason 1 Reason 2 Reason 3 6 What are two reasons why a programmer may choose to use a low-level language, rather than a high-level language to write a computer program? Reason 1 Reason 2 Software IGCSE_CS_WB_Ch 4.indd 47 26/01/21 8:06 PM Chapter 4 7 Translators convert the different types of languages into machine code. This allows the program to be processed by the computer, as the computer can only process binary data. What is the name of the translator used to convert assembly language into machine code? 8 Tick (✔) to show whether each statement about interpreters is true or false. Statement True (✔) False (✔) Translate a line of code at a time then execute it. Stop executing the code when an error occurs. Report all syntax errors at the same time in a report. Will not run the program at all until all errors are corrected. Produce an executable file. 9 How does a compiler operate? 10 When creating a program, would it be better to use an interpreter or a compiler? Why? Software IGCSE_CS_WB_Ch 4.indd 48 26/01/21 8:06 PM Chapter 4 When writing program code, a programmer will often use an IDE. An IDE can provide a programmer with useful functions that help when writing the code. 11 List four functions that can be included in an IDE. Function 1 Function 2 Function 3 Function 4 End of Chapter Software IGCSE_CS_WB_Ch 4.indd 49