Question Marks 1 /11 2 /4 3 /13 4 /5 5 /11 6 /14 7 /32 8 /6 9 /11 10 /10 Total /117

Size: px
Start display at page:

Download "Question Marks 1 /11 2 /4 3 /13 4 /5 5 /11 6 /14 7 /32 8 /6 9 /11 10 /10 Total /117"

Transcription

1 CSC 326, Midterm November 3, 2005 Name: Student ID: Signature: You have 75 minutes to write the 10 questions on this examination. A total of 117 marks is available. Justify all of your answers You may use one sheet of handwritten notes. Keep your answers short. If you run out of space for a question, you have written too much. The number in square brackets to the right of the question number indicates the number of marks allocated for that question. Use these to help you determine how much time you should spend on each question. Use the back of the page for rough work. Question Marks 1 /11 2 /4 3 /13 4 /5 5 /11 6 /14 7 /32 8 /6 9 /11 10 /10 Total /117 Good luck UNIVERSITY REGULATIONS: No candidate shall be permitted to enter the examination room after the expiration of one half hour, or to leave during the first half hour of the examination. CAUTION: Candidates guilty of any of the following, or similar, dishonest practices shall be immediately dismissed form the examination and shall be liable to disciplinary action. 1. Making use of any books, papers or memoranda, electronic equipment, or other memory aid devices, other than those authorized by the examiners. 2. Speaking or communicating with other candidates. 3. Purposely exposing written papers to the view of other candidates. The plea of accident or forgetfulness shall not be received. 1

2 Language Design Issues Question 1 [11 points] [3/11] What are the 3 criteria by which the characteristics of a programming language are evaluated? [4/11] Give an argument for and one against operator overloading with respect to the readability of a program. [2/11] What is process abstraction? (Question 1 continued on next page) 2

3 Language Design Issues [2/11] What is aliasing? (End of question 1) 3

4 Java Question 2 [4 points] Fill in the blank boxes in the picture below with the name of the type of data that flows between the components in the Java hybrid compilation/interpretation model. Source Lexical Analyzer Parser Code Generator Interpreter (End of question 2) 4

5 Question 3 [13 points] Consider the following EBNF: Context Free Languages and EBNF E E + E E E id ǫ [10/13] Show 2 left-most derivations of the string id+id id and draw the corresponding parse trees. [3/13] If two or more derivations of the same string exists, are they always of the same derivation length? Why/why not? (End of question 3) 5

6 Question 4 [5 points] Compute the weakest precondition for Weakest Precondition x = x + y - 3 { x > 10} (End of question 4) 6

7 Denotational Semantics Question 5 [11 points] Consider the following denotational semantic function: M bin [ 0 ] = 0 M bin [ 1 ] = 1 M bin [ xxx0 ] = 2 M bin [ xxx ] M bin [ xxx1 ] = 2 M bin [ xxx ] + 1 This function maps binary strings to decimal values. That is, M bin : {0,1} IN. [8/11] Create a function M o2b [...] that maps octal strings to binary strings. That is, M o2b : {0,1,2,3,4,5,6,7} {0,1} [3/11] Can you write a function M o2d [...] that maps octal strings to decimal numbers in just one line? That is a function M o2d [...] : {0,1,2,3,4,5,6,7} IN. (End of question 5) 7

8 Question 6 [14 points] Formal Languages and Lexical Analysis [3/14] Why can a programming language not be described by regular expressions. [3/14] Describe in words the language (B) of the following regular expression: (ab) (a b ) c [4/14] Determine if the following strings are in L(B) c abab ab bbab (Question 6 continued on next page) 8

9 Formal Languages and Lexical Analysis [4/14] Can you simplify B without changing L(B). That is, rewrite B to be simpler without changing the set of strings it can generate. (End of question 6) 9

10 Parsing Question 7 [32 points] [2/32] What sort of derivation is emulated by a bottom-up parser? [3/32] Explain how to write a recursive descent parser. [2/32] Can A A + B id be parsed by an LL(1) recursive descent parser? If yes, show how. If no, explain why not. (Question 7 continued on next page) 10

11 Parsing [3/32] Explain the pairwise disjointness test used to determine if a language is LL(1). (Note, pairwise disjointness is a necessity for a langaueg to be LL(1) but not sufficient for it to be LL(1)). You may refer to the following general grammar line: α β 1 β 2... β n [3/32] Provide the definition of FIRST(α). [3/32] Is the following grammar LL(1)? Justify your answer A BB ab bb B ac bc c C c (Question 7 continued on next page) 11

12 Parsing [4/32] When a shift reduce parser reduces by a production A α, explain how the configuration changes and how the new state is found. You may assume that the parser is in the following configuration: (s 0 x 1 s 1 x 2 s 2...x m s m,a i a i+1...a n $) [2/32] If we assume that r = β, show the configuration after the reduction A α. [10/32] Given the following grammar and the corresponding LR parsing table on the next page parse the string (id + id) id. Use the blank table to fill in the parsing action. Rule # Production 1. E E + T 2. E T 3. T T F 4. T F 5. F (E) 6. F id 12

13 ACTION GOTO State id + * ( ) $ E T F 0 S 5 S S 6 acc. 2 R 2 S 7 R 2 R 2 3 R 4 R 4 R 4 R 4 4 S 5 S R 6 R 6 R 6 R 6 6 S 5 S S 5 S S 6 S 11 9 R 1 S 7 R 1 R 1 10 R 3 R 3 R 3 R 3 11 R 5 R 5 R 5 R 5 Stack Input Action 0 (id + id) id Shift 4 0 ( 4 id + id) id (The number of blank lines is not exactly the number you need) (End of question 7) 13

14 Types and Binding Question 8 [6 points] [2/6] What does binding mean? [2/6] What is dynamic type binding? [2/6] How does dynamic type binding and strongly typed relate? (End of question 8) 14

15 Question 9 [11 points] [5/11] Consider the following Java program. public class A { public int a = 10; public A(int a) { this b = this.a+a; } Scope } public int f () { int b = a; return b; 10 } Underline the scope of the public field a, that is, mark all lines where a reference to a is legal and refers to the field. Now consider this program: public class B { public int a = 3; public int f (int b) { return 3 + b + a; } public int g(int a) { return f (a); } } 10 [3/11] what is the result of the call (new A()).g(7) with static scoping rules? [3/11] what is the result of the call (new A()).g(7) with dynamic scoping rules? (End of question 9) 15

16 Question 10 [10 points] [2/10] List at least 4 design issues for arrays? Data Types [3/10] Briefly describe how a union type works? [2/10] What is a dangeling pointer? [3/10] Show how C++ s reference types can be implemented using C s pointer type. That is, provide a translation of C++ to C of reference type declarations and reference type use to answer this question. (End of question 10) (End of the exam) 16

Question Marks 1 /12 2 /6 3 /14 4 /8 5 /5 6 /16 7 /34 8 /25 Total /120

Question Marks 1 /12 2 /6 3 /14 4 /8 5 /5 6 /16 7 /34 8 /25 Total /120 CSC 326, Midterm October 25, 2004 Name: Student ID: Signature: You have 75 minutes to write the 8 questions on this examination. A total of 120 marks is available. Justify all of your answers You may use

More information

Question Marks 1 /20 2 /16 3 /7 4 /10 5 /16 6 /7 7 /24 Total /100

Question Marks 1 /20 2 /16 3 /7 4 /10 5 /16 6 /7 7 /24 Total /100 CSC 460/660, Midterm March 14, 2005 Name: Student ID: Signature: You have 75 minutes to write the 7 questions on this examination. A total of 100 marks is available. Justify all of your answers You may

More information

Question Marks 1 /16 2 /13 3 /12 4 /15 5 /8 6 /15 7 /8 8 /5 9 /8 Total /100

Question Marks 1 /16 2 /13 3 /12 4 /15 5 /8 6 /15 7 /8 8 /5 9 /8 Total /100 CSC 460/660, Midterm March 22, 2006 Name: Student ID: Signature: You have 75 minutes to write the 9 questions on this examination. A total of 100 marks is available. Justify all of your answers You may

More information

CPSC 121 Midterm 1 Friday October 14th, Signature: Section (circle one): 11:00 15:30 17:00

CPSC 121 Midterm 1 Friday October 14th, Signature: Section (circle one): 11:00 15:30 17:00 CPSC 121 Midterm 1 Friday October 14th, 2016 Name: Student ID: Signature: Section (circle one): 11:00 15:30 17:00 You have 70 minutes to write the 9 questions on this examination. A total of 60 marks are

More information

CPSC 320 Midterm 2. July 13, 2007

CPSC 320 Midterm 2. July 13, 2007 CPSC 0 Midterm July, 007 Name: Student ID: Signature: You have hour to write the 5 questions on this examination. A total of 0 marks are available. Justify all of your answers. Keep your answers short.

More information

CPSC 121 Sample Final Examination December 2013

CPSC 121 Sample Final Examination December 2013 CPSC 121 Sample Final Examination December 2013 Name: Student ID: Signature: You have 150 minutes to write the 11 questions on this examination. A total of 98 marks are available. Justify all of your answers.

More information

CS 411 Midterm Feb 2008

CS 411 Midterm Feb 2008 CS 411 Midterm Feb 2008 Exam number: P1: / 9 P4: / 10 P2: / 4 P5: / 9 Student Name: P3: / 7 P6: / 8 P7: / 8 SUBTOTALS: / 20 / 35 Student ID number: TOTAL: / 55 READ THIS CAREFULLY BEFORE PROCEEDING DO

More information

CPSC 121 Midterm 1 Friday February 5th, Signature: Section (circle one): Morning Afternoon

CPSC 121 Midterm 1 Friday February 5th, Signature: Section (circle one): Morning Afternoon CPSC 121 Midterm 1 Friday February 5th, 2016 Name: Student ID: Signature: Section (circle one): Morning Afternoon You have 70 minutes to write the 8 questions on this examination. A total of 60 marks are

More information

CPSC 121 Some Sample Questions for the Final Exam Tuesday, April 15, 2014, 8:30AM

CPSC 121 Some Sample Questions for the Final Exam Tuesday, April 15, 2014, 8:30AM CPSC 121 Some Sample Questions for the Final Exam Tuesday, April 15, 2014, 8:30AM Name: Student ID: Signature: Section (circle one): George Steve Your signature acknowledges your understanding of and agreement

More information

MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #1 Examination 12:30 noon, Tuesday, February 14, 2012

MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #1 Examination 12:30 noon, Tuesday, February 14, 2012 MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #1 Examination 12:30 noon, Tuesday, February 14, 2012 Instructor: K. S. Booth Time: 70 minutes (one hour ten minutes)

More information

CPSC 411, 2015W Term 2 Midterm Exam Date: February 25, 2016; Instructor: Ron Garcia

CPSC 411, 2015W Term 2 Midterm Exam Date: February 25, 2016; Instructor: Ron Garcia CPSC 411, 2015W Term 2 Midterm Exam Date: February 25, 2016; Instructor: Ron Garcia This is a closed book exam; no notes; no calculators. Answer in the space provided. There are 8 questions on 14 pages,

More information

This examination has 11 pages. Check that you have a complete paper.

This examination has 11 pages. Check that you have a complete paper. MARKING KEY The University of British Columbia MARKING KEY Computer Science 252 2nd Midterm Exam 6:30 PM, Monday, November 8, 2004 Instructors: K. Booth & N. Hutchinson Time: 90 minutes Total marks: 90

More information

MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012

MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012 MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012 Instructor: K. S. Booth Time: 70 minutes (one hour ten minutes)

More information

UNIVERSITY REGULATIONS

UNIVERSITY REGULATIONS CPSC 221: Algorithms and Data Structures Midterm Exam, 2015 October 21 Name: Student ID: Signature: Section (circle one): MWF(101) TTh(102) You have 90 minutes to solve the 8 problems on this exam. A total

More information

MIDTERM EXAM (Solutions)

MIDTERM EXAM (Solutions) MIDTERM EXAM (Solutions) Total Score: 100, Max. Score: 83, Min. Score: 26, Avg. Score: 57.3 1. (10 pts.) List all major categories of programming languages, outline their definitive characteristics and

More information

Full Name: CS Account:

Full Name: CS Account: THE UNIVERSITY OF BRITISH COLUMBIA CPSC 313: QUIZ 4 October 31, 2018 Full Name: CS Account: Signature: UBC Student #: Important notes about this examination 1. Write your 4 or 5 character CS account both

More information

UNIVERSITY REGULATIONS

UNIVERSITY REGULATIONS CPSC 221: Algorithms and Data Structures Midterm Exam, 2013 February 15 Name: Student ID: Signature: Section (circle one): MWF(201) TTh(202) You have 60 minutes to solve the 5 problems on this exam. A

More information

R13 SET Discuss how producer-consumer problem and Dining philosopher s problem are solved using concurrency in ADA.

R13 SET Discuss how producer-consumer problem and Dining philosopher s problem are solved using concurrency in ADA. R13 SET - 1 III B. Tech I Semester Regular Examinations, November - 2015 1 a) What constitutes a programming environment? [3M] b) What mixed-mode assignments are allowed in C and Java? [4M] c) What is

More information

CPSC 311, 2010W1 Midterm Exam #2

CPSC 311, 2010W1 Midterm Exam #2 CPSC 311, 2010W1 Midterm Exam #2 2010/11/02 Page 1 of 18 CPSC 311, 2010W1 Midterm Exam #2 Name: Q1: 20 Student ID: Q2: 20 Signature (required; indicates agreement with rules below): Q3: 20 Q4: 20 Q5: 20

More information

Computer Science 304

Computer Science 304 The University of British Columbia Computer Science 304 Final Examination Instructor: Rachel Pottinger Time: 2.5 hours Total marks: 48 Name ANSWER KEY (PRINT) (Last) (First) Signature This examination

More information

THE UNIVERSITY OF BRITISH COLUMBIA CPSC 110: MIDTERM 1 Part B May 26, Important notes about this examination

THE UNIVERSITY OF BRITISH COLUMBIA CPSC 110: MIDTERM 1 Part B May 26, Important notes about this examination THE UNIVERSITY OF BRITISH COLUMBIA CPSC 110: MIDTERM 1 Part B May 26, 2014 Last Name: First Name: Signature: UBC Student #: Important notes about this examination 1. This exam has two separate parts. Your

More information

EXAMINATION INSTRUCTIONS

EXAMINATION INSTRUCTIONS EXAMINATION INSTRUCTIONS This examination has 6 pages. Check that you have a complete paper. Each candidate should be prepared to produce, upon request, his or her SUNY/UB card. This examination has 5

More information

Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology

Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology exam Compiler Construction in4303 April 9, 2010 14.00-15.30 This exam (6 pages) consists of 52 True/False

More information

CPSC 410? Advanced Software Engineering Mid-term Examination (Term I ) SOLUTION Instructor: Gail Murphy

CPSC 410? Advanced Software Engineering Mid-term Examination (Term I ) SOLUTION Instructor: Gail Murphy CPSC 410? Advanced Software Engineering Mid-term Examination (Term I 2001-2002) SOLUTION Instructor: Gail Murphy Do NOT start until you are informed you can start! This examination has 7 questions. The

More information

EXAMINATION INSTRUCTIONS

EXAMINATION INSTRUCTIONS EXAMINATION INSTRUCTIONS This examination has 6 pages. Check that you have a complete paper. Each candidate should be prepared to produce, upon request, his or her SUNY/UB card. This examination has 5

More information

The University of British Columbia Final Examination - December 02, 2014 Mathematics 308. Closed book examination. No calculators.

The University of British Columbia Final Examination - December 02, 2014 Mathematics 308. Closed book examination. No calculators. The University of British Columbia Final Examination - December 02, 2014 Mathematics 308 Closed book examination. No calculators. Time: 2.5 hours Last Name First Signature Student Number No books, notes,

More information

Chapter 4. Lexical and Syntax Analysis. Topics. Compilation. Language Implementation. Issues in Lexical and Syntax Analysis.

Chapter 4. Lexical and Syntax Analysis. Topics. Compilation. Language Implementation. Issues in Lexical and Syntax Analysis. Topics Chapter 4 Lexical and Syntax Analysis Introduction Lexical Analysis Syntax Analysis Recursive -Descent Parsing Bottom-Up parsing 2 Language Implementation Compilation There are three possible approaches

More information

THE UNIVERSITY OF BRITISH COLUMBIA CPSC 121: MIDTERM 2 Group March 12, 2014

THE UNIVERSITY OF BRITISH COLUMBIA CPSC 121: MIDTERM 2 Group March 12, 2014 THE UNIVERSITY OF BRITISH COLUMBIA CPSC 121: MIDTERM 2 Group March 12, 2014 Important notes about this examination 1. You have 40 minutes to complete this exam. 2. No electronic aides (e.g., phones or

More information

BSCS Fall Mid Term Examination December 2012

BSCS Fall Mid Term Examination December 2012 PUNJAB UNIVERSITY COLLEGE OF INFORMATION TECHNOLOGY University of the Punjab Sheet No.: Invigilator Sign: BSCS Fall 2009 Date: 14-12-2012 Mid Term Examination December 2012 Student ID: Section: Morning

More information

CPSC 126 SAMPLE FINAL EXAMINATION ANSWERS April, 2003

CPSC 126 SAMPLE FINAL EXAMINATION ANSWERS April, 2003 CPSC 126 SAMPLE FINAL EXAMINATION ANSWERS April, 2003 Name: Student ID: Lab Section: You have 2 hours 45 minutes to write the 8 questions on this examination. A total of 105 marks are available. No notes,

More information

RYERSON POLYTECHNIC UNIVERSITY DEPARTMENT OF MATH, PHYSICS, AND COMPUTER SCIENCE CPS 710 FINAL EXAM FALL 96 INSTRUCTIONS

RYERSON POLYTECHNIC UNIVERSITY DEPARTMENT OF MATH, PHYSICS, AND COMPUTER SCIENCE CPS 710 FINAL EXAM FALL 96 INSTRUCTIONS RYERSON POLYTECHNIC UNIVERSITY DEPARTMENT OF MATH, PHYSICS, AND COMPUTER SCIENCE CPS 710 FINAL EXAM FALL 96 STUDENT ID: INSTRUCTIONS Please write your student ID on this page. Do not write it or your name

More information

EXAMINATION INSTRUCTIONS

EXAMINATION INSTRUCTIONS Midterm exam SAMPLE CSE115 Computer Science I Fall 2018 EXAMINATION INSTRUCTIONS This examination has 9 pages. Check that you have a complete paper. Each candidate should be prepared to produce, upon request,

More information

11. a b c d e. 12. a b c d e. 13. a b c d e. 14. a b c d e. 15. a b c d e

11. a b c d e. 12. a b c d e. 13. a b c d e. 14. a b c d e. 15. a b c d e CS-3160 Concepts of Programming Languages Spring 2015 EXAM #1 (Chapters 1-6) Name: SCORES MC: /75 PROB #1: /15 PROB #2: /10 TOTAL: /100 Multiple Choice Responses Each multiple choice question in the separate

More information

Section A. A grammar that produces more than one parse tree for some sentences is said to be ambiguous.

Section A. A grammar that produces more than one parse tree for some sentences is said to be ambiguous. Section A 1. What do you meant by parser and its types? A parser for grammar G is a program that takes as input a string w and produces as output either a parse tree for w, if w is a sentence of G, or

More information

CPSC 410 Advanced Software Engineering Mid-term Examination (Term I ): Solution Instructor: Gail Murphy

CPSC 410 Advanced Software Engineering Mid-term Examination (Term I ): Solution Instructor: Gail Murphy CPSC 410 Advanced Software Engineering Mid-term Examination (Term I 2003-2004): Solution Instructor: Gail Murphy Do NOT start until you are informed you can start! This examination has 6 questions. The

More information

CSCI Compiler Design

CSCI Compiler Design CSCI 565 - Compiler Design Spring 2015 Midterm Exam March 04, 2015 at 8:00 AM in class (RTH 217) Duration: 2h 30 min. Please label all pages you turn in with your name and student number. Name: Number:

More information

1. (a) What are the closure properties of Regular sets? Explain. (b) Briefly explain the logical phases of a compiler model. [8+8]

1. (a) What are the closure properties of Regular sets? Explain. (b) Briefly explain the logical phases of a compiler model. [8+8] Code No: R05311201 Set No. 1 1. (a) What are the closure properties of Regular sets? Explain. (b) Briefly explain the logical phases of a compiler model. [8+8] 2. Compute the FIRST and FOLLOW sets of each

More information

Midterm Solutions COMS W4115 Programming Languages and Translators Wednesday, March 25, :10-5:25pm, 309 Havemeyer

Midterm Solutions COMS W4115 Programming Languages and Translators Wednesday, March 25, :10-5:25pm, 309 Havemeyer Department of Computer cience Columbia University Midterm olutions COM W4115 Programming Languages and Translators Wednesday, March 25, 2009 4:10-5:25pm, 309 Havemeyer Closed book, no aids. ach question

More information

Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology

Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology exam Compiler Construction in4020 July 5, 2007 14.00-15.30 This exam (8 pages) consists of 60 True/False

More information

THE UNIVERSITY OF BRITISH COLUMBIA CPSC 261: MIDTERM 1 February 14, 2017

THE UNIVERSITY OF BRITISH COLUMBIA CPSC 261: MIDTERM 1 February 14, 2017 THE UNIVERSITY OF BRITISH COLUMBIA CPSC 261: MIDTERM 1 February 14, 2017 Last Name: First Name: Signature: UBC Student #: Important notes about this examination 1. You have 70 minutes to write the 6 questions

More information

The Parsing Problem (cont d) Recursive-Descent Parsing. Recursive-Descent Parsing (cont d) ICOM 4036 Programming Languages. The Complexity of Parsing

The Parsing Problem (cont d) Recursive-Descent Parsing. Recursive-Descent Parsing (cont d) ICOM 4036 Programming Languages. The Complexity of Parsing ICOM 4036 Programming Languages Lexical and Syntax Analysis Lexical Analysis The Parsing Problem Recursive-Descent Parsing Bottom-Up Parsing This lecture covers review questions 14-27 This lecture covers

More information

Roll No. :... Invigilator's Signature :. CS/B.Tech(CSE)/SEM-7/CS-701/ LANGUAGE PROCESSOR. Time Allotted : 3 Hours Full Marks : 70

Roll No. :... Invigilator's Signature :. CS/B.Tech(CSE)/SEM-7/CS-701/ LANGUAGE PROCESSOR. Time Allotted : 3 Hours Full Marks : 70 Name : Roll No. :... Invigilator's Signature :. CS/B.Tech(CSE)/SEM-7/CS-701/2011-12 2011 LANGUAGE PROCESSOR Time Allotted : 3 Hours Full Marks : 70 The figures in the margin indicate full marks. Candidates

More information

4. Lexical and Syntax Analysis

4. Lexical and Syntax Analysis 4. Lexical and Syntax Analysis 4.1 Introduction Language implementation systems must analyze source code, regardless of the specific implementation approach Nearly all syntax analysis is based on a formal

More information

EXAMINATION INSTRUCTIONS

EXAMINATION INSTRUCTIONS Midterm exam CSE5/503 Computer Science I Spring 209 EXAMINATION INSTRUCTIONS This examination has 9 pages. If your copy is missing a page, let one of the course staff know. Before starting this test, students

More information

4. Lexical and Syntax Analysis

4. Lexical and Syntax Analysis 4. Lexical and Syntax Analysis 4.1 Introduction Language implementation systems must analyze source code, regardless of the specific implementation approach Nearly all syntax analysis is based on a formal

More information

CS 415 Midterm Exam Spring SOLUTION

CS 415 Midterm Exam Spring SOLUTION CS 415 Midterm Exam Spring 2005 - SOLUTION Name Email Address Student ID # Pledge: This exam is closed note, closed book. Questions will be graded on quality of answer. Please supply the best answer you

More information

CS 415 Midterm Exam Spring 2002

CS 415 Midterm Exam Spring 2002 CS 415 Midterm Exam Spring 2002 Name KEY Email Address Student ID # Pledge: This exam is closed note, closed book. Good Luck! Score Fortran Algol 60 Compilation Names, Bindings, Scope Functional Programming

More information

CS3360 Design and Implementation of Programming Languages Final Exam May 16, pm to 12:45pm (2 hour and 40 minutes) NAME:

CS3360 Design and Implementation of Programming Languages Final Exam May 16, pm to 12:45pm (2 hour and 40 minutes) NAME: CS3360 Design and Implementation of Programming Languages Final Exam May 16, 2013 10pm to 12:45pm (2 hour and 40 minutes) NAME: GRADE = / 140 1. Choice of Programming Languages / 25 2. Programming languages:

More information

First Midterm Exam CS164, Fall 2007 Oct 2, 2007

First Midterm Exam CS164, Fall 2007 Oct 2, 2007 P a g e 1 First Midterm Exam CS164, Fall 2007 Oct 2, 2007 Please read all instructions (including these) carefully. Write your name, login, and SID. No electronic devices are allowed, including cell phones

More information

The University of British Columbia Computer Science 304 Practice Final Examination

The University of British Columbia Computer Science 304 Practice Final Examination The University of British Columbia Computer Science 304 Practice Final Examination Instructor: Time: 2.5 hours Total marks: 100 Name (PRINT) (Last) (First) Signature This examination has 13 pages. Check

More information

Midterm I - Solution CS164, Spring 2014

Midterm I - Solution CS164, Spring 2014 164sp14 Midterm 1 - Solution Midterm I - Solution CS164, Spring 2014 March 3, 2014 Please read all instructions (including these) carefully. This is a closed-book exam. You are allowed a one-page handwritten

More information

MIDTERM EXAMINATION - CS130 - Spring 2003

MIDTERM EXAMINATION - CS130 - Spring 2003 MIDTERM EXAMINATION - CS130 - Spring 2003 Your full name: Your UCSD ID number: This exam is closed book and closed notes Total number of points in this exam: 120 + 10 extra credit This exam counts for

More information

Midterm Exam. CSCI 3136: Principles of Programming Languages. February 20, Group 2

Midterm Exam. CSCI 3136: Principles of Programming Languages. February 20, Group 2 Banner number: Name: Midterm Exam CSCI 336: Principles of Programming Languages February 2, 23 Group Group 2 Group 3 Question. Question 2. Question 3. Question.2 Question 2.2 Question 3.2 Question.3 Question

More information

CSE 130 Programming Language Principles & Paradigms Lecture # 5. Chapter 4 Lexical and Syntax Analysis

CSE 130 Programming Language Principles & Paradigms Lecture # 5. Chapter 4 Lexical and Syntax Analysis Chapter 4 Lexical and Syntax Analysis Introduction - Language implementation systems must analyze source code, regardless of the specific implementation approach - Nearly all syntax analysis is based on

More information

SYED AMMAL ENGINEERING COLLEGE (An ISO 9001:2008 Certified Institution) Dr. E.M. Abdullah Campus, Ramanathapuram

SYED AMMAL ENGINEERING COLLEGE (An ISO 9001:2008 Certified Institution) Dr. E.M. Abdullah Campus, Ramanathapuram CS6660 COMPILER DESIGN Question Bank UNIT I-INTRODUCTION TO COMPILERS 1. Define compiler. 2. Differentiate compiler and interpreter. 3. What is a language processing system? 4. List four software tools

More information

1. Explain the input buffer scheme for scanning the source program. How the use of sentinels can improve its performance? Describe in detail.

1. Explain the input buffer scheme for scanning the source program. How the use of sentinels can improve its performance? Describe in detail. Code No: R05320502 Set No. 1 1. Explain the input buffer scheme for scanning the source program. How the use of sentinels can improve its performance? Describe in detail. 2. Construct predictive parsing

More information

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Subject Name: CS2352 Principles of Compiler Design Year/Sem : III/VI

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Subject Name: CS2352 Principles of Compiler Design Year/Sem : III/VI DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Subject Name: CS2352 Principles of Compiler Design Year/Sem : III/VI UNIT I - LEXICAL ANALYSIS 1. What is the role of Lexical Analyzer? [NOV 2014] 2. Write

More information

Programming Languages, Summary CSC419; Odelia Schwartz

Programming Languages, Summary CSC419; Odelia Schwartz Programming Languages, Summary CSC419; Odelia Schwartz Chapter 1 Topics Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation Criteria Influences on Language Design

More information

Chapter 4. Lexical and Syntax Analysis

Chapter 4. Lexical and Syntax Analysis Chapter 4 Lexical and Syntax Analysis Chapter 4 Topics Introduction Lexical Analysis The Parsing Problem Recursive-Descent Parsing Bottom-Up Parsing Copyright 2012 Addison-Wesley. All rights reserved.

More information

Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. Date: Friday 20th May 2016 Time: 14:00-16:00

Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. Date: Friday 20th May 2016 Time: 14:00-16:00 Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE Compilers Date: Friday 20th May 2016 Time: 14:00-16:00 Please answer any THREE Questions from the FIVE Questions provided This is a CLOSED

More information

CSE3322 Programming Languages and Implementation

CSE3322 Programming Languages and Implementation Monash University School of Computer Science & Software Engineering Exam 2005 CSE3322 Programming Languages and Implementation Total Time Allowed: 3 Hours 1. Reading time is of 10 minutes duration. 2.

More information

Chapter 3 (part 3) Describing Syntax and Semantics

Chapter 3 (part 3) Describing Syntax and Semantics Chapter 3 (part 3) Describing Syntax and Semantics Chapter 3 Topics Introduction The General Problem of Describing Syntax Formal Methods of Describing Syntax Attribute Grammars Describing the Meanings

More information

MATH 253/101,102,103,105 Page 1 of 12 Student-No.:

MATH 253/101,102,103,105 Page 1 of 12 Student-No.: MATH 253/101,102,103,105 Page 1 of 12 Student-No.: Final Examination December 16, 2015 Duration: 2.5 hours This test has 10 questions on 12 pages, for a total of 80 points. Dr. G. Slade, Dr. C. Macdonald,

More information

CSCE 531 Spring 2009 Final Exam

CSCE 531 Spring 2009 Final Exam CSCE 531 Spring 2009 Final Exam Do all problems. Write your solutions on the paper provided. This test is open book, open notes, but no electronic devices. For your own sake, please read all problems before

More information

Parsing. Roadmap. > Context-free grammars > Derivations and precedence > Top-down parsing > Left-recursion > Look-ahead > Table-driven parsing

Parsing. Roadmap. > Context-free grammars > Derivations and precedence > Top-down parsing > Left-recursion > Look-ahead > Table-driven parsing Roadmap > Context-free grammars > Derivations and precedence > Top-down parsing > Left-recursion > Look-ahead > Table-driven parsing The role of the parser > performs context-free syntax analysis > guides

More information

GUJARAT TECHNOLOGICAL UNIVERSITY

GUJARAT TECHNOLOGICAL UNIVERSITY Type of course: System Programming GUJARAT TECHNOLOGICAL UNIVERSITY SYSTEM PROGRAMMING SUBJECT CODE: 21508 B.E. 5 th SEMESTER Prerequisite: Data Structures and Operating Systems Rationale: NA Teaching

More information

ECE251 Midterm practice questions, Fall 2010

ECE251 Midterm practice questions, Fall 2010 ECE251 Midterm practice questions, Fall 2010 Patrick Lam October 20, 2010 Bootstrapping In particular, say you have a compiler from C to Pascal which runs on x86, and you want to write a self-hosting Java

More information

LANGUAGE PROCESSORS. Introduction to Language processor:

LANGUAGE PROCESSORS. Introduction to Language processor: LANGUAGE PROCESSORS Introduction to Language processor: A program that performs task such as translating and interpreting required for processing a specified programming language. The different types of

More information

Compiler Theory. (Semantic Analysis and Run-Time Environments)

Compiler Theory. (Semantic Analysis and Run-Time Environments) Compiler Theory (Semantic Analysis and Run-Time Environments) 005 Semantic Actions A compiler must do more than recognise whether a sentence belongs to the language of a grammar it must do something useful

More information

Syntax-Directed Translation

Syntax-Directed Translation Syntax-Directed Translation What is syntax-directed translation? The compilation process is driven by the syntax. The semantic routines perform interpretation based on the syntax structure. Attaching attributes

More information

CS 3360 Design and Implementation of Programming Languages. Exam 1

CS 3360 Design and Implementation of Programming Languages. Exam 1 1 Spring 2016 (Monday, March 21) Name: CS 3360 Design and Implementation of Programming Languages Exam 1 This test has 18 questions and pages numbered 1 through 6. Reminders This test is closed-notes and

More information

CPS 506 Comparative Programming Languages. Syntax Specification

CPS 506 Comparative Programming Languages. Syntax Specification CPS 506 Comparative Programming Languages Syntax Specification Compiling Process Steps Program Lexical Analysis Convert characters into a stream of tokens Lexical Analysis Syntactic Analysis Send tokens

More information

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Compiler Design

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Compiler Design i About the Tutorial A compiler translates the codes written in one language to some other language without changing the meaning of the program. It is also expected that a compiler should make the target

More information

Syntax Analysis. Martin Sulzmann. Martin Sulzmann Syntax Analysis 1 / 38

Syntax Analysis. Martin Sulzmann. Martin Sulzmann Syntax Analysis 1 / 38 Syntax Analysis Martin Sulzmann Martin Sulzmann Syntax Analysis 1 / 38 Syntax Analysis Objective Recognize individual tokens as sentences of a language (beyond regular languages). Example 1 (OK) Program

More information

MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Final Examination 8:30 AM, Wednesday, April 18, 2012

MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Final Examination 8:30 AM, Wednesday, April 18, 2012 MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Final Examination 8:30 AM, Wednesday, April 18, 2012 Instructor: K. S. Booth Time: 150 minutes (two hours thirty minutes)

More information

LECTURE NOTES ON COMPILER DESIGN P a g e 2

LECTURE NOTES ON COMPILER DESIGN P a g e 2 LECTURE NOTES ON COMPILER DESIGN P a g e 1 (PCCS4305) COMPILER DESIGN KISHORE KUMAR SAHU SR. LECTURER, DEPARTMENT OF INFORMATION TECHNOLOGY ROLAND INSTITUTE OF TECHNOLOGY, BERHAMPUR LECTURE NOTES ON COMPILER

More information

Context-free grammars

Context-free grammars Context-free grammars Section 4.2 Formal way of specifying rules about the structure/syntax of a program terminals - tokens non-terminals - represent higher-level structures of a program start symbol,

More information

Philadelphia University Faculty of Information Technology Department of Computer Science --- Semester, 2007/2008. Course Syllabus

Philadelphia University Faculty of Information Technology Department of Computer Science --- Semester, 2007/2008. Course Syllabus Philadelphia University Faculty of Information Technology Department of Computer Science --- Semester, 2007/2008 Course Syllabus Course Title: Compiler Construction Course Level: 4 Lecture Time: Course

More information

CS164: Midterm I. Fall 2003

CS164: Midterm I. Fall 2003 CS164: Midterm I Fall 2003 Please read all instructions (including these) carefully. Write your name, login, and circle the time of your section. Read each question carefully and think about what s being

More information

Computer Science Spring 98 Midterm Examination Professor L. Rowe

Computer Science Spring 98 Midterm Examination Professor L. Rowe Computer Science 164 - Spring 98 Midterm Examination Professor L. Rowe Problem #1 (30 points) Define the following terms: parser terminal symbol abstract class method abstract syntax tree pushdown automaton

More information

2068 (I) Attempt all questions.

2068 (I) Attempt all questions. 2068 (I) 1. What do you mean by compiler? How source program analyzed? Explain in brief. 2. Discuss the role of symbol table in compiler design. 3. Convert the regular expression 0 + (1 + 0)* 00 first

More information

Compiler Construction: Parsing

Compiler Construction: Parsing Compiler Construction: Parsing Mandar Mitra Indian Statistical Institute M. Mitra (ISI) Parsing 1 / 33 Context-free grammars. Reference: Section 4.2 Formal way of specifying rules about the structure/syntax

More information

VALLIAMMAI ENGINEERING COLLEGE

VALLIAMMAI ENGINEERING COLLEGE VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur 60 20 DEPARTMENT OF INFORMATION TECHNOLOGY QUESTION BANK VI SEMESTER CS6660 COMPILER DESIGN Regulation 20 Academic Year 207 8 Prepared by Ms. S.

More information

Lecture 7: Deterministic Bottom-Up Parsing

Lecture 7: Deterministic Bottom-Up Parsing Lecture 7: Deterministic Bottom-Up Parsing (From slides by G. Necula & R. Bodik) Last modified: Tue Sep 20 12:50:42 2011 CS164: Lecture #7 1 Avoiding nondeterministic choice: LR We ve been looking at general

More information

Midterm I (Solutions) CS164, Spring 2002

Midterm I (Solutions) CS164, Spring 2002 Midterm I (Solutions) CS164, Spring 2002 February 28, 2002 Please read all instructions (including these) carefully. There are 9 pages in this exam and 5 questions, each with multiple parts. Some questions

More information

The University of Oregon May 16, 2015 Oregon Invitational Mathematics Tournament:

The University of Oregon May 16, 2015 Oregon Invitational Mathematics Tournament: The University of Oregon May 16, 2015 Oregon Invitational Mathematics Tournament: losed book examination Geometry Exam Time: 90 minutes Last Name First Name School Grade (please circle one): 7 8 9 10 11

More information

St. MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad

St. MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad St. MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad-00 014 Subject: PPL Class : CSE III 1 P a g e DEPARTMENT COMPUTER SCIENCE AND ENGINEERING S No QUESTION Blooms Course taxonomy level Outcomes UNIT-I

More information

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Fall Test I

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Fall Test I Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY 6.035 Fall 2014 Test I You have 50 minutes to finish this quiz. Write your name and athena username on this

More information

Examination in Compilers, EDAN65

Examination in Compilers, EDAN65 Examination in Compilers, EDAN65 Department of Computer Science, Lund University 2016 10 28, 08.00-13.00 Note! Your exam will be marked only if you have completed all six programming lab assignments in

More information

4. LEXICAL AND SYNTAX ANALYSIS

4. LEXICAL AND SYNTAX ANALYSIS 4. LEXICAL AND SYNTAX ANALYSIS CSc 4330/6330 4-1 9/15 Introduction Chapter 1 described three approaches to implementing programming languages: compilation, pure interpretation, and hybrid implementation.

More information

UNIT -1 1.1 OVERVIEW OF LANGUAGE PROCESSING SYSTEM 1.2 Preprocessor A preprocessor produce input to compilers. They may perform the following functions. 1. Macro processing: A preprocessor may allow a

More information

EXAMINATION INSTRUCTIONS

EXAMINATION INSTRUCTIONS Midterm exam CSE115/503 Computer Science I Spring 2019 EXAMINATION INSTRUCTIONS This examination has 9 pages. If your copy is missing a page, let one of the course staff know. Before starting this test,

More information

COP4020 Spring 2011 Midterm Exam

COP4020 Spring 2011 Midterm Exam COP4020 Spring 2011 Midterm Exam Name: (Please print Put the answers on these sheets. Use additional sheets when necessary or write on the back. Show how you derived your answer (this is required for full

More information

CS 2210 Sample Midterm. 1. Determine if each of the following claims is true (T) or false (F).

CS 2210 Sample Midterm. 1. Determine if each of the following claims is true (T) or false (F). CS 2210 Sample Midterm 1. Determine if each of the following claims is true (T) or false (F). F A language consists of a set of strings, its grammar structure, and a set of operations. (Note: a language

More information

MidTerm Papers Solved MCQS with Reference (1 to 22 lectures)

MidTerm Papers Solved MCQS with Reference (1 to 22 lectures) CS606- Compiler Construction MidTerm Papers Solved MCQS with Reference (1 to 22 lectures) by Arslan Arshad (Zain) FEB 21,2016 0300-2462284 http://lmshelp.blogspot.com/ Arslan.arshad01@gmail.com AKMP01

More information

Programming Language Syntax and Analysis

Programming Language Syntax and Analysis Programming Language Syntax and Analysis 2017 Kwangman Ko (http://compiler.sangji.ac.kr, kkman@sangji.ac.kr) Dept. of Computer Engineering, Sangji University Introduction Syntax the form or structure of

More information

UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division. P. N. Hilfinger

UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division. P. N. Hilfinger UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division CS 164 Spring 2009 P. N. Hilfinger CS 164: Final Examination (corrected) Name: Login: You have

More information

READ AND OBSERVE THE FOLLOWING RULES:

READ AND OBSERVE THE FOLLOWING RULES: This examination has 11 pages: check that you have a complete paper. Check that you have a complete paper. Each candidate should be prepared to produce, upon request, his or her SUNY/UB card. This is a

More information

CSE 582 Autumn 2002 Exam 11/26/02

CSE 582 Autumn 2002 Exam 11/26/02 Name There are 8 questions worth a total of 100 points. Please budget your time so you get to all of the questions. Keep your answers brief and to the point. You may refer to the following reference materials:

More information

G COURSE PLAN ASSISTANT PROFESSOR Regulation: R13 FACULTY DETAILS: Department::

G COURSE PLAN ASSISTANT PROFESSOR Regulation: R13 FACULTY DETAILS: Department:: G COURSE PLAN FACULTY DETAILS: Name of the Faculty:: Designation: Department:: Abhay Kumar ASSOC PROFESSOR CSE COURSE DETAILS Name Of The Programme:: BTech Batch:: 2013 Designation:: ASSOC PROFESSOR Year

More information