2022 May/June · Paper 12 · Q6 (a, b, c)8 marksIDE features · Translators
No questions match this filter.
References only, not question text. Open Official paper ↗ where Cambridge publishes the paper,
or see the official Cambridge past-papers page; for other papers, ask your
school. “Paper 42” means Paper 4, variant 2.
Practice questions
Original questions written by HomiLabs in the style of the exam, with answers and mark schemes. They are not
Cambridge past paper questions and have not been reviewed by Cambridge. Try each one before opening the answer.
Q1IDE features · Core · Paper 1 style · 4 marks
(a)State what is meant by an Integrated Development Environment (IDE).[1]
(b)Identify three features of an IDE that help a programmer while they are typing (coding) a program.[3]
Show answer
(a) A single software application that provides the tools a programmer needs to write, translate, test and debug programs.
B1: one package of tools for writing/editing, translating and debugging program code.
(b) Any three of: prettyprint (colour-coding/indentation of keywords), context-sensitive prompts (auto-complete), dynamic syntax checking, expanding and collapsing code blocks, automatic indentation, bracket matching.
1 mark each for any three coding/presentation features: prettyprint; context-sensitive prompts; dynamic syntax checking; expand/collapse code blocks; auto-indent; bracket matching. Debugging features (breakpoints etc.) not accepted here.
Q2IDE features · Core · Paper 1 style · 5 marks
(a)Describe how a breakpoint is used when debugging a program.[2]
(b)Describe single stepping.[2]
(c)State the purpose of a report window (also called an output or debug window).[1]
Show answer
(a) The programmer marks a line of code; when the program is run it stops (pauses) at that line so the values of variables at that point can be inspected.
1 mark each: a point/line is set where execution will stop; allows the programmer to examine variables / state of the program at that point.
(b) The program is executed one statement (line) at a time, under the programmer's control, so the path through the code and the effect of each statement can be checked.
1 mark each: executes one line/statement at a time; programmer can see which lines are executed / check variable changes after each line.
(c) To show the values of variables or messages/output while the program runs, so the programmer can follow what is happening.
B1: displays values of variables / program output / error messages during execution.
Q3IDE features · Core · Paper 1 style · 4 marks
(a)Give two reasons why a programmer would use an IDE rather than a plain text editor and a separate compiler.[2]
(b)State two features of an IDE that help with debugging.[2]
Show answer
(a) Any two of: all tools are in one place so it is quicker to edit, translate and run; coding features such as prettyprint and auto-complete reduce errors; debugging tools (breakpoints, stepping, watch window) make errors easier to find; errors are reported with the line they occur on.
1 mark each for any two valid reasons.
(b) Any two of: breakpoints, single stepping, variable watch window, report/output window.
1 mark each.
Q4IDE features · Standard · Paper 1 style · 6 marks
A programmer at a school in Rawalpindi writes a program that adds up the monthly fees of all the students in a class. The program runs, but the total it outputs is always less than the correct total.
(a)Describe how the programmer could use the debugging features of an IDE to find the cause of the error.[5]
(b)Explain why the program translated without any error messages even though the total is wrong.[1]
Show answer
(a) Set a breakpoint just before the loop that adds up the fees. Run the program until it stops at the breakpoint. Add the total and the loop counter (and fee) to a variable watch window. Single-step through the loop one line at a time, comparing the values in the watch window with the expected values from a hand calculation, to find the line where the total goes wrong.
1 mark each, max 5: set breakpoint at a suitable point (e.g. start of loop); run to breakpoint; use variable watch window for the total/counter/fee; single-step through the code; compare actual values with expected (dry-run) values; identify the statement where the value first becomes wrong; possibly use report window to output values.
(b) It is a logic error: the code follows the syntax rules of the language, so the translator cannot detect that it does the wrong thing.
B1: logic error – syntax is valid so the translator cannot detect it.
Q5IDE features · Standard · Paper 1 style · 4 marks
A student in Islamabad is learning to program and uses an IDE that has dynamic syntax checking and context-sensitive prompts.
(a)Explain how dynamic syntax checking helps the student.[2]
(b)Explain how context-sensitive prompts help the student.[2]
Show answer
(a) The IDE checks each line as it is typed and highlights (underlines) any syntax error immediately, so the student can correct mistakes straight away rather than waiting until the whole program is translated.
1 mark each: checks syntax while code is typed / as each line is entered; errors highlighted immediately so they are corrected early / saves time.
(b) When the student types part of a keyword, variable or function name, the IDE suggests possible completions (and the parameters a function needs); this reduces typing and spelling errors and helps the student remember the correct names.
1 mark each: suggests/auto-completes keywords, identifiers or parameter lists based on what has been typed; fewer typing/spelling errors / faster / helps remember syntax.
Q6IDE features · Standard · Paper 1 style · 4 marks
(a)Identify the IDE feature described by each statement.(i) Keywords are shown in one colour, strings in another and comments in a third, and lines are indented automatically.(ii) A section of code such as a long procedure can be hidden so that only its first line is shown.(iii) The programmer can see the current value of chosen variables as the program runs.(iv) A missing ENDIF is underlined in red as soon as the line is typed.[4]
Show answer
(a) (i) Prettyprint (ii) Expand and collapse code blocks (iii) Variable watch window (iv) Dynamic syntax checking
1 mark each: (i) prettyprint; (ii) collapsing/expanding code blocks; (iii) watch window; (iv) dynamic syntax checking.
Q7IDE features · Challenge · Paper 1 style · 6 marks
A team of six programmers at a software house in Lahore is building a large ride-booking app. They all use the same IDE.
(a)Explain how prettyprint helps the team members.[2]
(b)Explain how collapsing and expanding code blocks helps when working with a file that contains several thousand lines.[2]
(c)The team lead says that an IDE cannot replace testing with test data. Justify this statement.[2]
Show answer
(a) Colour-coding and consistent indentation make the structure of the code (e.g. where loops and selections start and end) easy to see, so team members can read and understand each other's code quickly and spot errors such as unclosed strings.
1 mark each: makes code easier to read / structure clear; helps others understand and maintain code / spot errors such as missing quotes.
(b) Modules that are finished can be collapsed to a single line so the programmer can see the overall structure and move quickly to the part being worked on; a block can be expanded again when it needs to be edited.
1 mark each: hides detail of completed/unrelated modules; easier to navigate / see overall structure / focus on one section.
(c) IDE features find syntax errors and help locate errors, but they cannot tell whether the program gives the correct results; only testing with normal, boundary and erroneous data against expected results shows that the program meets its requirements.
1 mark each: IDE detects syntax errors only / cannot detect logic errors automatically; test data with expected results needed to show correct output / requirements met.
Q8IDE features · Challenge · Paper 1 style · 6 marks
(a)For each error below, state whether dynamic syntax checking would detect it, and give a reason.(i) A loop is written as WHILE Count < 10 but ENDWHILE is missing.(ii) A loop is written as FOR Index ← 1 TO 9 when it should process 10 items.[4]
(b)Name the type of error in (a)(ii) and describe one IDE feature that could help find it.[2]
Show answer
(a) (i) Yes – a missing ENDWHILE breaks the grammar rules of the language, so it is a syntax error. (ii) No – the statement follows the syntax rules; processing 9 items instead of 10 is a logic error.
(b) Logic error. A variable watch window with single stepping lets the programmer watch Index and see that the loop stops after 9 iterations.
B1: logic error. B1: watch window / breakpoint / single stepping described in context.
Q9Translators · Core · Paper 1 style · 3 marks
(a)State the purpose of each of the following translators.(i) Assembler(ii) Compiler(iii) Interpreter[3]
Show answer
(a) (i) Translates assembly language into machine code. (ii) Translates the whole of a high-level-language program into machine code (object code) before it is run. (iii) Translates and executes a high-level-language program one statement at a time.
1 mark each: (i) assembly → machine code; (ii) whole HLL program translated at once into an executable/object code; (iii) HLL translated and executed line by line, no executable file produced.
Q10Translators · Core · Paper 1 style · 4 marks
(a)For each statement, state whether it applies to a compiler only, an interpreter only, or both.(i) Translates a high-level language program.(ii) Produces an executable file.(iii) Stops at the first error it finds and reports it.(iv) Must be present every time the program is run.[4]
Show answer
(a) (i) Both (ii) Compiler only (iii) Interpreter only (iv) Interpreter only
1 mark each. Note for (iii): a compiler reports all errors it finds after reading the whole program.
Q11Translators · Standard · Paper 1 style · 4 marks
A developer in Karachi is writing a stock-control program for a chain of pharmacies.
(a)Give two reasons why an interpreter is useful while the program is being developed.[2]
(b)Give two reasons why the finished program should be compiled before it is distributed.[2]
Show answer
(a) Any two of: errors are reported as soon as the line containing them is reached, so they can be fixed and the program continued; the program can be run before it is complete; there is no need to recompile the whole program after every small change; easy to test parts of the code.
1 mark each for any two.
(b) Any two of: the compiled program runs faster; users do not need the translator installed; the source code is not given out, so it cannot easily be copied or changed; the executable can be run many times without being translated again.
1 mark each for any two.
Q12Translators · Standard · Paper 1 style · 4 marks
(a)Describe how a program written in Java is translated and executed.[3]
(b)State one benefit of this two-stage approach.[1]
Show answer
(a) The source code is compiled into intermediate code (bytecode). The bytecode is distributed and then interpreted (or just-in-time compiled) by a Java Virtual Machine on the computer that runs it, which converts it into that computer's machine code.
1 mark each: compiled to intermediate code / bytecode; bytecode run on a virtual machine; VM interprets/translates bytecode into machine code for the specific processor.
(b) The same bytecode can run on any computer that has a suitable virtual machine (portability), without being recompiled.
B1: portability / platform independence; or source code not distributed; or faster than pure interpretation.
Q13Translators · Standard · Paper 1 style · 4 marks
(a)Explain why a program that is interpreted usually runs more slowly than the same program after it has been compiled.[2]
(b)A compiler lists 14 errors after translating a program. Explain why this can be harder for a beginner to deal with than the error reporting of an interpreter.[2]
Show answer
(a) Each statement must be translated every time it is executed, including every time a loop repeats; a compiled program is translated once in advance, so only machine code is executed.
1 mark each: translation happens during execution / each time; statements in loops translated repeatedly; compiled code already machine code.
(b) All the errors are reported together after the whole program has been read, and some may be caused by earlier errors, so it is hard to know where to start; an interpreter stops at the first error so the beginner fixes one error at a time in context.
1 mark each: errors reported all at once after full translation / one error can cause others; interpreter reports one error at a time at the line where it happens.
Q14Translators · Challenge · Paper 1 style · 5 marks
A games company in Lahore has written a mobile racing game in a high-level language and is about to sell it online.
(a)Recommend whether the company should distribute the game as compiled code or as source code to be interpreted. Justify your recommendation.[4]
(b)State one drawback of distributing compiled code for this company.[1]
Show answer
(a) Compiled code. The company's source code stays secret so competitors cannot copy or change it; the game runs faster, which matters for smooth graphics; players do not need an interpreter installed; there is no translation delay each time the game starts.
B1: compiled. Then 1 mark each for up to 3 justifications in context: protects intellectual property / source code hidden; faster execution for real-time game; no translator needed on players' phones; no repeated translation.
(b) A separate compiled version is needed for each type of processor/operating system the game runs on.
B1: must be compiled for each platform / executable not portable / bugs need a new version compiled and distributed.
Q15Translators · Challenge · Paper 1 style · 5 marks
(a)Explain what an assembler does when it translates an assembly language program.[3]
(b)Explain why an assembly language program written for one processor will not usually run on a computer with a different type of processor.[2]
Show answer
(a) It converts each mnemonic (opcode) into its binary machine-code opcode, converts operands such as symbolic addresses and labels into actual (binary) addresses, and produces machine code (object code) — normally one machine instruction per assembly instruction. A two-pass assembler builds a symbol table of labels on the first pass.
1 mark each, max 3: mnemonics replaced by binary opcodes; labels/symbolic addresses replaced by numeric addresses (symbol table); one-to-one translation; produces object/machine code; directives processed / comments removed.
(b) Assembly language is specific to a processor's instruction set; a different processor family has different instructions, opcodes and registers, so the machine code produced will not be understood.
1 mark each: assembly/machine code is processor-specific (tied to its instruction set); different processors use different opcodes / registers / addressing modes.
Q16Operating system functions · Core · Paper 1 style · 4 marks
(a)Explain why a computer needs an operating system.[2]
(b)State two functions of an operating system, other than providing a user interface.[2]
Show answer
(a) The OS provides an interface between the user/applications and the hardware, so users do not have to control hardware directly; it manages the computer's resources (processor, memory, devices, files) so programs can run.
1 mark each: provides interface between user/application and hardware; manages resources / hides complexity of hardware.
(b) Any two of: memory management, file management, process management, hardware (device) management, security management.
1 mark each.
Q17Operating system functions · Core · Paper 1 style · 4 marks
(a)Identify the operating system function that is described by each statement.(i) Allocates time on the processor to each running program.(ii) Requires a username and password and sets access rights for users.(iii) Keeps a directory structure and records where each file is stored.(iv) Loads a device driver when a new webcam is connected.[4]
Show answer
(a) (i) Process management (ii) Security management (iii) File management (iv) Hardware (device) management
1 mark each.
Q18Operating system functions · Standard · Paper 1 style · 6 marks
(a)Describe memory management.[3]
(b)Describe file management.[3]
Show answer
(a) The OS decides which processes are allocated which parts of memory and keeps track of what is free; it loads programs and data into memory and frees memory when a program ends; it stops one process from accessing memory allocated to another (memory protection); it may use virtual memory when RAM is full.
1 mark each, max 3: allocation of memory to processes; tracking free/used memory; deallocation when finished; memory protection between processes; virtual memory/paging.
(b) The OS provides a file naming system and a directory (folder) structure; it keeps track of where each file is stored on secondary storage; it allows files to be created, opened, saved, copied, moved and deleted; it controls access rights to files.
1 mark each, max 3: naming conventions; hierarchical folder/directory structure; locates where files are stored; operations such as create/save/delete/copy; access control / permissions.
Q19Operating system functions · Standard · Paper 1 style · 5 marks
(a)Describe process management.[3]
(b)Explain how the operating system manages hardware such as a printer.[2]
Show answer
(a) The OS manages the programs (processes) that are running: it schedules which process uses the processor and for how long, so several can appear to run at once (multitasking); it allocates resources to processes, handles interrupts, and resolves conflicts such as two processes wanting the same resource.
1 mark each, max 3: scheduling processes on the CPU; multitasking; allocation of resources to processes; handling interrupts / priorities; preventing deadlock / conflicts between processes.
(b) It uses a device driver to communicate with the printer, translating general instructions into commands that device understands; it handles the printer's interrupts and manages a queue (spooling) of print jobs from different programs.
1 mark each: installs/uses device drivers; sends data / handles interrupts / buffers / queues jobs.
Q20Operating system functions · Challenge · Paper 1 style · 6 marks
A delivery rider in Faisalabad uses a smartphone. While a navigation app shows a map using the phone's GPS receiver, the rider also plays music through headphones.
(a)Explain three ways in which the phone's operating system manages the device while the user does this.[6]
Show answer
(a) Process management: the OS schedules the navigation app and the music app so both get processor time and appear to run at the same time. Memory management: it allocates RAM to each app, keeps them separate, and may close/suspend background apps if memory runs low. Hardware management: it uses drivers to receive data from the GPS receiver and to send sound to the headphones/speaker. (Also accept: security management – checking that the navigation app has permission to use the location.)
For each of three functions: B1 named function, B1 explanation in the context of the phone/apps. Generic descriptions not in context max 1 per function.
Q21Operating system functions · Challenge · Paper 1 style · 6 marks
A shared computer in a school staff room in Abbottabad is used by both teachers and students.
(a)Describe how the operating system provides security management on this computer.[4]
(b)Explain why giving all users administrator rights would be a risk.[2]
Show answer
(a) It requires each teacher and student to log in with their own user account and password (authentication). It gives each account access rights, so students cannot open or change files in the teachers' folders while teachers can. It keeps logs of log-ins and file access, and it can install security updates and run firewall software to block unauthorised access.
1 mark each, max 4: user accounts / authentication (password, biometrics); access rights / permissions on files and folders; different privileges for different users (e.g. admin vs student) in context; logging/auditing; firewall / updates / protecting memory of other processes.
(b) Any user could install software or change system settings, so malware could be installed or settings damaged (accidentally or deliberately); users could also view or change other users' files.
1 mark each: can install software / change settings / delete system files; risk of malware / damage / access to private files.
Q22Utility software · Core · Paper 1 style · 3 marks
(a)State the purpose of each of the following utility programs.(i) Virus checker(ii) Disk formatter(iii) File compression utility[3]
Show answer
(a) (i) Scans files and memory for malware, then quarantines or deletes infected files. (ii) Prepares a disk for use by setting up its file system (tracks/sectors), deleting existing data. (iii) Reduces the size of files so they take less storage space and are quicker to send.
1 mark each.
Q23Utility software · Standard · Paper 1 style · 5 marks
(a)Explain how defragmentation software can improve the performance of a computer with a hard disk drive.[3]
(b)Explain why defragmentation is not needed on a solid state drive (SSD).[2]
Show answer
(a) Over time, files are saved in pieces (fragments) scattered over the disk. Defragmentation moves the fragments of each file so they are stored in contiguous blocks, and groups free space together. The read/write head then moves less to read a file, so files are opened faster.
1 mark each: files become fragmented / stored in non-contiguous blocks; defragmenter reorganises data so each file's blocks are together (and free space combined); less head movement → faster access.
(b) An SSD has no moving parts, so the time to read data does not depend on where it is stored; extra rewriting would also wear out the flash memory cells.
1 mark each: no moving read/write head – access time the same anywhere; unnecessary writes reduce SSD lifespan.
Q24Utility software · Standard · Paper 1 style · 5 marks
A small travel agency in Multan keeps all its customer bookings on one office computer.
(a)Describe how back-up software helps the business.[3]
(b)State one other utility the business should use, and explain why.[2]
Show answer
(a) It makes copies of the business's files to a different storage device or the cloud. It can be scheduled to run automatically (e.g. every night), copying only files that have changed since the last backup. If the original files are lost, corrupted or encrypted by ransomware, they can be restored from the backup.
1 mark each, max 3: copies data to another location/device; scheduled automatically; full or incremental (only changed files); allows restoring after loss/corruption/attack.
(b) A virus checker – to detect and remove malware that could delete or steal customer records.
B1 utility, B1 reason in context. Accept disk repair / disk analysis, compression etc. with suitable reason.
Q25Utility software · Standard · Paper 1 style · 4 marks
(a)Describe what disk repair software does.[2]
(b)A technician is about to format a USB flash drive. State one consequence of formatting it, and one reason for doing so.[2]
Show answer
(a) It scans the disk for errors such as bad sectors and corrupted file-system entries; it marks bad sectors so they are not used, repairs inconsistencies and tries to recover data from damaged areas.
1 mark each: checks disk for errors/bad sectors; repairs file-system errors / marks bad sectors unusable / recovers data.
(b) Consequence: all data on the drive is erased (or made inaccessible). Reason: to set up a new file system / prepare a new drive / remove all data before giving it away / fix a corrupted drive.
B1 consequence; B1 reason.
Q26Utility software · Challenge · Paper 1 style · 6 marks
An accountant's office computer in Sukkur has a hard disk drive that is almost full. Files take a long time to open and the computer sometimes shows unexpected pop-up adverts.
(a)Recommend three different utility programs that could help with these problems. For each one, explain how it helps.[6]
Show answer
(a) Disk contents analysis: shows which files and folders use the most space, so large unneeded files (e.g. old videos) can be found and deleted. Defragmentation: puts fragmented files on the hard disk back into contiguous blocks, so files open faster. Virus checker: the slowdown and pop-ups could be caused by malware, which it can detect and remove. (Also accept: file compression to save space; disk repair to fix bad sectors causing errors.)
For each of three utilities: B1 name, B1 explanation linked to the problem (space, speed, errors). Max 6.
Q27Program libraries · Core · Paper 1 style · 3 marks
(a)State what is meant by a library routine.[1]
(b)Give two benefits to a programmer of using library routines.[2]
Show answer
(a) A pre-written, pre-tested, (usually pre-compiled) subroutine that can be called from a program.
B1: pre-written / pre-tested code (subroutine) that programmers can use in their own programs.
(b) Any two of: saves development time as the code does not need to be written; already tested so it is reliable; may be written by experts so it is efficient; can be used in many programs.
1 mark each for any two.
Q28Program libraries · Standard · Paper 1 style · 6 marks
(a)Explain what is meant by a dynamic link library (DLL).[2]
(b)Explain two benefits of using DLL files instead of including all the library code in each executable file.[4]
Show answer
(a) A library file of compiled routines that is not included in the executable; it is loaded and linked to the program at run time when the program needs it.
1 mark each: library of compiled routines stored separately; linked/loaded at run time (not at compile time).
(b) Executables are smaller because the library code is not copied into each one, saving storage. One copy of the DLL in memory can be shared by several running programs, saving RAM. If the DLL is updated (e.g. a bug fix), every program that uses it benefits without being recompiled.
Two benefits, 2 marks each (point + explanation): smaller executable files; shared in memory by several programs; updating the DLL updates all programs without recompiling; only loaded when needed.
Q29Program libraries · Standard · Paper 1 style · 5 marks
A programmer is writing an app for a cricket academy in Rawalpindi. The app needs to calculate square roots and standard deviations of players' scores and sort large lists of results.
(a)Explain two reasons why the programmer should use library routines for these tasks rather than writing their own code.[4]
(b)State one possible disadvantage of using a library routine written by someone else.[1]
Show answer
(a) The library routines have already been thoroughly tested, so they are much less likely to contain errors than new code — important when the app's results must be accurate. They are likely to be efficient because they were written by specialists, and using them saves the time it would take to design, write and test the code, so the app is finished sooner.
2 marks per reason (point + development in context): tested/reliable; efficient/optimised; saves development time/cost; programmer does not need specialist knowledge of the algorithm.
(b) The programmer cannot see or change how it works, so it may not do exactly what is needed (or may have a bug the programmer cannot fix).
B1: may not fit exact requirements / cannot modify / may contain unknown errors / licence restrictions.
Q30Program libraries · Challenge · Paper 1 style · 6 marks
(a)Explain three drawbacks of programs relying on DLL files.[6]
Show answer
(a) If the DLL file is missing or deleted, programs that need it will not run. If the DLL is updated to a new version that is not compatible, programs written for the old version may stop working or behave wrongly (version conflicts). A malicious DLL with the same name could replace the real one, so malware runs whenever the program calls it. The programmer has no control over changes made to the DLL by others.
Three drawbacks, 2 marks each (point + explanation), max 6: missing DLL – program fails; incompatible version / changed routine breaks programs; DLL replaced by malware / security risk; programmer cannot control DLL contents.
Similar questions
Questions that test the same subtopic in different years, grouped so you can work on one skill at a time.
References only: find each question in its paper (official link where available, otherwise through your school).