CS 5346: Advanced Artificial Intelligence

advertisement
Department of Computer Science
Graduate Comprehensive Exam
in
Software Engineering
Spring 2001
Directions:







Answer the questions on the paper supplied.
Answer question 1. Answer question 2. Answer question 3.
Start each question on a new page.
Write on only one side of the paper.
Write your SSN in the top right corner of each page of your answer. Do NOT put your name anywhere
on the answers.
Put the number of the question being answered in the top left corner of each page of your answer.
If the answer to a question is written on more than one page, number the pages consecutively.
1. CS5391 Survey of Software Engineering
What affect does the choice of life cycle model have on the design process? Describe how
the design process works within the various life cycle models (linear sequential, prototyping,
incremental, spiral). How does the choice of life cycle model affect the software testing
process? What is the relationship between life cycle models and the capability maturity
model?
2. CS 5392 Formal Methods in Software Engineering
Describe the following concepts as they relate to class diagrams in the UML:
 Perspective
 Associations & Roles
 Attributes & Operations
 Generalization
 Aggregation & Composition
 Interfaces
 Parameterized Classes
3. CS 5393 Software Quality
Given the following two implementation of the same algorithm, answer these questions:
1.
2.
3.
4.
Define a strategy for black box testing of these two algorithms.
Define a strategy for white box testing of these two algorithms.
Can these algorithms be validated? Explain
In order to validate the algorithms with full path coverage, how many tests are required
for each algorithm?
5. If it requires .03 seconds per test, what should be my path testing strategy?
6. Which algorithm should I put into production based on its quality?
Algorithm Implementation 1:
/* Eratosthenes' algorithm for identifying prime numbers
Written by:
Peter Holcroft
University of Hull, United Kingdom
This is one way of implemeting Eratosthenes' algorithm in Java. Just
change "max" to set the size of N, and "startat" for setting where to
start displaying the prime numbers from.
*/
import java.lang.*;
class sieve {
static
static
static
static
final int max = 100;
final int startat = max - 100;
int n = max;
double limit;
// Set the size of the problem
// Display primes from this value
public static void main (String [] args) {
// Create array and set all values to true
boolean numberpool [] = new boolean [n];
for (int i=2; i<n; i++){
numberpool[i]=true;
}
limit = Math.sqrt(n);
int j=2;
for (int i=j+j; i<n; i=i+j){
numberpool[i]=false;
}
//
//
//
//
Find square root of n
do all multiples of 2 first
start with 2j as j is prime
set all multiples to false
for (j=3; j<=limit; j=j+2){
if (numberpool[j]==true){
for (int i=j+j; i<n; i=i+j){
numberpool[i]=false;
}
}
}
//
//
//
//
do up to sqrt of n
only do if j is a prime
start with 2j as j is prime
set all multiples to false
// Display results
System.out.println("Prime Numbers from " + startat + " to " + max +
":");
for (int i=startat; i<max; i++){
if (numberpool[i]==true){
System.out.print(i + " ");
}
}
}
}
Algorithm Implementation 2:
#include <stdio.h>
#include <malloc.h>
#include <time.h>
#define TEST(f,x) (*(f+(x)/16)&(1<<(((x)%16L)/2)))
#define SET(f,x) *(f+(x)/16)|=1<<(((x)%16L)/2)
void main(int argc, char *argv[])
{
unsigned char *feld=NULL, *zzz;
unsigned long teste=1, max, mom, hits=1, count, alloc, s=0, e=1;
time_t begin;
if (argc > 1)
max = atol (argv[1]) + 10000;
else
max = 14010000L;
while (feld==NULL)
zzz = feld = malloc (alloc=(((max-=10000L)>>4)+1L));
for (count=0; count<alloc; count++) *zzz++ = 0x00;
printf ("Searching prime numbers to : %ld\n", max);
begin = time (NULL);
while ((teste+=2) < max)
if (!TEST(feld, teste)) {
if (++hits%2000L==0) {printf (" %ld. prime number\x0d",
hits); fflush(stdout);}
for (mom=3L*teste; mom<max; mom+=teste<<1) SET (feld, mom);
}
printf (" %ld prime numbers foundn %ld secs.\n\nShow prime numbers",
hits, time(NULL)-begin);
while (s<e) {
printf ("\n\nStart of Area : "); fflush (stdout); scanf ("%ld", &s);
printf ("End
of Area : ");
fflush (stdout); scanf ("%ld", &e);
count=s-2; if (s%2==0) count++;
while ((count+=2)<e) if (!TEST(feld,count)) printf ("%ld\t", count);
}
free (feld);
}
Download