Programming Language Concepts
One of the easiest methods that I use to learn new topics is by creating notes on the subject and then turning those notes into questions and answers. Remembering answers to questions just seems more natural. I was able to memorize these 104 questions and answers in less than a few hours. I wanted to start doing this for some topics that I find pretty interesting. To begin, here are some questions and answers to Programming Language Concepts (PLC). I’m reading your mind right now and the answer is yes, there will be more.
1. Name 3 reasons for studying PLC.
– Better understanding of current programming languages
– Advancement of computing
– Increased capability to express ideas
– Increased capability to learn new programming language.
– Better understanding of which programming language to choose.
2. Name the 5 programming domains and languages best suited for each.
– Scientific (Fortran, ALGOL 60)
– Business (COBOL)
– AI (Lisp, Scheme, Prolog)
– Web (PHP, Java, JavaScript)
– Gaming (C, C++)
3. What are the 4 criteria for evaluating programming languages?
– Readability
– Writability
– Reliability
– Cost
4. In Reliability, what is meant by overall simplicity?
– A simple language has a relatively small number of basic constructs
5. What is feature multiplicity?
– Having more than one way to accomplish the same task. i.e. count++ or count = count + 1
6. Define orthogonality.
– Small set of primitive constructs can be combined to build the language’s data and control structures.
7. What’s orthogonality closely related to?
– Simplicity
8. True or False? Too much simplicity can be a problem.
– True
9. True or False? Too much orthogonality can cause problems?
– True
10. Give an example of data type problem.
– C89 didn’t have boolean type so x = 1 is ambiguous and can mean either x = integer 1 or x = true
11. Fill in the word Semantics (________) should follow directly from __________ (form)
– meaning
– Syntax
12. Why is simplicity and orthogonality a problem in writability?
– A large number of features can lead to misuse of some features and disuse of superior features
13. When does orthogonality help writability?
– When the features are not overly orthogonal
14. When is a language expressive?
– A language is expressive if it has features that make it easier to perform common tasks.
15. Reliability…what is type checking?
– Checks type errors either during compilation or run-time
16. When is type checking preferred?
– During compilation since run-time checking is expensive
17. What is exception handling?
– Interception of errors during run-time and taking care of those errors.
18. What is aliasing?
– Having two or more names assigned to same memory location.
19. How does readability and writability influence reliability?
– If a language is hard to read, it’s hard to debug. If it’s written unnaturally, it’s more likely to contain bugs.
20. Name a few costs to consider when evaluating a programming language.
– Cost of training programmers
– Cost of compilation
– Cost of execution
– Cost of implementation
21. What is optimization and why is considered a factor in cost?
– Optimization is an attempt to save time or space. Optimization increases compilation time.
22. What are the most important contributors to language cost?
– Reliability, Maintenance and Program Development
23. Name some other criteria for evaluating programming languages.
– Generality
– Portability
– Well-Definedness.
24. Most popular languages have been designed around what architecture?
– Von Neumann architecture
25. What is the name of languages that are based on the von Neumann architecture?
– Imperative languages
26. What are imperative languages based on?
– Von Neumann architecture.
27. What do the variable names represent in an imperative language?
– Memory cells
28. What do assignment statements represent in an imperative language?
– The movement of data from memory to CPU and back again.
29. Name the programming design methodologies.
– Top-down design or Stepwise refinement
– Data abstraction
– Object-oriented design
30. Which language helped popularize object-oriented programming?
– Smalltalk
31. Name the four categories that programming languages are put into.
– Imperative, Functional, Logic and Object-Oriented
32. Describe a functional programming language.
– Ability to define and call functions.
33. Describe a logic language.
– Contains a set of facts and rules.
34. Object-oriented languages are often extensions of _______ _______.
– Imperative languages
35. True or False? Markup languages are programming languages?
– False
36. Name some language trade offs
– Reliability vs. Cost of execution
– Writability vs. Readability
– Writability vs. Reliability
37. Name one implementation method for a programming language.
– Compilation
38. What is compilation?
– Process where source code is translated to machine language by compiler
39. What is an advantage of compilation?
– Fast program execution
40. What are the phases of a compiler?
– Lexical analyzer, Syntax Analyzer, Intermediate Code Generator, Optimizer, Code generator
41. What does the lexical analyzer do?
– Discards comments and gathers characters into lexemes.
42. What does the syntax analyzer do?
– Checks for syntax errors and creates parse trees from lexemes.
43. What does the intermediate code generator do?
– Checks for semantic errors and translates the program into an intermediate language similar to assembly.
44. What does an optimizer do?
– Attempts to make program smaller and faster.
45. What does the code generator do?
– Translates intermediate code into machine language.
46. True or false? All phases of a compiler use a symbol table.
– True
47. What is a purpose of a linker?
– To combine code from different modules into a single program
– To include code for calls of library routines
– Include code for communication with OS
48. What is the output of a linker?
– An executable image
49. What is pure interpretation?
– Execution of a program by an interpreter without having source code being translated to lower form.
50. What is an advantage of interpretation?
– Good for debugging
51. What are some disadvantages of interpretation?
– Slow execution
– Requires more space during execution
52. Describe the hybrid implementation system.
– Source code is generated into intermediate code and is sent to an interpreter.
53. What type of intermediate code is produced by the Java Compiler?
– Byte code
54. What is Java’s interpreter called?
– Java Virtual Machine (JVM)
55. What type of compilation do Java interpreters perform?
– Just-In-Time compilation
56. What is Just-In-Time compilation?
– The translation of byte code into machine code at execution
57. Which programming languages rely on a preprocessor?
– C and C++
58. What does a preprocessor do?
– Takes embedded commands from the source code and removes them prior to compilation.
– For example, #include “myLib.h” is copied to source code
59. What is a programming environment?
– A collection of tools to develop software.
60. What is an IDE?
– Environment that provides a set of integrated tools to access through a UI.
61. Who developed Plankalkul?
– Konrad Zuse
62. What was Plankalkul good for?
– Good for expressing computations.
63. What does Plankalkul mean?
– Program Calculus
64. True or False? Plankalkul was never implemented.
– True
65. What is the simplest data structure in Plankalkul?
– Single bit
66. What types can be derived from the single bit in Plankalkul?
– Floating point and Integer
67. Fill in the blank. In Plankalkul, floating-point used ______ ___________ notation and hidden bit
– Twos-complement
68. True or False? In Plankalkul, the if statement has an optional else statement.
– False
69. Does Plankalkul have a goto statement?
– No
70. Fill in the blank. Plankalkul has a for statement similar to the one in ________.
– Pascal
71. Did Plankalkul include assertions?
– Yes
72. What are assertions?
– Mathematical expressions showing the current relationships between program variables.
73. What are some problems of machine code?
– Hard to read
– Absolute addressing makes modification tedious.
74. Name two Pseudocode languages.
– Short Code and Speedcode
75. Who developed Short Code?
– John Mauchly
76. True or False? Short code consisted of coded versions of mathematical expressions.
– True
77. How were variable’s named in Short Code?
– With byte-pair codes.
78. Was Short Code compiled or interpreted?
– Interpreted
79. What was another name for interpretation during the time of Short Code?
– Automatic Programming
80. Who developed Speedcode?
– John Backus for IBM 701
81. The 701 was extended into a virtual _____ _____ ________.
– Three point calculator
82. True or false? Speedcode was much more efficient than Machine Code?
– True
83. Who developed the UNIVAC compiling system?
– Grace Hopper
84. What were the names of the compiling systems that Grace Hopper developed?
– A-0, A-1 and A-2
85. What did the compiling systems do that Grace Hopper developed?
– Expanded pseudocodes into machine code.
86. Who developed Fortran?
– John Backus for the IBM 704
87. What was the primary goal of the Fortran compiler?
– Speed of generated code
88. True or false? The Fortran compiler was almost half as efficient as what could be done by hand.
– True
89. Fill in the blank. ________ was the first widely accepted compiled high-level language
– Fortran
90. True or False. Fortran I had I/O formatting.
– True
91. How many characters could be in a variable name in Fortran I?
– Up to 6
92. True or False? Fortran I had user-defined subroutines.
– True
93. True or False? Fortran I had an if/else statement.
– False, only an if statement
94. How did programmers declare a variable as an integer in Fortrain I? How about Floating Point?
– By having the name start with I, J, K, L, M or N, variables were implicitly integer. All others were floating point
95. What feature was added in Fortran II?
– Independent compilation of subroutines
96. True or False? Fortran III was the most successful Fortran version.
– False. Fortran was never widely distributed.
97. What was the first standardized Fortran version? Which year?
– Fortran IV in 1966.
98. Which features did Fortran IV add?
– Explicit type declaration of variables
– Ability to pass subprograms as parameters to other subprograms
– A logical IF construct
99. When did Fortran receive an ELSE to its IF statement?
– Fortran 77
100. When did Fortran start supporting lower case letters?
– Fortran 90
101. Name other features implemented in Fortran 90.
– Recursion
– Dynamic arrays, pointers and multiple selection statement
102. What did the Fortran 90 standardization include?
– A list of features to be removed
103. When did Fortran receive Object-Oriented capabilities?
– Fortran 2003
104. Name a feature added in Fortran 2008
– Better support for concurrent programming
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