Programming Languages CRN Test 1 Version 1 CMSC 4023 Autumn 2013

Similar documents
Homework #2: CMPT-379 Distributed on Oct 2; due on Oct 16 Anoop Sarkar

CSE 245: Computer Aided Circuit Simulation and Verification

Microscopic Flow Characteristics Time Headway - Distribution

1 Recursive Descent (LL(1) grammars)

UNIT #5 EXPONENTIAL AND LOGARITHMIC FUNCTIONS

3+<6,&6([DP. September 29, SID (last 5 digits): --

4.1 The Uniform Distribution Def n: A c.r.v. X has a continuous uniform distribution on [a, b] when its pdf is = 1 a x b

Lecture 1: Numerical Integration The Trapezoidal and Simpson s Rule

Abstract Interpretation: concrete and abstract semantics

5. An object moving along an x-coordinate axis with its scale measured in meters has a velocity of 6t

CHAPTER CHAPTER14. Expectations: The Basic Tools. Prepared by: Fernando Quijano and Yvonn Quijano

Lecture 2: Current in RC circuit D.K.Pandey

B) 25y e. 5. Find the second partial f. 6. Find the second partials (including the mixed partials) of

Midterm exam 2, April 7, 2009 (solutions)

Economics 201b Spring 2010 Solutions to Problem Set 3 John Zhu

UNTYPED LAMBDA CALCULUS (II)

4. (5a + b) 7 & x 1 = (3x 1)log 10 4 = log (M1) [4] d = 3 [4] T 2 = 5 + = 16 or or 16.

Basic Logic Review. Rules. Lecture Roadmap Combinational Logic. Textbook References. Basic Logic Gates (2-input versions)

CS 6353 Compiler Construction, Homework #1. 1. Write regular expressions for the following informally described languages:

CPSC 211 Data Structures & Implementations (c) Texas A&M University [ 259] B-Trees

First Lecture of Machine Learning. Hung-yi Lee

First derivative analysis

Final Exam : Solutions

Boyce/DiPrima 9 th ed, Ch 2.1: Linear Equations; Method of Integrating Factors

Lecture 1: Growth and decay of current in RL circuit. Growth of current in LR Circuit. D.K.Pandey

Languages That Are and Are Not Context-Free

cycle that does not cross any edges (including its own), then it has at least

CPS 616 W2017 MIDTERM SOLUTIONS 1

Fourier Transforms and the Wave Equation. Key Mathematics: More Fourier transform theory, especially as applied to solving the wave equation.

Linear-Phase FIR Transfer Functions. Functions. Functions. Functions. Functions. Functions. Let

Exam 1. It is important that you clearly show your work and mark the final answer clearly, closed book, closed notes, no calculator.

4. Money cannot be neutral in the short-run the neutrality of money is exclusively a medium run phenomenon.

Three Concepts: Probability Henry Tirri, Petri Myllymäki

EXAM. CS331 Compiler Design Spring Please read all instructions, including these, carefully

Continous system: differential equations

y = 2xe x + x 2 e x at (0, 3). solution: Since y is implicitly related to x we have to use implicit differentiation: 3 6y = 0 y = 1 2 x ln(b) ln(b)

Estimation of Metal Recovery Using Exponential Distribution

Partial Derivatives: Suppose that z = f(x, y) is a function of two variables.

PHYSICS 489/1489 LECTURE 7: QUANTUM ELECTRODYNAMICS

SOLUTIONS. 1. Consider two continuous random variables X and Y with joint p.d.f. f ( x, y ) = = = 15. Stepanov Dalpiaz

ECE602 Exam 1 April 5, You must show ALL of your work for full credit.

Effect of sampling on frequency domain analysis

Charging of capacitor through inductor and resistor

MA 262, Spring 2018, Final exam Version 01 (Green)

whereby we can express the phase by any one of the formulas cos ( 3 whereby we can express the phase by any one of the formulas

Direct Approach for Discrete Systems One-Dimensional Elements

Chapter 12 Introduction To The Laplace Transform

Unfired pressure vessels- Part 3: Design

That is, we start with a general matrix: And end with a simpler matrix:

On the Derivatives of Bessel and Modified Bessel Functions with Respect to the Order and the Argument

AN INTRODUCTION TO FOURIER ANALYSIS PROF. VEDAT TAVSANOĞLU

S.Y. B.Sc. (IT) : Sem. III. Applied Mathematics. Q.1 Attempt the following (any THREE) [15]

MCE503: Modeling and Simulation of Mechatronic Systems Discussion on Bond Graph Sign Conventions for Electrical Systems

EAcos θ, where θ is the angle between the electric field and

Chap.3 Laplace Transform

Chapter 3: Fourier Representation of Signals and LTI Systems. Chih-Wei Liu

Division of Mechanics Lund University MULTIBODY DYNAMICS. Examination Name (write in block letters):.

Curl, Divergence, Gradient, and Laplacian in Cylindrical and Spherical Coordinate Systems

Circuits and Systems I

Alpha and beta decay equation practice

Search sequence databases 3 10/25/2016

Ma/CS 6a Class 15: Flows and Bipartite Graphs

Control System Engineering (EE301T) Assignment: 2

MATHEMATICS (B) 2 log (D) ( 1) = where z =

Constants and Conversions:

CS 361 Meeting 12 10/3/18

INC 693, 481 Dynamics System and Modelling: The Language of Bound Graphs Dr.-Ing. Sudchai Boonto Assistant Professor

Homework: Introduction to Motion

DEPARTMENT OF ELECTRICAL &ELECTRONICS ENGINEERING SIGNALS AND SYSTEMS. Assoc. Prof. Dr. Burak Kelleci. Spring 2018

Math 34A. Final Review

Propositional Logic. Combinatorial Problem Solving (CPS) Albert Oliveras Enric Rodríguez-Carbonell. May 17, 2018

Introduction to Arithmetic Geometry Fall 2013 Lecture #20 11/14/2013

Aim To manage files and directories using Linux commands. 1. file Examines the type of the given file or directory

Figure 1: Closed surface, surface with boundary, or not a surface?

Unit 6: Solving Exponential Equations and More

Section 11.6: Directional Derivatives and the Gradient Vector

Context-Free Grammar

Poisson process Markov process

Quasi-Classical States of the Simple Harmonic Oscillator

The transition:transversion rate ratio vs. the T-ratio.

I) Title: Rational Expectations and Adaptive Learning. II) Contents: Introduction to Adaptive Learning

Pushdown Automata. Reading: Chapter 6

Theory of Computation - Module 3

AR(1) Process. The first-order autoregressive process, AR(1) is. where e t is WN(0, σ 2 )

Kernels. ffl A kernel K is a function of two objects, for example, two sentence/tree pairs (x1; y1) and (x2; y2)

FIRST-ORDER SYSTEMS OF ORDINARY DIFFERENTIAL EQUATIONS I: Introduction and Linear Systems

Calculus concepts derivatives

September 23, Honors Chem Atomic structure.notebook. Atomic Structure

Communication Technologies

Self-interaction mass formula that relates all leptons and quarks to the electron

CMSC 330: Organization of Programming Languages

Spring 2006 Process Dynamics, Operations, and Control Lesson 2: Mathematics Review

PHA 5127 Answers Homework 2 Fall 2001

Answer Homework 5 PHA5127 Fall 1999 Jeff Stark

Design and Analysis of Algorithms (Autumn 2017)

Roadmap. XML Indexing. DataGuide example. DataGuides. Strong DataGuides. Multiple DataGuides for same data. CPS Topics in Database Systems

Transfer function and the Laplace transformation

Convolution. Lecture #6 2CT.3 8. BME 333 Biomedical Signals and Systems - J.Schesser

CSE 105 THEORY OF COMPUTATION

Derivation of Eigenvalue Matrix Equations

Transcription:

Programming Languags CRN 12105 Ts 1 Vrsion 1 CMSC 4023 Auumn 2013 1. Wri your nam on your scanron in h spac labld NAME. 2. Wri CMSC 4023 in h spac labld SUBJECT. 3. Prin h s numbr and vrsion, T1/V1, in h spac labld TEST NO. 4. Wri h da, 9-23-2013, in h spac labld DATE. 5. Wri your CRN numbr, 12105, in h spac labld PERIOD. 6. This is a closd-book xaminaion. No rrnc marials ar prmid. No nos ar prmid. 7. You may no consul your nighbors, collagus, or llow sudns o answr h qusions on his s. 8. Cllular phons ar prohibid. Th possssor o a cllular phon will rciv a zro (0) i h phon rings or is visibl during h s. 9. Mark h bs slcion ha saisis h qusion. I slcion b is br ha slcions a and d, hn mark slcion b. Mark only on slcion. 10. Darkn your slcions complly. Mak a havy black mark ha complly ills your slcion. 11. Answr all 25 qusions. 12. Rcord your answrs on SCANTRON orm 882-E (I is grn!) 1

Programming Languags CRN 12105 Ts 1 Vrsion 1 CMSC 4023 Auumn 2013 1. (p. 2-3.) Which o h ollowing is NOT a rason or sudying concps o programming languags according o Sbsa? a. Incrasd capaciy o xprss idas. b. Improvd background or choosing appropria languags. c. Incrasd abiliy o dsign nw languags. d. Incrasd abiliy o larn nw languags. 2. (p. 5-6.) Wha programming languag has dominad sciniic compuing ovr h pas 50 yars? a. FORTRAN b. ALGOL c. SNOBOL d. PL/I 3. (p. 6.) Wha programming languag has dominad ariicial inllignc ovr h pas 50 yars? a. Prolog b. Schm c. C d. LISP 4. (p. 7) Wha maning dos Sbsa giv o h languag valuaion cririon radabiliy? a. Th programming languag prsns no challngs o b rad by a machin. b. A program ha is asily rad is on in which programs ar asily mainaind. c. Th programming languag has consrucs ha suppord all aras o applicaion. d. Th programming languag has uniqu opraors or ach yp and subyp. 5. (p 36)Th irs programmr was a. Ada Lovlac b. Konrad Zus c. Grac Hoppr d. John von Numann 6. (p. 10 12) Slc h bs diniion o orhogonaliy in h conx o programming languag criria. a. Orhogonaliy mans ha ach opraor is prcisly dind or a s o valid oprand yps. b. Orhogonaliy mans ha ach opraor is dind or all oprand yps. c. Orhogonaliy mans ha ach opraor corcs h yps o invalid oprands o valid yps. d. Ohogonaliy mans ha ach opraor is valid only or a singl yp. 2

Programming Languags CRN 12105 Ts 1 Vrsion 1 CMSC 4023 Auumn 2013 7. (p. 11) Wha languag usd orhogonaliy as a primary dsign cririon? a. ALGOL 68. b. VAX assmbly languag c. LISP d. Modula-2 8. (p. 8) Which o h ollowing is no a programming languag valuaion criria according o Sbsa? a. synax dsign b. xprssiviy c. rsricd aliasing d. yp dsign 9. (p. 7) In wha languag is UNIX wrin? a. B b. C c. C++ d. Java 10. (p. 19) Wha has bn h srongs inlunc on programming languag dsign ovr h pas 50 yars? a. impraiv programming mhodology b. h von Numann archicur c. BNF spciicaion o programming languag d. h xponnial growh o mmory 11. (p. 22) Which languag was irs o suppor h hr undamnal aurs o objcorind programming? a. Smallalk b. CLOS c. SIMULA-67 d. C++ 12. (p. 22) Which o h ollowing is no a undamnal aur o an objc-orind programming languag? a. daa absracion b. inhrianc c. dynamic mhod binding d. inrac ncapsulaion 3

Programming Languags CRN 12105 Ts 1 Vrsion 1 CMSC 4023 Auumn 2013 13. (p. 121-122) Givn h grammar in h igur blow, slc h lmos drivaion o h sring a+b*c. a. Sp Snnial Form 1 2 + 3 +* 4 +*id(c) 5 +id(b)*id(c) 6 id(a)*id(b)+id(c) b. Sp Snnial Form 1 2 + 3 +* 4 +*id(c) 5 +id(b)*id(c) 6 +id(b)*id(c) 7 id(a)+id(b)*id(c) c. Sp Snnial Form 1 2 + 3 +* 4 +* 5 +* 6 id(a)+* 7 id(a)+* 8 id(a)+id(b)* 9 id(a)+id(b)*id(c) + - * / % () id Figur 13. 4

Programming Languags CRN 12105 Ts 1 Vrsion 1 CMSC 4023 Auumn 2013 d. Sp Snnial Form 1 2 + 3 + 4 + 5 id(a)+ 6 id(a)+* 7 id(a)+* 8 id(a)+id(b)* 9 id(a)+id(b)*id(c) 14. (p 120) Th irs languag o mploy BNF was a. Pascal b. LISP c. FORTRAN d. Algol60 15. (Ch. 3. Lcur Nos) Givn h grammar in h igur blow, slc h righmos drivaion o h sring a+b*c. + - * / % () id Figur 15. a. Sp Snnial Form 1 2 + 3 +* 4 +*id(c) 5 +id(b)*id(c) 6 id(a)*id(b)+id(c) 5

Programming Languags CRN 12105 Ts 1 Vrsion 1 CMSC 4023 Auumn 2013 b. Sp Snnial Form 1 2 + 3 + 4 + 5 id(a)+ 6 id(a)+* 7 id(a)+* 8 id(a)+id(b)* 9 id(a)+id(b)*id(c) c. Sp Snnial Form 1 2 + 3 +* 4 +* 5 +* 6 id(a)+* 7 id(a)+* 8 id(a)+id(b)* 9 id(a)+id(b)*id(c) d. Sp Snnial Form 1 2 + 3 +* 4 +*id(c) 5 +*id(c) 6 +id(b)*id(c) 7 +id(b)*id(c) 8 +id(b)*id(c) 9 id(a)+id(b)*id(c) 6

Programming Languags CRN 12105 Ts 1 Vrsion 1 CMSC 4023 Auumn 2013 16. (Projc p01 nos) Wha squnc o okns is rcognizd by h rgular xprssions shown in h igur blow givn h inpu sring +123.1? a. 3 okns as ollows + 123.1 b. 1 okn as ollows +123.1 c. 4 okns as ollows + 123. 1 d. 2 okns as ollows +123.1 [+ -]?[0-9]+\.[0-9]*([E ][+ -]?[0-9]+)? [+ -]?[0-9]+ \.[0-9]+. [+ -] [0-9]+ Figur 16. 17. (p. 27) Which o h ollowing is NOT a phas o compilaion? a. lxical analysis b. smanic analysis c. synax analysis d. saic analysis 18. (p. 125-128) Which slcion corrcly ordrs h prcdnc o opraors in h grammar in h igur blow? Opraors ar ordrd rom l o righ, highs o lows. a. () * / % + - b. + * - / % () c. () * + / - % d. + - * / % () + - * / % () id Figur 18. 7

Programming Languags CRN 12105 Ts 1 Vrsion 1 CMSC 4023 Auumn 2013 19. (p. 124-125) Which o h ollowing grammars is NOT ambiguous? a. E->E+E E->E*E E->(E) E->id b. E->E+T T T->T*F F F->(E) id c. E->E A E (E) id A -> + * d. E->E+E E*E (E) id 20. (p. 123-124) Slc h pars r or h snnc B * ( A + C ) in h grammar shown blow. * + () ID Figur 20. 8

Programming Languags CRN 12105 Ts 1 Vrsion 1 CMSC 4023 Auumn 2013 * ( ) ID(B) + ID(C) ID(A) Figur 20 a. 9

Programming Languags CRN 12105 Ts 1 Vrsion 1 CMSC 4023 Auumn 2013 * ( ) ID(B) + ID(C) ID(A) Figur 20 b. 10

Programming Languags CRN 12105 Ts 1 Vrsion 1 CMSC 4023 Auumn 2013 + ( ) ID(B) * ID(C) ID(A) Figur 20 c. 11

Programming Languags CRN 12105 Ts 1 Vrsion 1 CMSC 4023 Auumn 2013 + ( ) ID(B) * ID(C) ID(A) Figur 20 d. 12

Programming Languags CRN 12105 Ts 1 Vrsion 1 CMSC 4023 Auumn 2013 21. (p. 129-130) Slc h abl ha corrcly spciis h prcdnc and associaiviy o h opraors givn in h grammar shown blow. Plas no ha h highs prcdnc is on (1). + - * / p p ^ p () p u u -u u id Figur 21. op nam prcdnc associaiviy - unary minus 1 righ () parnhsis 2 n/a ^ xponniaion 3 righ * muliplicaion 4 l / division 4 l + addiion 5 l - subracion 5 l Tabl 21. a. op nam prcdnc associaiviy + addiion 1 l - subracion 1 l * muliplicaion 2 l / division 2 l ^ xponniaion 3 righ () parnhsis 4 n/a - unary minus 5 righ Tabl 21. b. 13

Programming Languags CRN 12105 Ts 1 Vrsion 1 CMSC 4023 Auumn 2013 op nam prcdnc associaiviy - unary minus 1 l () parnhsis 2 n/a ^ xponniaion 3 l * muliplicaion 4 righ / division 4 righ + addiion 5 righ - subracion 5 righ Tabl 21. c. op nam prcdnc associaiviy + addiion 1 righ - subracion 1 righ * muliplicaion 2 righ / division 2 righ ^ xponniaion 3 l () parnhsis 4 n/a - unary minus 5 l Tabl 21. d. 22. (p. 193) Which o h ollowing grammars is pairwis disjoin? Id LHS RHS Id LHS RHS 1 A ab 1 A ab 2 A bab 2 A BAb 3 A Bb 3 B ab 4 B cb 4 B b 5 B d Figur 22 a. Figur 22 b. 14

Programming Languags CRN 12105 Ts 1 Vrsion 1 CMSC 4023 Auumn 2013 Id LHS RHS Id LHS RHS 1 A Ba 1 A Ba 2 A bab 2 A BAb 3 A bb 3 B ab 4 B cb 4 B b 5 B d Figur 22 c. Figur 22 d. 23. (p. 196) Considr h grammar shown in Figur 23.1, a snnial orm in h grammar shown in Figur 23.2, and a pars r o h snnc in Figur 23.3. How many phrass ar shown in h pars r? + * () ID Figur 23.1 +*ID Figur 23.2 + * Figur 23.3 ID a. 1 b. 2 c. 3 d. 4 15

Programming Languags CRN 12105 Ts 1 Vrsion 1 CMSC 4023 Auumn 2013 24. Find h FIRST ss or h grammar shown blow. E TE E +TE E ε T FT T *FT T ε F (E) F id Figur 24 Nonrminal FIRST s Nonrminal FIRST s E {T} E {(,id} E {+,ε} E {+,ε} T {F} T {(,id} T {*,ε} T {*,ε} F {(,id} F {(,id} Figur 24 a. Figur 24 b. Nonrminal FIRST s Nonrminal FIRST s E {E } E {(,id} E {E } E {+} T {T } T {(,id} T {T } T {*} F {),id} F {(,id} Figur 24 c. Figur 24 d. 25. (p. 191-194) Which o h ollowing is a limiaion o h LL grammar class? a. mus b implmnd by mploying a rcursiv dscn parsr b. l rcursion mus b liminad c. lxical analysis mus b implmnd using ini auomaa d. mus b implmnd using a pushdown auomaon 16