Faculty of Information Technology Department of Software Engineering Examination Paper Philadelphia University Lecturer : Dr. Ali Fouad Coordinator : Dr. Ali Fouad Internal Examiner : Moayad A. Al-athami Software Reengineering (721421) First Exam First Semester of 2014-2015 Date: 27-11-2014 Time: 50 minutes Information for Candidates 1.This examination paper contains four questions, totaling 22 marks. 2.The marks for parts of questions are shown in round brackets. Advice to Candidates 1. You should attempt all questions. 2. You should write your answers clearly. I. Basic Notions Objectives. The aim of the questions in this part is to evaluate the required minimal student knowledge and skills. Answers in the pass category represent the minimum acceptable standard. Question 1: (6 marks) Select for each question the correct answer 1. Modifying the software to match changes in the ever changing environment is called (A) adaptive maintenance (B) corrective maintenance (C) perfective maintenance (D) preventive maintenance Ans: A 2. Your customer has asked you to make your chess playing software be able to play checkers. What type of maintenance does this change entail? a) Corrective maintenance b) Perfective maintenance c) Adaptive maintenance d) Preventive maintenance ANSWER: : A 3. Which code reading strategy is most appropriate when reading code written in a language with which you are not familiar? (A)Top-down reading. (B)Bottom-up reading. (C)Hybrid (opportunistic) strategy. (D)No strategy is more appropriate than any other. Ans: D 4. Changes made to the system to reduce the future system failure chances is called (A) Preventive Maintenance (B) Adaptive Maintenance (C) Corrective Maintenance (D) Perfective Maintenance Ans: A 5. The task that performed to identify, isolate, and fix a fault so that the failed system can be restored is called (a) Corrective maintenance (b) Perfective maintenance (c) Adaptive maintenance (d) Preventive maintenance 6. Purpose of reverse engineering is to (a) recover information from the existing code or any other intermediate document (b) redocumentation and/or document generation (c) understand the source code and associated documents (d) All of the above II. Familiar Problems Solving Objectives. The aim of the questions in this part is to evaluate that the student has some basic knowledge of the key aspects of the lecture material and can attempt to solve familiar problems. Question 2: (7 marks) Consider the following piece of code: Procedure AVG S1 count = 0 S2 fread(fptr, n) S3 while (not EOF) do S4 if (n < 0) S5 return (error) and exit else S6 nums[count] = n S7 count ++ endif S8 fread(fptr, n) endwhile S9 avg = mean(nums,count) S10 return(avg) 1. Draw control flow graph (statement number is a node in CFG graph). 2. Find all post dominate nodes for node s3 DOM(6)={1,2,3,6} 3. Is node s3 is dependent on s4, why? Question 3: (5 marks) Use static slicing method to extract from the following, code finds minimum value: main() { 1. int x, n, av; 2. int t, s, c; 3. 4. t = readInt(): 5. x = t; 6. n = t; 7. s = t; 8. c = 1; 9. 10. while(t >= 0) 11. { 12. if (x < t) 13. x = t; 14. if (n > t) 15. n = t; 16. s = s + t; 17. c=c+1 ; 18. t = readInt(); 19. } 20. 21. a = s / c; 22. printf(“%d”, x); 23. printf(“%d”, n ); 24. printf(“%d”, a); } Answer: Slice= {1, 2, 4, 6, 10, 11, 14, 15, 18, 19, 23} each 0.5 III. Unfamiliar Problems Solving Objectives. The aim of the questions in this part is to evaluate that the student can solve familiar problems with ease and can make progress towards the solution of unfamiliar problems, and can set out reasoning and explanation in a clear and coherent manner. Question 5: (4 marks) Understand the following program using the understanding techniques introduced in the lectures and determine what your suggested idioms to reach the final conclusion. PVMR () { 1 Int Matrix [4, 4]; 2 int Save; 3 I = 1; 4 While (I <= 3) do 5 { J=1; 6 while (J<=3) do 7 { Save = Matrix [I, J]; 8 if (I==J) { 9 Save = Matrix [I, J]; 10 Matrix [I, J] = Matrix [J, I]; 11 Matrix [J, I] = Save; } 10 J = J + 1; 11 } 12 } 13 I =I + 1; 14 } } 1. We recognize the idiom permutation of two values 2. We recognize the idiom processing of Set Values. The processing deals with permutations. So, we recognized the permutation of values of a set 3. We recognize the idiom: the processing deals here with the permutation of values of a set. So, we recognized that the program, deals with permutation of values of a set which are set too. This is the permutation of values of a set having two dimensions: