Comparative Programming Exam 1
An attribute grammar is what?
A device used to describe more of the structure of a programming language than can be described with a context-free grammar.
What is a higher order function?
A function that can take one or more functions as parameters or returns a function as a result, or both
Which factor/s contributes towards increasing cost of a programming language?
A language having expensive implementation system and not portable
What is a Functional Programming Language?
A language that is designed to mimic mathematical functions to the greatest extent possible
In what common data structure are LISP lists normally stored?
A linked list structure in which each node has two pointers
What does a lambda expression specify?
A nameless function that performs some behavior.
What is the relationship between Lexemes and tokens?
A token is a category of lexemes.
The first language to provide a discriminated union was.
ALGOL 68
Exception handling is
Ability of a program to intercept run-time errors, take corrective measures and continue
If two variable names can be used to access the same memory location, what are they are called?
Aliases
The most common data structures in the field of scientific applications of programming languages was
Arrays and matrices
What data type(s) were parts of the original LISP?
Atoms and lists
A language that is writable but not reliable because of its flexibility in pointer usage is
C++
Which of the following is not a scripting language?
C++
Name the first programming language whose use was mandated by the Department of Defense.
COBOL
The first successful high level language for business was
COBOL
Which of these is true about inheritance
It enhances the potential re-use of existing software
Consider the grammar: <S>→<A> a <B> b <A>→<A> b | a <B>→ a <B> | a Which of the following is a true statement about this grammar?
It generates a language where sentences begin with a and end with b.
The reason for studying concepts of programming languages are
It helps a programmer to learn several other languages.
What is a reserved word?
It is a special word that cannot be used as a user-defined name.
What are unions?
It is a type whose variables are allowed to store different type values at different times during execution
What is an associative array?
It is an unordered collection of data elements indexed by an equal number of keys.
What is a dynamic scope?
It is based on calling sequences of subprograms, not on their spatial relationship to each other.
What is the function of the assignment operation in a pointer?
It is used to set a pointer variable as value to some useful address
Why is ambiguity a problem of language structures?
It makes the meaning of structure within the language non unique.
Which of the following is an advantage of Dynamic Type Binding?
It offers a high degree of flexibility in programming.
The largest impact of Pascal was
It was used to teach programming from 1971-1990s in colleges and universities
What is true about Java programs
Its designers traded execution efficiency for reliability
Which kind of array can have rows with varying number of elements?
Jagged Array
Which language does not support unions? Java Haskell ML F#
Java
Which of the following is considered a functional programming language?
Lisp
Machine code was replaced by Assembly language because.
Machine code was tedious and error prone
Which one of the following is NOT a reason to separate syntax analysis and lexical analysis when considering syntax analyzers?
Makes unambiguous grammar.
APL is a programming language that provides
Many powerful operators
For heap management, in which method of garbage collection does reclamation occur only when the list of available space becomes empty?
Mark-Sweep approach
According to the textbook languages that can be used to describe other languages are?
Metalanguages
Which type equivalence is easier to implement?
Name type equivalence
How do Context Free and Attribute Grammars differ?
One is G = (S, N, T), the other is G = (S, N, T, P)
Consider the grammar: <S>→<A> a <B> b <A>→<A> b | a <B>→ a <B> | a Which one of the following sentences is not in the language generated by this grammar?
baaab
According to the textbook finite automata are:
A class of mathematical machines that can be used for lexical analyzers whose representation can be realized as state diagrams.
All variable names in PHP must begin with which character?
$
What does the following expression in Scheme evaluate to (- 5 (* 6 3))?
-13
What bit character set is used in the UCS-2 standard?
16 bit character set
Consider the following BNF grammar:
3
How many characters could a variable name in FORTRAN I have?
6
In Ruby class variable begins with which sign?
@@
All functional programming languages are?
Compiled and/or interpreted varies with the languages.
BNF has the same expressive power as:
Context Free Grammar
SIMULA 67 works with coroutines. What is a coroutine?
Controls allowing subprograms to restart at the position where they previously stopped.
PL/I represents the first large scale attempt to design a language that could be used for a broad spectrum of application areas. Which of the following was a contribution of PL/I ?
Detect and handle 23 different types of exceptions or run-time errors.
Which of the following was NOT incorporated in the design goals of BASIC
Difficult and meant only for science students to learn and use.
What was the type of scoping used in the original LISP?
Dynamic
Which string length option allows a string to have varying length with no maximum?
Dynamic Length Strings
What is the difference between EQV? And EQ? In Scheme?
EQV? tests for the equality of two atoms without knowing whether they are symbolic or numeric whereas EQ? compares the pointer values.
What function is available in Lisp that can be called to interpret Lisp code?
EVAL
What is the main reason Extended BNF was created?
To enhance the readability and writeability of BNF.
Which of the following is true about Orthogonality?
Every possible combination of primitives is legal and meaningful.
Which of the following is FALSE regarding BNF grammars?
Extended BNF (EBNF) notation allows language descriptions that cannot be specified in BNF alone.
The cockroach of programing languages is:
Fortran
Which version of FORTRAN added support for object oriented programming?
Fortran 2003
Which version of FORTRAN included If with an optional Else clause?
Fortran 77
Garbage Collection supported by Java is a process which
Frees the programmer from needing to delete objects explicitly when they are no longer needed.
How do Functional Programming languages handle I/O?
Input and output operations change the state a program and therefore cannot be part of any pure functional programming language.
Speedcoding was an interpretive system developed by John Backus for which of the following?
IBM 701
Lists in Lisp are specified using:
Parentheses
In the compilation process, which of the following represent the syntactic structure of the program
Parse trees
Which of the following is FALSE regarding Axiomatic Semantics?
Preconditions and postconditions do not relate to a statement in Axiomatic Semantics.
Aliasing means
Presence of two or more distinct referencing methods for the same memory location
What is the von Neumann bottleneck about
Program instructions often can be executed much faster than the speed of the connection
Which of these is a functional programming language and has only two data types: atoms and lists?
Pure Lisp
Which of the following is not true regarding the original Scheme programming language mentioned in the Text Book?
Scheme, like LISP before it, uses dynamic scoping.
When would you prefer pure interpretation of programs
Small programs where efficiency can be neglected
Name the first programming language that fully supported Object Oriented Programming.
Smalltalk
One common feature of APL and SNOBOL is
Storage is allocated to a variable when it is assigned a value i.e. dynamic storage allocation.
Which of the following is an advantage of the decimal data type?
Stores data precisely and accurately
The evolution of programming design methodology is as follows
Structured programming -> Data oriented programming -> Object oriented programming
JSP is a Mark-up programming hybrid language used to
Support dynamic Web documents and provide other processing needs of Web documents.
C#, JavaScript, Ruby and Python all provide support for this particular feature found in Functional Programming Languages:
Support for nameless functions.
The study of languages can be divided into what?
Syntax and semantics
What is the main distinction between syntax analysis and lexical analysis?
Syntax is modeled as a stack machine whereas lexical is modeled as a finite state machine
Which new feature was incorporated in ALGOL 60 that was not available in ALGOL 58?
The concept of block structure was introduced.
Referential transparency refers to what?
The execution of a function always produces the same result when give the same parameters.
Which of these is true of the Von-Neumann architecture?
The execution of machine code occurs in a process called the fetch-execute cycle
If a function is called tail recursive then?
The last statement within the function is a recursive call to the function itself.
A Lexeme is?
The lowest level syntactic unit of a language.
Consider the following Java statement: index = 50 * count + 170; Which of the following is true regarding this statement?
The tokens are: identifier, equal_sign,int_literal,mult_op,identifier,plus_op,int_literal and semicolon.
What is true about mark-up languages?
They are also called programming hybrid languages
Which of the following properties are similar for Java and C++?
They both have classes and primitive types.
Which of the following is not a characteristic of Purely Functional Programming Language?
They do not always produce the same results when executing the same function with the same parameters.
ALGOL 60 was the result of efforts...
To design a universal programming language for scientific applications.
The class of automata/machine associated with the set of all computable functions is a:
Turing Machine
Data-oriented program design methodology focuses on
Use of abstract data types
When would you use a functional programming language over an imperative one?
When the nature of the underlying problem being solved is a mathematical one.
When is a grammar said to be ambiguous?
When there are two or more distinct parse trees.
An example of a markup language would be
XSLT
The Apply-to-All Functional Form is achieved in Scheme by using the following keyword:
map
State the correct algorithm for the fetch-execute cycle
repeat forever fetch the instruction pointed by the counter increment the counter decode the instruction execute the instruction end repeat