
Final exam: Tuesday
December 13, 8:10-10:00 in Sloan 9.
Notes:
1. The exam is about 30% longer than the
midterm, but you have 110 minutes rather than 50 minutes
2. The exam is NOT comprehensive, except for two
things:
·
Debug macros
·
Shell file name
expansion
Final Exam Topics
- Very basics: what
they do, advantage over mental analysis & interactive debuggers; also
what assert is.
- Questions from
midterm:
- (6
points) Describe how the assert
macro works and how you use it in a program, and who its output is
intended for.
- (5
points) What advantage does the TRACE
macro discussed and demonstrated in class have over debugging with just fprintf or printf directly in your code?
- (7
points) Explain when and how the TRACE
macro output is “turned on” (enabled” or
“turned off” (disabled). If there is more than one way to
do it, which is “best”, and why?
- (3
points) What advantage does the DEBUG
macro package discussed and demonstrated in class have over debugging
with the TRACE macro?
- Given a regular
expression, understand what it will (and won't) match.
- Given an English
phrase, come up with a regular expression that matches it
- Be able to do the
above two things also with shell
file name expansion
- Given a sed command,
understand what the output will be.
- In s/OLD/NEW/g, how to use part
(or all) of what is matched in OLD with NEW (e.g., \1)
- Given an awk script, tell
what it does.
- Write a simple awk script
for a given problem.
- How to use something other
than a newline for a record delimeter (see man page… there are two
ways to do it, just know one)
- Given a shell script, tell
what it does.
- Write a simple shell script
for a given problem
- Given a perl script, tell
what it does.
- Know some of the main
language features, especially lists, arrays,
and associative
arrays.
- Know the basics of Functions,
Misc.
Control Structures, and Files.
- If you can do some things
more than on way in Perl, be able to give more than one example! (E.g.,
ways to load in a key, value pair into an associative array.)
- Language differences (sed, awk, shell, perl)
- Understand the differences
in the languages; an outstanding review can be found at the Perl
traps page, and anything here is fair game.
- Know how "if-then-else
if-else" is constructed in each language.
- Know what $0 means in each
language.
- Know what $1, $2, $3, etc.
means in each language.
- Know how to get command
line arguments (except for sed).
- Know why you might want to
use one language instead of the other.
- Typing differences: what
happens for example if you go (except for sed)
- set a to 2
- set b to “foo”
- set c to a plus b
- I am not interested in teaching the very fine details (minutia) or
rare boundary cases of syntax/semantics of a language, so focusing on
that will help you at most a point or two, probably zero. I just want you to be as
reasonably versed as the number of lectures and homework assignments can
reasonably make a sophomore be.