- | P a g e
CS 326 MIDTERM EXAM NEWEST 2025 ACTUAL
EXAM COMPLETE 100 QUESTIONS AND
CORRECT DETAILED ANSWERS (VERIFIED
ANSWERS) |ALREADY GRADED A+ ||BRAND
NEW!!
Name logic and constraint based languages - ANSWER-Prolog
Explain machine language - ANSWER--sequence of bits that directly controls the processor -add, compare, move data, etc.-computer's time more valuable than programmer's time
Explain assembly language - ANSWER--Mnemonic abbreviations, 1-1 correspondence to machine language -Translated by an assembler -Still machine dependent
- / 4
- | P a g e
Explain high level languages, the first being Fortran and Lisp - ANSWER--Translated by a compiler or interpreter -No more 1-1 correspondence to machine language -accepted when compilers could produce efficient code
-Today: efficient compilers, large programs, high maintenance
costs, rapid development requirements -labor cost higher than hardware cost
Explain the main differences between a compiler and an interpreter - ANSWER-A compiler translates into target language, then goes away and the target program is the locus of control at execution time. An interpreter stays around at execution time and is a virtual machine whose machine language is the high level language
Describe the benefits of interpretation - ANSWER--greater flexibility -allow program feature to depend on the input
-Lisp, Prolog: program can write new pieces of itself and
execute them on the fly
-java: compilation, then interpretation
- / 4
- | P a g e
Describe the benefits of compilation - ANSWER--better performance -many decisions are made only once at compile time, not every run time -Fortran, C
List the phases of front end compilation - ANSWER-Character stream => scanner(lexical analysis) => token stream => parser(syntax analysis) =>parse tree => semantic analysis and intermediate code generation
List the phases of back end compilation - ANSWER-Semantic analysis and intermediate code generation => -abstract syntax free or other intermediate form => machine independent code improvement(optional) => modified intermediate form => target code generation => assembly or machine language or other target language => machine specific code improvement (optional) => modified target language == symbol table
What are regular languages? - ANSWER-A subset of context free ones
- / 4
- | P a g e
What is a formal language? - ANSWER-A set of strings of symbols drawn from a finite alphabet
Name the qualities of a scanner - ANSWER-− ignores white space (blanks, tabs, new-lines) − ignores comments − recognizes tokens − implemented as a function that returns next token every time it is called
Name the qualities of a parser - ANSWER-− calls the scanner to obtain tokens − builds parse tree − passes it to the later phases (semantic analysis, code generation and improvement)
What can expressions be in Scheme - ANSWER-atoms or lists
What is an atom in Scheme? - ANSWER-a number, string, identifier, character, or boolean
- / 4