首页 > > 详细

讲解CS320留学生、辅导Multiple Choice、讲解C/C++编程、C/C++语言辅导 辅导Python程序|解析Java程序

Summer 2018 CS320 Midterm 4
Section A – Multiple Choice & True/False ( 6pts )

1)Which form of grammar checking do we perform during compilation/interpretation?
a.Context Free Grammar
b.Parsed Grammar Checking
c.Tokenization
d.Infix to Postfix
2)Which mechanism do we use to create OOP in Lua?
a.Dictionaries.
b.Aggregation.
c.Metatables.
d.Metalogic.
3)Which kind of parsing can take a very long time for a computer?
a.Bottom Up Parsing.
b.Shift Reduce Parsing.
c.Left Right Parsing.
d.Top Down Parsing.
Section B – Short Answer (25 words or less for each) ( 15pts )
1)Why do we perform Grammar checking on expressions in programming languages?



2)What does left and right recursion refer to when considering CFGs?



3)Which OOP mechanisms does Lua lack by default? (Without implementing a Metafunction)


4)Briefly describe what the Left and Right mean in Left-Right parsing?



5)How do we overcome potential ambiguity of parsing in bottom up parsers?





Section C – True/False ( 10pts/2pts each )
1)Given the following grammar, which of the following sentences are valid?
Rule 1) E -> 1E1
Rule 2) E -> 0EE
Rule 3) E -> E1
Rule 4) E -> eps

I.101001 TRUE FALSE
II.110111 TRUE FALSE
III.010011 TRUE FALSE
IV.0101 TRUE FALSE
V.110 TRUE FALSE
VI.001 TRUE FALSE


Section D – Program ( 10 pts )

Given the following Lua code, write the equivalent C++ code.
1)function F(a)
local b = a / 3
return a + b
end

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!