• Home
  • Queen's University
  • Software Specifications
  • Final Exam Instructions and Questions for CISC/CMPE-223

Final Exam Instructions and Questions for CISC/CMPE-223

Do all 10 questions.Student#: HAND IN Answers recorded on exam paper CISC/CMPE-223 Exam, April 17, 2019 Page 1 of 12 Queen's University, Faculty of Arts and Science, School of Computing CISC-223/CMPE-223 Final Exam, April 17, 2019 (Instructor: Kai Salomaa) INSTRUCTIONS · Aids allowed: You may bring in one 8.5 x 11 inch sheet of paper containing notes, and use it during the exam. The sheet can be written/printed on both sides. . This examination is THREE HOURS in length. Answer all 10 questions. . Answer each question in the space provided (on the question paper). There are two extra pages at the end of the exam, if more space is needed. Please write legibly. PLEASE NOTE: Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. STUDENT NUMBER: One digit in each square, please! STUDENT NUMBER (written in words): Circle your course: CISC CMPE Problem 1 /4 Problem 2 /6 Problem 3 /3 Problem 4 /4 Problem 5 Problem 6 15 Problem 7 /5 Problem 8 /6 Problem 9 /5 Problem 10 /6 Total /50 /6 IMPORTANT HAND IN Answers recorded on exam paper This material is copyrighted and is for the sole use of students registered in CISC/CMPE 223 and writing this exam. This material shall not be distributed or disseminated. Failure to abide by these conditions is a breach of copyright and may also constitute a breach of academic integrity under the University Senate's Academic Integrity Policy Statement. CISC/CMPE-223 Exam, April 17, 2019 Page 2 of 12 Do all 10 questions. Student#: 1. Consider the context-free grammar S > aaaSb | Sb | & Here S is the start nonterminal, and a, b are terminals. (i) Give a parse tree for the string aaabb. (ii) Give a parse tree for the string bbb. (iii) Is the above grammar ambiguous? Justify your answer. (iv) Is the language generated by the grammar regular? Circle the correct answer: YES NO (The answer to (iv) does not require an explanation.) CISC/CMPE-223 Exam, April 17, 2019 Page 3 of 12 Do all 10 questions. Student#: 2. Verify the validity of the following correctness statements by adding all the interme- diate assertions (that is, give the proof tableau). All variables are of type int. Clearly state any mathematical facts and inference rules used. (i) ASSERT( x >= 5 ) y = x - 2; z = y - 5; x = y + z; ASSERT( y >= z+1 && z <= x+y ) (ii) ASSERT( x > 4 && y == 7 ) x = x - y; y = y - x; x = x + y; ASSERT( x == 7 && y < 10 )