Understanding the purpose of translators

    Cards (30)

    • Compilers and interpreters both translate high-level code but differ in their approach

      True
    • Match the translator type with its definition:
      Compiler ↔️ Translates the entire program at once
      Interpreter ↔️ Translates and executes code line-by-line
    • What is the output of a compiler after translation?
      Executable file
    • A compiler translates the entire source code into an executable file
    • Compilers translate code line-by-line during runtime.
      False
    • Interpreters are ideal for projects requiring high performance.
      False
    • Match the translator type with its function:
      Compiler ↔️ Translates the entire program at once
      Interpreter ↔️ Translates and executes line-by-line
    • Compilers translate the entire source code into an executable
    • Java code is directly compiled to machine code.
      False
    • What is a translator in programming?
      Converts high-level to machine code
    • What does a compiler do during translation?
      Translates entire program at once
    • A translator acts as an intermediary between high-level code and machine-level instructions
    • What does an interpreter directly execute after translation?
      High-level code
    • Why is code translated by a compiler faster to execute?
      Pre-compilation
    • What is one advantage of using an interpreter over a compiler?
      No need to compile
    • Match the advantage with the type of translator:
      Compiler ↔️ Faster execution
      Interpreter ↔️ Easier debugging
    • What is the main purpose of a translator in programming?
      Bridge human-readable code
    • Steps in the translation process from source code to machine code
      1️⃣ Lexical Analysis
      2️⃣ Syntax Analysis
      3️⃣ Semantic Analysis
      4️⃣ Code Generation
      5️⃣ Optimization
    • Match the characteristic with the translator type:
      Compiler ↔️ Generates an executable file
      Interpreter ↔️ Translates code line-by-line
    • Java code is first compiled to bytecode by Javac
    • A translator converts high-level programming language code into machine-readable code
    • How does an interpreter translate code?
      Translates and executes line-by-line
    • Compilers generate standalone executable files, while interpreters do not

      True
    • Interpreters allow easier debugging because errors are flagged immediately
    • Interpreters are favored for projects requiring high performance
      False
    • Compilers convert the entire source code into an executable
    • A disadvantage of compilers is the longer compilation time
    • A compiler generates an executable
    • Interpreters produce standalone executables.
      False
    • What is an example of a compiler used in C?
      GCC