Question

    What is the primary role of lexical analysis in the

    compilation process?
    A Generating machine code Correct Answer Incorrect Answer
    B Checking syntax errors Correct Answer Incorrect Answer
    C Breaking source code into tokens Correct Answer Incorrect Answer
    D Optimizing code execution Correct Answer Incorrect Answer
    E None of these Correct Answer Incorrect Answer

    Solution

    Lexical analysis is the first phase of the compilation process. Its main task is to break the source code into tokens, which are meaningful units such as keywords, identifiers, literals, and operators. These tokens serve as input for the subsequent phases of the compiler.

    Practice Next

    Relevant for Exams: