Prepare for the A Level Computer Science OCR Exam with engaging quizzes, detailed explanations, and effective study tips. Maximize your readiness and boost your confidence for exam day!

Practice this question and more.


What is the primary function of an assembler?

  1. To compile high-level code into machine code

  2. To convert assembly code into object code

  3. To execute code line-by-line

  4. To debug programming errors

The correct answer is: To convert assembly code into object code

The primary function of an assembler is indeed to convert assembly code into object code. Assembly language is a low-level programming language that is closely related to machine code but is more human-readable. An assembler translates the mnemonics and symbols used in assembly language into the binary format that the computer's processor can understand and execute. This process is crucial because processors operate at the hardware level and require instructions in machine code. In contrast, the other options provided serve different roles in the programming process. For instance, compiling high-level code into machine code is the role of a compiler, not an assembler. Executing code line-by-line pertains to interpreters, which process and run instructions at runtime rather than translating them in advance. Lastly, debugging programming errors is the function of debugging tools or integrated development environments (IDEs), rather than the assembler itself. Thus, the correct choice highlights the specific role of the assembler within the context of software development.