Semantic Function in Denotational Semantics
. P A U L ’S S T UN ST. PAUL’S UNIVERSITY I VE R S I TY SE R TY VANT S OF GO D AND HUMANI Private Bag 00217 Limuru, KENYA Tel: 020-2020505/2020510/0728-669000/0736-424440 SCHOOL OF COMMUNICATION AND COMPUTER STUDIES UNIVERSITY EXAMINATIONS MAY – AUGUST 2023/2024 SEMESTER BACHELOR OF SCIENCE IN COMPUTER SCIENCE UNIT CODE: CSC 3101 UNIT TITLE: PRINCIPLES OF PROGRAMMING LANGUAGES DATE: AUGUST, 2023 TIME: 2 Hours INSTRUCTIONS: 1. Answers ALL Questions. 2. Submit your answers in word format unless otherwise instructed. Type your answers in a word document. Do not PDF your document. 3. Submit your answers via the V-learning platform. 4. For images (photographs, graphs and calculations etc ), use legible writing. Take an image (Photo) of all the answer sheets and submit via the V-learning platform. Remember to number the answer sheet pages. NOTE: No submissions will be accepted in any other mode e.g. emails, WhatsApp etc. 5. The examinations start at 8.00am and all the answer scripts MUST be posted on the portal by 8.00am the following day (within 24 hours). 6. Submit your answer sheets as one document. Click the “SUBMIT” button to ensure that your answer sheet is uploaded in the portal. 7. Allow yourself enough time to confirm that your submission has gone through. You will receive an automated email receipt on successful submission. NOTE: Submission deadlines must be observed. 8. On the front page of each answer script you are required to observe the following instructions: − − − Write your student number in full Write the unit code and title Write the date of examination − Write “SUPPLEMENTARY” or “DEFFERED EXAM” as the case may be, (if you are taking a supplementary or deferred examination). − Write the name of the lecturer QUESTION ONE (15 MARKS) a) Using proof tree in operational Semantics, Show that -(*(/(8,4), 2), 2) evaluates to 2 (6 Marks) b) In denotational Semantics, Semantic Function(M) is represented as: M: B → N where N is a set of Natural numbers including 0 and B is the domain string of binary numbers. Using the five rules of Denotational Semantics for binary addition, show that: M[[010 1100 ⊕ 001 0110]] = 66 = M[[100 0010]]. NB: show ALL steps. (9 marks) QUESTION TWO (15 MARKS) a) Given a CFG below, use bottoms up parsing to parse the string “abbcbcbcde” (6 marks) S → aABe A → Abc | b B→d b) Show the three-address code for the expression “x:= y*-z + y/z ” and indicate all the temporary variables. (4 marks) c) Represent the following expression “a*b + d/c” i) Using AST (3 Marks) ii) Using a parse tree. (2 Marks) ***************************END OF EXAM ********************************
Collepals.com Plagiarism Free Papers
Are you looking for custom essay writing service or even dissertation writing services? Just request for our write my paper service, and we'll match you with the best essay writer in your subject! With an exceptional team of professional academic experts in a wide range of subjects, we can guarantee you an unrivaled quality of custom-written papers.
Get ZERO PLAGIARISM, HUMAN WRITTEN ESSAYS
Why Hire Collepals.com writers to do your paper?
Quality- We are experienced and have access to ample research materials.
We write plagiarism Free Content
Confidential- We never share or sell your personal information to third parties.
Support-Chat with us today! We are always waiting to answer all your questions.