|
UNIVERSITY OF WISCONSIN
Computer Sciences Department | ||
|
CS 537
Fall 2012 |
Barton Miller | |
| Quiz #1
Tuesday, September 25 |
||
| Problem 1 | |
Initialization
int X = 0; int Y = 0; | |
Process A
for (; X < 4; X++) {
Y = 0;
printf ("%d", X);
Y = 1;
}
|
Process B
while (X < 4) {
if (Y == 1)
printf ("a");
}
|
|
Describe the output here:
A slightly more verbose description is:
|
|
| Problem 2 | |
Initialization
int X = 0; int Y = 0; |
|
Process A
while (X == 0) {
// do nothing
}
printf ("a");
Y = 1;
Y = 0;
printf ("d");
Y = 1;
|
Process B
printf ("b");
X = 1;
while (Y == 0) {
// do nothing
}
printf ("c");
|
|
Describe the output here:
The output will be either:
|
|