{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

sample-midterm

# sample-midterm - EECS 280 Midterm Fall 2006 This is a...

This preview shows pages 1–6. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Uniqname:________________________________________________________________________________ EECS 280 Fall 2006 2
Uniqname:________________________________________________________________________________ EECS 280 Fall 2006 3 Problem 1 _________ out of 20 Problem 2 _________ out of 20 Problem 3 _________ out of 20 Problem 4 _________ out of 20 Problem 5 _________ out of 20 Total: ________ out of 100

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Uniqname:________________________________________________________________________________ EECS 280 Fall 2006 4 1 Test Cases In the following problems, you are given a specification of a function. For each function, supply the requested number of *simple* test cases and the required number of *boundary-condition* test cases. For each test case, you must give a description of (a) the test case, (b) the expected behavior for a correct implementation of the function, and (for boundary cases) (c) why the case is a boundary case. Please give English descriptions of your test cases, in sufficient detail. For full credit, your cases collectively should provide maximum coverage of behavior. For example, consider the following function: int gcd(int x, int y); // EFFECTS: returns the greatest common denominator of x, y One simple test case might be: a) pass 8 and 4 as arguments b) should return 4. Two boundary test cases might be: a) pass 15 and 64 as arguments b) should return 1 c) they are relatively prime - tests termination condition. a) pass 8 and -4 as arguments b) should return 4 c) gcd may not handle negative numbers correctly
Uniqname:________________________________________________________________________________ EECS 280 Fall 2006 5 1.a Palindromes isPal takes a C-style string, and determines if it is a palindrome. bool isPal(const char* s); // REQUIRES: s is a NUL-terminated C-string. // EFFECTS: true if s is a palindrome, false otherwise. // (a palindrome is a word that reads the same forwards and // backwards. i.e. "mom", "noon", "racecar") Provide TWO simple (expected) test cases.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}