








Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!









1 Delta Debugging (13 points)
1 int macaroni ( int s ) { 2 int * x = NULL ; 3 4 x = ( int *) malloc ( s * 1024 * 1024 * 1024 * sizeof ( int )); 5 6 if ( x == NULL ) { 7 return -1; 8 } else { 9 return 0; 10 } 11 }
2 Design Patterns (14 points)
1 class Point { 2 public int x , y ; 3 public Point ( int _x , int _y ) { x = _x ; y = _y ;} 4 } 5 class Game { 6 Player players [32]; // 32 players 7 public startGame () { 8 for ( int i =0; i <32; i ++) 9 this - > players [ i ] = new Player (); 10 11 while ( true ) { 12 // main game loop 13 for ( int i =0; i <32; i ++) 14 players [ i ]. move ( random () , random () ); 15 16 for ( int i =0; i <32; i ++) { 17 for ( int j =0; j <32; j ++) { 18 if ( i == j ) continue ; 19 players [ i ]. updateOtherPlayer ( players [ j ]); 20 } 21 } 22 } 23 } 24 } 25 class Player { 26 public Point pos ; // position 27 public Player () { 28 // constructor 29 pos = new Point (0 ,0); 30 } 31 public void move ( int _x , int _y ) { 32 // move player to new position 33 pos = new Point ( _x , _y ); 34 } 35 public Point updateOtherPlayer ( Player p ) { 36 // update information about another player 37 Point otherPos = p. pos ; 38 this. updateGameScreen ( p , p. pos ); 39 } 40 }
1 ... ( other stuff from Game ) ... 2 public void updateAllPlayers ( Player p ) { 3 for ( int i =0; i <32; i ++) { 4 if ( players [ i ] == p ) continue ; 5 this. players [ i ]. updateOtherPlayer ( p ); 6 } 7 } 8 ... ( other stuff ) ...
4 Software Engineering Narrative (15 points)
A. Conditional Breakpoint B. Creational Design Pattern C. Defect D. Fault E. Fault Localization F. Feature Request G. Priority H. Profiling I. Requirements Elicitation J. Singleton Design Pattern K. Stakeholder L. Swiss Cheese Model M. Traceability N. Triage O. Watchpoint
5 Interviewing (17 points)
1 def findDuplicate ( nums ): 2 for i in range ( len ( nums )): 3 for j in range ( len ( i )): 4 # consider each pair of numbers 5 if nums [ j ] == nums [ i ]: 6 # bail on the first match 7 return nums [ i ] 8 return None
1 def findDuplicate ( nums ): 2 nums. sort () 3 for i in range ( len ( nums )): 4 if nums [ i ] == nums [ i + 1]: 5 return nums [ i ] 6 raise Exception ( ’ No pairing ’)
1 def findDuplicate ( nums ): 2 for i in range ( len ( nums )): 3 for j in range ( len ( nums )): 4 if nums [ j ] == nums [ i ]: 5 return nums [ i ] 6 return None
7 Extra Credit (1 pt each; we are tough on reading questions)