Name (print *CLEARLY*): _________________________________________________


Student ID (print *CLEARLY*; 1 digit per underline): _____ _____ _____ _____ _____ _____

CSE 231s Quiz 16: Futures

For the code below, which statements can run in parallel with each other?

Future<Integer> A = future(() -> {
    S1();
    
return 7;
});

Future<Integer> B = future(() -> {
    S2();
    
int a = A.get();
    S3();
    
return a + 20;
});

Future<Integer> C = future(() -> {
    S4();
    
int b = B.get();
    S5();
    
int a = A.get();
    S6();
    
return a * b + 1;
});

Future<Integer> D = future(() -> {
    S7();
    
return 2;
});

S1:___________________________


S2:___________________________


S3:___________________________


S4:___________________________


S5:___________________________


S6:___________________________


S7:___________________________