Program Construction

Cards (31)

  • What is the purpose of a programming language?
    To write code understandable to the programmer
  • Why must programmer's code be translated?
    Because processors can only run machine code
  • What are the three types of translators?
    Compiler, interpreter, and assembler
  • What does a compiler do?
    Converts high-level language into machine code
  • How does an interpreter function?
    Converts code one line at a time
  • What does an assembler convert?
    Low-level assembly language into machine code
  • What is a high-level language?
    Language independent of specific computer types
  • What is source code?
    Programming code not yet translated
  • What is object code?
    Translated code that can be executed
  • What happens if an interpreter encounters an error?
    It stops the translation process
  • What is an advantage of using a compiler?
    Code can be run multiple times after translation
  • What is a disadvantage of a compiler?
    Errors are reported only at the end
  • What is lexical analysis?
    Removing comments and replacing tokens
  • What is parsing in programming?
    Analyzing a string of tokens
  • What is a syntax error?
    Error due to incorrect code structure
  • What is a runtime error?
    Error that occurs during program execution
  • What is a logical error?
    Incorrect behavior due to code mistakes
  • What is a linking error?
    Error due to missing library functions
  • What is a rounding error?
    Difference between rounded and actual values
  • What is a truncation error?
    Difference between truncated and actual values
  • What is the definition of a compiler?
    Converts high-level language into machine code
  • What is the definition of an interpreter?
    Converts code one line at a time
  • What is the definition of an assembler?
    Converts low-level assembly language into machine code
  • What is the definition of high-level language?
    Language independent of specific computer types
  • What is the definition of source code?
    Programming code not yet translated
  • What is the definition of object code?
    Translated code that can be executed
  • What are the processes involved in lexical analysis?
    • Remove comments and unneeded spaces
    • Replace keywords, constants, and identifiers with tokens
  • What are the processes involved in syntax analysis?
    • Check tokens for correct syntax
    • Produce error messages for syntax errors
  • What are the processes involved in semantic analysis?
    • Check variable declarations and usage
    • Ensure correct data types for variables
    • Validate operators for variable types
  • What are the processes involved in code generation and optimization?
    • Generate machine code
    • Optimize code for efficiency and speed
  • What types of programming errors exist?
    • Syntax errors
    • Runtime errors
    • Logical errors
    • Linking errors
    • Rounding errors
    • Truncation errors