Programming Languages
What do th Ada and COBOL languages have in common? Both were forced on users by DoD Both are for business applications Both are for scientific applications Both took a long time to develop
Both were forced on users by DoD
In what language is the majority of the UNIX operation system written? assembly language C Fortran B
C
COMMON LISP is the most common version of LISP in 1980. the features that were common to all dialects of LISP in 1980. a combination of the features of many 1980s versions of LISP. the lowest level features of LISP in 1984.
a combination of the features of many 1980s versions of LISP.
Which of the following are lexemes in Java? for semicolon ++ int_literal
for ++
Referential transparency means that all references are visible in a program, regardless of where they are declared. the execution of a function always produces the same result, given the same parameters. references in functional programming languages are simple to understand. there are no references to variables that are not visible.
the execution of a function always produces the same result, given the same parameters.
The control flow mechanisms of Scheme are based on the control flow statements of Fortran. those of mathematical functions. the predicate functions of the ENIAC computer. the instruction set of the IBM 709 computer.
those of mathematical functions.
The two purposes of the Scheme function, DEFINE, are to bind the values of expressions to names. to define new data structures. to bind a lambda expression to a name. to provide an assignment statement in Scheme, exactly like those of the imperative languages.
to bind the values of expressions to names. to bind a lambda expression to a name.
Which of the following are considered advantages that functional languages have over imperativ languages? They are more execution efficient. Designing concurrent programs in functional languages is much easier. The syntax of functional languages is much simpler than that of the imperative languages. The semantics of functional languages are easier to describe formally than the semantics of the imperative languages.
Designing concurrent programs in functional languages is much easier. The syntax of functional languages is much simpler than that of the imperative languages. The semantics of functional languages are easier to describe formally than the semantics of the imperative languages.
The purpose of the pairwise disjointness test is to Determine whether a grammar is bottom-up parsable Determine whether a grammar is ambiguous Determine whether a grammar is top-down parsable Determine whether a grammar is parsable by any method
Determine whether a grammar is top-down parsable
What is the primary disadvantage of having too many features in a language? Different users learn different subsets, making programs more difficult to read and maintain The compiler is too large and too difficult to develop Language manuals are too long Too hard to learn
Different users learn different subsets, making programs more difficult to read and maintain
What is the primary application area for which Ada was designed? Embedded systems Scientific Accounting Artificial intelligence
Embedded systems
Which of the following is not a category of scalar variables defined by their lifetimes? Explicit stack dynamic Stack dynamic Static Explicit heap dynamic
Explicit stack dynamic
On what language was COBOL based? ALGOL 58 LISP FLOW-MATIC ROTRTAN
FLOW-MATIC
PL/I was designed to replace what two languages? FORTRAN BASIC FLOW-MATIC COBOL
FORTRAN COBOL
Which version of FORTRAN was the first to have any sort of dynamic variables? FORTRAN 90 FORTRAN II FORTRAN 66 FORTRAN 95
FORTRAN 90
Which of the following was the primary reason the relative slowness of interpretation of pseudocode programs was acceptable in the early 1950s? Floating-point arithmetic operations were done in software The machines were slow Memories were too small It was not then known how to write efficient interpreters
Floating-point arithmetic operations were done in software
What hardware capability that first appeared in the IBM 704 computer strongly affected the evolution of programming languages? Floating-point hardware Disk devices Solid state memory Index registers
Floating-point hardware
What programming language has dominated scientific computing over the past 40 years? COBOL C Fortran Basic
Fortran
Which of the following languages does not allow dynamic binding of values to named constants? C++ Ada Fortran 95 Java
Fortran 95
Which of the following is not a kind of attribute in an attribute grammar? Free Intrinsic Inherited Synthesized
Free
Speedcoding was invented to overcome two significant shortcomings of the computer hardware of the early 1950s. Which of the following are these two? No floating-point hardware No floppy disks No cache memory No index registers
No floating-point hardware No index registers
Context-free grammars were devised by John Backus John McCarthy Noam Chomsky Peter Naur
Noam Chomsky
Which of the following can be sentenial forms? Non-terminal symbols Terminal symbols Sentences Rules
Non-terminal symbols Terminal symbols Sentences
To be useful, a parsing algorithm must have complexity no greater than O(n) O(n^3) NP complete O(n^2)
O(n)
What populates the Smalltalk world? Classes Objects Small programs Selection statements
Objects
What is a nonprocedural language? One without subprograms One without multidimensional arrays One without functions One in which algorithms need not be spelled out in detail
One in which algorithms need not be spelled out in detail
What design criterion was used extensively in ALGOL 68? Readability Orthogonality Reliability Simplicity
Orthogonality
What Ada construct provides support for abstract data types? Arrays Packages Tasks Records
Packages
The Delphi language was derived from what language? Ada C++ C Pascal
Pascal
What was the primary application area of computers at the time Fortran was designed? Scientific Artificial intelligence Business Computer gaming software
Scientific
What role does the symbol table play in a compiler? Records the number of syntax errors Serves as the database of information about the program Stores the reserved words Allows high-quality error messages
Serves as the database of information about the program
PHP and Python are primarily used for Real-time programming. Systems programming. Scientific programming. Web programming
Web programming
What readability problem is caused by using the same closing reserved word for more than one kind of control statement? if statements can be confused with while statements When such a closing reserved word is found, determining what it terminates requires a careful search of the previous code Comments are more difficult to recognize It is boring to see the same reserved word so often
When such a closing reserved word is found, determining what it terminates requires a careful search of the previous code
Which of the following are markup/programming hybrid languages? Python XHTML XSLT JSP
XSLT JSP
Two of the ways in which ML differs from Scheme are the action of the Scheme COND function is performed by the CONDITIONAL function of ML. although Scheme is essentially typeless, ML is strongly typed. the syntax of Scheme is completely different from that of ML ML supports object-oriented programming, but Scheme does not.
although Scheme is essentially typeless, ML is strongly typed. the syntax of Scheme is completely different from that of ML
The first LISP interpreter was written to substantiate the claim that LISP was universal. to prove that LISP could be implemented. as an implementation of the EVAL LISP function. to provide a LISP programming environment.
as an implementation of the EVAL LISP function.
The original version of LISP included the following data types: atoms arrays floats lists
atoms lists
Perl was originally based on which two of the following languages? tk awk sh tcl
awk sh
What construct of a programming language provides process abstraction? subprograms pointers arrays classes
subprograms
The purpose of the Scheme QUOTE function is to provide double quotes around a given string literal. to provide famous quotations for the chapter openers of textbooks. to prevent EVAL from evaluation some parameters in function calls. to form block quotes around paragraphs of text
to prevent EVAL from evaluation some parameters in function calls.
Which of the following are tokens in Java? identifier while mult_op }
while mult_op }
Which of the following languages have case-sensitive names? COBOL Fortran C# C++
C# C++
Left recursion in a grammar is a problem for Only recursive descent parsers All top-down parsers All bottom-up parsers All parsers
All top-down parsers
What is exception handling? Dealing with the syntactic irregularities of a programming language Dealing with different ranges of parameter values in a subprogram Allowing a program to intercept run-time errors, take corrective measures, and then continue execution Dealing with syntax errors during complilation
Allowing a program to intercept run-time errors, take corrective measures, and then continue execution
Which of the following langages has readonly named constants? Ada Java C C#
C#
In what year was Plankalkul designed? 1934 1949 1945 1972
1945
In what year was the Fortran design project begun? 1957 19521954 1949
1954
In what year did the COBOL design process begin? 1972 1960 1959 1962
1960
For what new line of computers was PL/I designed? 360 709X 1401 Minicomputers
360
Which of the following are nonterminal symbols in the grammar rule: <factor> -> (++ | --) ident | (+ | -) (ident | int_literal) | (<expr>) + <expr> <factor> ident
<expr> <factor>
Which of the following sentences cannot be derived using the grammar of Example 3.2? A = A + (B + C) A = C * (A * C + B) A = A * (B + (C * A)) A = A * (B + ( C ))
A = A + (B + C)
A simple phrase is A phrase that includes no more than two symbols A phrase that includes no nonterminal symbols A phrase that is generated in one derivation step A phrase that includes no terminal symbols
A phrase that is generated in one derivation step
Which of the following are the two professional organizations together designed ALGOL 60? ACM GAMM GUIDE SHARE
ACM GAMM
What language used orthogonality as a primary design criterion? ALGOL 60 ALGOL 68 Fortran C
ALGOL 68
What language introduced the case statement? ALGOL-W ALGOL 60 Pascal ALGOL68
ALGOL-W
Which of the following languages use dynamic scoping? APL C# C++ Perl
APL Perl
Which of the following languages are nearly strongly typed? Fortran 95 Ada Ada C#
Ada C#
Which of the following features were added to FORTRAN IV to get FORTRAN 77? An else clause Character string handling Recursive subprograms Records
An else clause Character string handling
Which of the following are primary design issues for names? Can names end in digits? Are names case sensitive? Can names begin with uppercase letters? Are the special words reserved words or keywords?
Are names case sensitive? Are the special words reserved words or keywords?
Which of the following is not a problem with dynamic scoping? Readability Array element access is slower Reliability Static type checking is not possible
Array element access is slower
What is one example of a lack of orthogonality in the design of C? Reserved words are written in lowercase letters There are no input or output operators Arrays cannot be returned by functions Identifiers are case sensitive
Arrays cannot be returned by functions
After language design and implementation, which of the following is not a time when bindings can take place? At link time At compile time At run time At the end of the execution of a subprogram
At the end of the execution of a subprogram
What programming language has dominated business applications over the past 40 years? Fortran C COBOL APL
COBOL
Which of the following are features of SIMULA 67 that are now important parts of object-oriented languages? Coroutines Multidimensional arrays Classes Inheritance
Classes Inheritance
Which of the following are not advantages in implementing a language with a pure interpreter? Code execution time is very fast The implementation is relatively simple Storing the whole source program requires significant storage for large programs Source-level debugging operations are easily implemented
Code execution time is very fast
What does a linker do? Collects system programs and links them to user programs Connects elements of a linked list Links gotos to their targets Connects actual parameters to formal parameters
Collects system programs and links them to user programs
Which approach to language implementation produces the fastest program execution? Hybrid system Pure interpreter Hand translation Compiler
Compiler
What has been the strongest influence on programming language design over the past 45 years? Computer architecture DoD The growth of complexity of programs Evolving program design methodologies
Computer architecture
Which of the following is not a characteristic of the overall cost of a programming language? Cost of training programmers Cost of compilers Cost of the host computer Cost of executing programs
Cost of the host computer
Which of the following semantic description systems is most mathematical? Static semantics Operational semantics Denotational semantics Axiomatic semantics
Denotational semantics
Which of the following data structures were not included in Plankalkul? Stacks Records Hashes Arrays
Hashes
Which of the following prevent a grammar from being top-down parsable? Having right recursive rules Having two RHSs of the same nonterminal that begin with the same string Having left recursive rules Having ε rules
Having right recursive rules Having two RHSs of the same nonterminal that begin with the same string
What is aliasing? Having two or more distinct referencing methods, or names, for the same memory cell Rounding a floating-point value to an integer value Having variables in different subprograms with the same name Having a subprogram that can be called by two different names
Having two or more distinct referencing methods, or names, for the same memory cell
Which of the following need not be true for a loop invariant? I => Q {I and (not B)} => Q P => I {I and B} S {I}
I => Q
What is the name of the category of programming languages whose structure is dictated by the von Neumann computer architecture? Functional Imperative Scientific Systems
Imperative
Which of the following is not a good reason to study programming languages? Increased ability to discuss programming languages Increased capacity to express ideas Better understanding of the significance of implementation Increased ability to learn new languages
Increased ability to discuss programming languages
What missing language element of ALGOL 60 damaged its chances for widespread use? Multidimensional arrays Input/output statements Double-precision data type Functions
Input/output statements
What two programming language deficiencies were discovered as a result of the research in software development in the 1970s? Insufficient control statements and incompleteness of type checking Too many reserved words Too many data types Subprograms were too restrictive
Insufficient control statements and incompleteness of type checking
Why is the von Neumann bottleneck important? It controls the speed of data transfer among registers It limits the speed of a computer It controls the speed at which subprogram linkage can be completed It restricts the flow of data between the CPU and external storage devices
It limits the speed of a computer
What does it mean for a program to be reliable? It always terminates It compiles correctly It does not modify itself during execution It performs to its specification under all conditions
It performs to its specification under all conditions
Which of the following languages use dynamic type binding? Perl JavaScript PHP C++
JavaScript PHP
Scheme is a dialect of which of the following languages? LISP Prolog Perl PL/I Perl
LISP
What programming language has dominated artificial intelligence over the past 40 years? FLOWMATIC COBOL Fortran LISP
LISP
What kind of derivation is produced by top-down parsers? Leftmost Rightmost Reverse of a rightmost Neither leftmost nor rightmost
Leftmost
What user group was the target of the first version of BASIC? Engineering students Liberal arts students Scientists Accountants
Liberal arts students
Which of the following is not a part of axiomatic semantics? Assertions Mapping functions Weakest preconditions Inference rules
Mapping functions
Why was BASIC an important language in the early 1980s? It was the best all-around language of the time Poets could then use computers Microcomputers had small memories and BASIC interpreters could be very small BASIC was good for computer music
Microcomputers had small memories and BASIC interpreters could be very small
What organization was most responsible for the early success of COBOL (in terms of extent of use)? Pentagon ACM GUIDE IBM
Pentagon
Which of the following languages have implicit type declarations? Java Perl Fortran C
Perl Fortran
Which of the following C++ features are not included in Java? Pointers Stand-alone subprograms Multiple inheritance None of the above
Pointers Stand-alone subprograms Multiple inheritance
Which of the following features are in C# but not in Java? struct type break statement Pointers for statement all of the above
Pointers struct type
A grammar is ambiguous if it: Produces a sentential form that has two distinct parse trees Has ε rules Has a rule with more than four RHSs Has two rules that have the same RHSs
Produces a sentential form that has two distinct parse trees
How can user-defined operator overloading harm the readability of a program? Programmers can define silly meanings to such operators, such as using * for addition of matrices Function calls are easier to understand than operators Program readers will not easily be able to determine the meanings of such operators Programmers require operators to retain their original meanings
Programmers can define silly meanings to such operators, such as using * for addition of matrices
By which of the following approaches were the pseudocodes off the early 1950s implemented? Hybrid systems Hardware simulation Compilers Pure interpreters
Pure interpreters
Parsers are based on which of the following mathematical machines? Deterministic finite automata Pushdown automata Turing machines Nondeterministic finite automata
Pushdown automata
Which of the following is not a reason to separate lexical analysis from syntax analysis? Portability Simplicity Efficiency Readability
Readability
What is an example of two language design criteria that are in direct conflict with each other? Readability and writability Reliability and readability Readability and reliability Orthogonality and cost
Readability and writability
What array structure is included in C#, but not in C, C++, or Java? Stacks Records Rectangular arrays Queues
Rectangular arrays
Which of the following language evaluation criteria is/are violated by having case-sensitive names? Reliability Writability Cost Readability
Reliability Writability
What kind of derivation is produced by bottom-up parsers? Rightmost Neither leftmost nor rightmos Leftmost Reverse of a rightmost
Reverse of a rightmost
What are the two kinds of statements that populate a Prolog database? Loops Rules Conditionals Facts
Rules Facts
What characteristic of Java is most evident in JavaScript? Object orientation Syntax Strong typing Semantics
Syntax
What are the concurrent program units of Ada called? Packages Procedures Functions Tasks
Tasks
Why are reserved words not recognized through state transitions in a lexical analyzer? Their structure is nearly the same as that of identifiers That would require a very large state diagram The number of reserved words may change as the language evolves Reserved words are inherently difficult to recognize using that approach
That would require a very large state diagram
What disadvantage does UNIX have as a software development environment? It does not include a sufficient number of different development tools It is too slow The interfaces to different utilities are different It only works on certain machines
The interfaces to different utilities are different
Aliases can be created by which of the following language constructs? Whole array operators Assignment statements The union types of C and C++ Pointer assignments
The union types of C and C++ Pointer assignments
Which of the following is not an advantage of LR parsers? They can detect syntax errors as soon as it is possible They are very easy to construct by hand The LR class of grammars is a superset of the class parsable by LL parsers They will work for nearly all grammars that describe programming languages
They are very easy to construct by hand
What innovation of data structuring was introduced in ALGOL 68 but is often credited to Pascal? Dynamic-length array Rectangular arrays Character string types User-defined data types
User-defined data types
What was the primary goal of the design of C++? To make Bjarne Stroustrup rich To allow programs to be organized as they could in SIMULA 67 To add array index range checking to C To provide more general features than C
To allow programs to be organized as they could in SIMULA 67
The purpose of left factoring is To convert a grammar into one that is top-down parsable To convert a grammar into one that is bottom-up parsable To convert a grammar into one that is parsable by any method To convert a grammar into one that is unambiguous
To convert a grammar into one that is top-down parsable
Which of the following are not goals of a syntax analyzer? To ensure that the numeric literals in a program are syntactically correct To produce a parse tree or a trace of a parse tree Determine whether a given string is a sentence in the language To recognize the identifiers in a program
To ensure that the numeric literals in a program are syntactically correct To recognize the identifiers in a program
Which of the following is not a factor in readability? Overall simplicity Type checking Orthogonality Control statements
Type checking
What primitive control statement often is used to build more complicated control statements in languages that lack them? swhich for while goto
goto
Which of the following are terminal symbols in the grammar rule: <factor> -> (++ | --) ident | (+ | -) (ident | int_literal) | (<expr>) ident ++ <expr> int_literal
ident ++ int_literal
The two features that best characterize Haskell are lazy evaluation. a unique syntax its special use of reserved words. list comprehensions.
lazy evaluation. list comprehensions.