Chris Pollett> CS152
( Print View )

Student Corner:
[Submit Sec3]
[Grades Sec3]

[Lecture Notes]
[Discussion Board]

Course Info:
[Texts & Links]
[Course Outcomes]
[Outcomes Matrix]
[Course Schedule]
[Class Protocols]
[Exam Info]
[University Policies]

HW Assignments:
[Hw1] [Hw2] [Hw3]
[Hw4] [Hw5] [Quizzes]

Practice Exams:
[Midterm] [Final]

CS152 Fall 2021 Practice Midterm

Studying for one of my tests does involve some memorization. I believe this is an important skill. Often people waste a lot of time and fail to remember the things they are trying to memorize. Please use a technique that has been shown to work such as the method of loci. Other memorization techniques can be found off the Wiki Page for Moonwalking with Einstein. Given this, to study for the midterm I would suggest you:

  • Know how to do (by heart) all the practice problems.
  • Go over your notes at least three times. Second and third time try to see how much you can remember from the first time.
  • Go over the homework problems.
  • Try to create your own problems similar to the ones I have given and solve them.
  • Skim the relevant sections from the book.
  • If you want to study in groups, at this point you are ready to quiz each other.

The practice midterm is below. Here are some facts about the actual midterm: (a) It is closed book, closed notes. Nothing will be permitted on your desk except your pen (pencil) and test. (b) You should bring photo ID. (c) There will be more than one version of the test. Each version will be of comparable difficulty. (d) One problem (less typos) on the actual test will be from the practice test.

Work in your assigned groups to solve your assigned problems below. Post your solutions to the Practice Midterm Solution Thread.

  1. Define and give an example: (a) Functional Programming Language, (b) Dataflow Programming Language, (c) Logic-base Programming Language, (d) von Neumann Programming Language.
  2. Short answer: (a) If your C program consists of only one file, why may a linker still be used? (b) In Java, the Class.load() might be used as a loader for a class. How is the loader for a compiled C program typically invoked (either *nix or Windows)? (c) What is a self-hosting compiler? (d) How does compiler bootstrapping work for self-hosting compilers?
  3. Give four concrete examples of how a symbol table might be used as part of semantic analysis of a C program.
  4. A file cartesian.txt consists of a sequence of lines of the form:
    For example,
    Assume foo.txt fits into the RAM available. Write a C program which reads foo.txt into an array of structs where each struct instance represents one point in polar coordinates. Finally, write as part of your program a loop which outputs the angle of each such point on a line by itself.
  5. Explain how Makefiles work. Make sure to indicate how to use variables in make files and notations like $@ and $<. Give an example make with more than one target and with a clean target.
  6. Show step-by-step how our procedure from class would convert the regular express (a|b)(0|1)* to an NFA.
  7. Give a context-free grammar that might be suitable for expressions built out of id, +, *, -.
  8. Briefly explain: (a) What is LL parsing versus LR parsing, (b) For a grammar symbol A, First(A), Follow(A), (c) How to set up a lexer to be used with Yacc, (d) how to tell Yacc to parse a string.
  9. Define the following concepts related to stack and heap based allocation: (a) frame pointer, (b) calling sequence, (c) buddy system heaps, (d) garbage collection.
  10. Explain how scoping works in: (a) early BASIC, (b) Fortran 77, (c) Rust with respect to let statements. Explain and give an example of how borrowing works in Rust.