CIS 2750 UPDATED EXAM SCRIPT QUESTIONS AND
ANSWERS MARKED A+
✔✔XSD - ✔✔XML Schema Definition (came after DTDs)
✔✔DTD - ✔✔Document Type Definition
✔✔Valgrind - ✔✔memory debugging tool, checks leaks, diagnoses memory errors
✔✔Valgrind definitely lost - ✔✔leaking memory --> allocated and never freed
✔✔Valgrind indirectly lost - ✔✔leaking memory in pointer based structure (should go
away with definitely lost errors)
✔✔Valgrind possibly lost - ✔✔weird stuff w/ pointers. probably won't see
✔✔Still reachable - ✔✔memory wasn't freed but still reachable and program is ok
✔✔Program scope - ✔✔accessible by all source files that make up exe
✔✔File Scope - ✔✔accessible from declaration to end of file
static in C means public to file
✔✔Function scope - ✔✔accessible through a function
✔✔block scope - ✔✔accessible w/in {} it was declared in
✔✔Automatic storage - ✔✔fresh temp copy create on stack each time function is called
✔✔Static storage - ✔✔only one instance of the var in the exe
✔✔Dynamic storage - ✔✔created temporarily on the heap (malloced/calloced/realloced)
must be explicitly freed
✔✔Error Types + severities - ✔✔types:
- external data or conditions
- erroneous internal usage
- rare conditions
Severities
- fatal (meaningless for program to continue)
- nonfatal (recovery may be possible)
✔✔Assertions - ✔✔assert(expression)
can make partial functions and that's BAD
, ✔✔Types - ✔✔continuous, used to make code more readable, offload error checking
onto compiler, helps avoid precision issues
✔✔Typedef - ✔✔used to create aliases or shorthand notation for C types
typedef struct Vec2 Vector;
✔✔What to check for in defensive programming - ✔✔external inputs
extreme values
internal
pre and post conditions
✔✔Black box testing - ✔✔consider only public interface
apply inputs, examine outputs, compare to spec
✔✔White box testing - ✔✔Looking at source code, tests exercise basically all paths: all
logical decisions, all loops at their bounds, internal data structures
✔✔3 Steps for best tests - ✔✔- note potential problems as you design and implement
(document all loops and bounds, all arrays and boundary conditions, variables and
range of values, parameters from cmd line, into funcs, and their valid/invalid values)
- test systematically, bottom up
- within a module, test incrementally as you code
✔✔TDD - ✔✔Test Driven Development
- frontloads dev w/ testing
- ensures software meets spec at any point in time
✔✔Scaffolding - ✔✔Built to make it easy to test code
- stubs
- drivers
- dummy files
✔✔Stubs - ✔✔low-level module of dummy code that can be called by higher-level
module being tested
✔✔Driver - ✔✔fake module that calls real module being tested (also called a test
harness)
✔✔Dummy File - ✔✔small version of real data file that has same types of components
as that file
✔✔C Language Standards - ✔✔Appeared in early 70s
ANSI C standardized 1989
ANSWERS MARKED A+
✔✔XSD - ✔✔XML Schema Definition (came after DTDs)
✔✔DTD - ✔✔Document Type Definition
✔✔Valgrind - ✔✔memory debugging tool, checks leaks, diagnoses memory errors
✔✔Valgrind definitely lost - ✔✔leaking memory --> allocated and never freed
✔✔Valgrind indirectly lost - ✔✔leaking memory in pointer based structure (should go
away with definitely lost errors)
✔✔Valgrind possibly lost - ✔✔weird stuff w/ pointers. probably won't see
✔✔Still reachable - ✔✔memory wasn't freed but still reachable and program is ok
✔✔Program scope - ✔✔accessible by all source files that make up exe
✔✔File Scope - ✔✔accessible from declaration to end of file
static in C means public to file
✔✔Function scope - ✔✔accessible through a function
✔✔block scope - ✔✔accessible w/in {} it was declared in
✔✔Automatic storage - ✔✔fresh temp copy create on stack each time function is called
✔✔Static storage - ✔✔only one instance of the var in the exe
✔✔Dynamic storage - ✔✔created temporarily on the heap (malloced/calloced/realloced)
must be explicitly freed
✔✔Error Types + severities - ✔✔types:
- external data or conditions
- erroneous internal usage
- rare conditions
Severities
- fatal (meaningless for program to continue)
- nonfatal (recovery may be possible)
✔✔Assertions - ✔✔assert(expression)
can make partial functions and that's BAD
, ✔✔Types - ✔✔continuous, used to make code more readable, offload error checking
onto compiler, helps avoid precision issues
✔✔Typedef - ✔✔used to create aliases or shorthand notation for C types
typedef struct Vec2 Vector;
✔✔What to check for in defensive programming - ✔✔external inputs
extreme values
internal
pre and post conditions
✔✔Black box testing - ✔✔consider only public interface
apply inputs, examine outputs, compare to spec
✔✔White box testing - ✔✔Looking at source code, tests exercise basically all paths: all
logical decisions, all loops at their bounds, internal data structures
✔✔3 Steps for best tests - ✔✔- note potential problems as you design and implement
(document all loops and bounds, all arrays and boundary conditions, variables and
range of values, parameters from cmd line, into funcs, and their valid/invalid values)
- test systematically, bottom up
- within a module, test incrementally as you code
✔✔TDD - ✔✔Test Driven Development
- frontloads dev w/ testing
- ensures software meets spec at any point in time
✔✔Scaffolding - ✔✔Built to make it easy to test code
- stubs
- drivers
- dummy files
✔✔Stubs - ✔✔low-level module of dummy code that can be called by higher-level
module being tested
✔✔Driver - ✔✔fake module that calls real module being tested (also called a test
harness)
✔✔Dummy File - ✔✔small version of real data file that has same types of components
as that file
✔✔C Language Standards - ✔✔Appeared in early 70s
ANSI C standardized 1989