Programming Language Concepts
In this segment, we’ll cover a few common topics that you should know as a Computer Scientist that pertain towards Objective C, Java, Perl, JavaScript, PHP, Python, Ruby, Lua, C#, general language syntax, and language semantics.
201. Who developed Objective-C?
– Brand Cox and Tom Love
202. True or False? Objective-C was used to write MAC OS X.
– True
203. True or False? Objective-C is a strict superset of C
– True
204. True or False? Objective-C is a hybrid language with imperative and object-oriented features.
– True
205. Who developed Java?
– James Gosling
206. What is Java useful for?
– Web programming especially with Java applets and Android development to name a couple.
207. Does Java support concurrency?
– Yes. They’re called threads.
208. How are objects in heap deallocated in Java?
– Automatically via garbage collection.
209. What does garbage collection help avoid?
– Memory leaks
210. True or False? Java is faster than C.
– False since C is compiled and Java is a hybrid-implementation language
211. Name a few reasons for Java’s fast implementation.
– Applets, Simpler and safer than C++, Compiler is free and easy to obtain
212. True or False? Java has generics.
– True
213. Who developed Perl?
– Larry Wall
214. In Perl, variables are _______ declared.
– Implicitly
215. What are the first characters in Perl’s variable types: scalar, array, hash
– S — Scalar
– @ — Array
– % — Hash names
216. True or false? Arrays have dynamic length in Perl.
– True
217. What are associative arrays called?
– Hashes
218. What are hashes?
– Hash tables in which keys are stored
219. True or False? Perl was initially a UNIX utility for processing text files.
– True
220. Who developed JavaScript?
– Brendan Eich
221. True or False? JavaScript is standardized.
– True
222. What is JavaScript standardized name?
– ECMAScript
223. What is Microsoft’s version of JavaScript called?
– Jscript
224. Where is JavaScript’s interpreter located?
– Web browser
225. What is JavaScript used for?
– Form validation and dynamic modification of HTML documents
226. True or False? JavaScript supports inheritance.
– False
227. Who developed PHP?
– Rasmus Lerdorf
228. Where is PHP interpreted?
– Web Server
229. True or False? PHP supports OOP.
– True
230. Who developed Python?
– Guido van Rossum
231. True or False? Python is interpreted.
– True
232. Is Python dynamically typed?
– Yes
233. Is Python Object Oriented?
– Yes
234. What are Python’s data structures?
– Tuples, Lists and Dictionaries
235. Does Python have garbage collection?
– Yes
236. Does Python support exception handling?
– Yes
237. Does Python support concurrency?
– Yes
238. Does Python support network programming?
– Yes
239. What was the first programming language designed in Japan to have widespread use in the US?
– Ruby
240. Who developed Ruby?
– Yukihiro Matsumoto
241. True or False? Ruby is object oriented.
– True
242. True or False? In Ruby, classes and objects are dynamic.
– True
243. How is scope specified in Ruby?
– In name. Local variables begin with letter. Instance variables begin with @. Global with $.
244. Lua supports ________ and _________ programming.
– Imperative and functional
245. Does Lua support OOP?
– No
246. What is Lua’s data structure?
– Table (an associative array)
247. True or False? Lua is a hybrid language.
– True
248. Why was C# developed for?
– Component based software development
249. Who created C#?
– Anders Hejlsberg
250. What is the type delegate used for in C#?
– Implementing event handlers and callbacks
251. True or False? C# allows for auto-boxing and auto-unboxing.
– True
252. True or False? C# has a foreach statement.
– True
253. What is a markup programming hybrid language?
– A markup language in which some of the elements can specify programming actions.
254. What is syntax?
– The form of a language
255. What is “semantics”?
– The meaning of the expressions
256. True or False? Describing syntax is easier than describing semantics.
– True
257. The strings of a language are called ________.
– Sentences
258. _______ are the lowest level syntactic units
– Lexemes
259. A _________ of a language is a category of its lexemes
– Token
260. Languages can be formally defined in two distinct ways: by ______ and by _______.
– recognition and generation
261. The syntax part of a compiler is a _________ for the language.
– recognizer
262. What can regular grammars describe?
– appearance of tokens of programming languages
263. What can context-free grammars describe?
– the syntax of a whole programming language
264. What is a metalanguage?
– A language used to describe another language.
265. True or False? BNF is a metalanguage for programming languages.
– True
266. Each rule in BNF has a Left Hand Side (LHS), or ________, and a Right Hand Side (RHS), or _________.
– nonterminal and terminal
267. What is grammar?
– Collection of rules
268. In BNF, multiple rules can be separated by ______.
– Vertical bar |
269. A rule is ______ if LHS appears on its RHS.
– recursive
270. A sentence of a language appears with a special nonterminal symbol called ____ ______.
– start symbol
271. What is a derivation?
– Sequence of rule applications where each successive string is derived from the previous string by replacing one of the nonterminals with one of the nonterminals definitions.
272. Each string in a derivation, including the start symbol, is called a _______ ________.
– sentential form
273. True or false? A derivation continues until the sentential form contains no nonterminals.
– True
274. A _____ ________ is one in which the replaced nonterminal is always the leftmost nonterminal.
– leftmost derivation
275. How can derivation be represented graphically?
– In a parse tree
276. What do nodes and leaves represent in a parse tree?
– Nodes: nonterminals
– Leaves: terminals
277. A grammar that generates a sentence for which there are two or more distinct parse trees is said to be _________.
– ambiguous
278. Every derivation with an unambiguous grammar has a ______ parse tree.
– unique
279. When a BNF rule has its LHS also appearing at the beginning of its RHS, the rule is said to be ___ __.
– Left recursive
280. Left recursion corresponds to ______ _________.
– left associativity
281. What does a left-associative parse tree look like?
– Lowest branch appears on the left hand side
282. What is the rule for if constructs in most languages?
– That the else clause is matched with the nearest previous unmatched if
283. What are the three extensions present in EBNF?
– Square brackets, Curly braces, Parentheses
284. A right superscript to the right of the brace indicates what?
– the upper limit to the number of times the enclosed part can be repeated
285. What is used instead of an arrow in EBNF?
– A colon
286. True or False? Vertical bars are used to separate alternative RHSs.
– False. Place alt. RHS on new line. No vertical bars
287. What does attribute grammar describe?
– More of a structure of a programming language than is possible in context-free grammar
288. What are static semantics?
– Rules that can be checked at compile time
289. True or false? Attribute grammar can describe both syntax and semantics?
– True
290. What are attributes?
– Properties that can have values assigned to them
291. What are synthesized attributes used for?
– Used to pass semantic information up a parse tree.
292. What are inherited attributes used for?
– Used to pass semantic information down and across a tree
293. If all of the attribute values in a parse tree are said to be computed, the tree is said to be ___ ___.
– fully attributed
294. What are intrinsic attributes?
– Synthesized attributes of leaf nodes whose values are determined outside of the parse tree.
295. What is an actual_type?
– a synthesized attribute that stores the actual type of a variable or expression.
296. What is an expected_type?
– Inherited attribute associated with nonterminal <expr> that stores the expected type of expression.
297. True or False? There is a universally accepted notation for describing dynamic semantics.
– False
298. What are operational semantics?
– An attempt to describe the meaning of a statement by specifying the effects of running it on a machine.
299. Is operational semantics based on mathematics?
– No
300. ________ _________ is based on recursive function theory.
– Denotational semantics
301. What is the most rigorous and most widely known formal method for describing the meaning of programs?
– Denotational semantics
302. In denotational semantics, each mapping function has a ____ and a ____ and ____.
– domain and range
303. In denotational semantics, the _____ _____ specifies which syntactic structures are to be mapped.
– Syntactic domain
304. In denotational semantics, the range is called the _________ _________.
– Semantic domain
305. The _______ in denotational semantics consists of the values of the program’s variables.
– state
306. Show how a state can be represented in denotational semantics.
– s = {<i1, v1>, <i2, v2>, …} where i = variable name and v = value
307. In denotational semantics, any name that’s not initialized with a value has the special value ___.
– undef
308. What does VARMP(i, s) produce?
– v
309. In denotational semantics, most constructs, such as expressions are mapped to ___ not states.
– values
310. What semantics have been used in programing language standards?
– Denotational semantics
311. What are axiomatic semantics?
– Most abstract technique for specifying semantics based on mathematical logic
312. What are axiomatic semantics used for?
– Proving the correctness of programs
313. What is an assertion?
– A logical expression that specifies constraints on program variables.
314. What is a precondition?
– An assertion that describes necessary constraints before the execution of a statement
315. What is a postcondition?
– An assertion that describes new constraints on program variables after statement execution
316. How are pre and post conditions represented?
– In curly braces
317. What is the weakest precondition?
– Least restrictive precondition
318. What is the inference rule?
– method of inferring the truth of one logical statement based on the truth of other logical statements.
319. What is the general form of the inference rule?
– S1, S2, ……, Sx
— — — — — — — — — — — —
S
320. What is an axiom?
– logical statement that is assumed to be true
321. What is the notation for specifying the axiomatic semantics of a statement form?
– {P} S {Q}
322. What does the rule of consequence state?
– Postcondition can always be weakened and a precondition can always be strengthened.
323. What do you need to find in order to compute the weakest precondition for a logical while loop?
– Loop invariant
Want more?
P1. 104 Programming Language Q&A
P2. 95 Programming Language Q&A
P3. 123 Programming Language Q&A
P4. 77 Programming Language Q&A
P5. 146 Programming Language Q&A
P6. 94 Programming Language Q&A
P7. 141 Programming Language Q&A