01. C pointers are non-orthogonal because a pointer is a primitive scalar type that does not consistently behave like other scalars. The following lines of code behave as expected if c and d are integers. Which lines behave inconsistently if c and d are pointers (i.e., will cause a syntax error)? A. c = d; B. d++; C. c *= d; D. c = c+d;
02. C parameters are passed by value. To pass an array you pass the value of the array's address (i.e., a pointer) as type char * or char[]. This is non-orthogonal because A. the name of the array is treated like an address. B. Index operators [] can be used on type char * and type char []. C. Both A and B are correct.
03. Assume you have a Student class in C++ that uses dynamic memory allocation for the student's name: char *name; What happens after the following code is executed if the assignment operator in line 3 performs a bit copy? (i.e., '=' is not overloaded by programmer) Student One("Sam Spade"); Student Two("Joe Smoo"); One = Two; // Line 3 strcpy(Two.name,"FooBar"); // copies "FooBar" to Two.name A. Student.One and Student.Two are both named "FooBar" B. Student.One is named "FooBar" and Student.Two is named "Joe Smoo" C. It will cause a runtime error.
char *name;
04. Which criterion for a good programming language is C most deficient in? A. efficiency B. reliability C. readability D. writeability
05. Which are true concerning C++'s exception handling facility? A. You can pass error codes back to the calling routine without using the return value. B. If objects are allocated in a try block, destructors are automatically called if an exception occurs. C. If an exception is caught in a function, the exception must be rethrown back to the calling function. D. A try block must have a matching catch block.
06. In C++ what happens to an unhandled exception? A. The exception is thrown to each function on the runtime stack in reverse call order. B. The exception is rethrown to each function on the runtime stack in call order. C. The program immediately terminates with an error message. D. There is no such thing as an unhandled exception.
07. When would you not re-throw an exception back to the calling routine? A. If you want to handle a non-critical error locally. B. If you want to execute code in the function beyond the catch block. C. Both A and B.
08. Which might be good measures of the readability of a program? A. runtime efficiency B. memory usage C. orthogonality D. comment density
09. Scripting languages generally beat compiled language for which? A. runtime efficiency B. memory usage C. writeability D. reliability
10. Which language has dominated system programming for the last 40 years? A. C B. Java C. Fortran D. Assembly
11. Which of the following is a client-side scripting language? A. Perl B. Python C. PHP D. JavaScript
12. Select the true statements. A. Java source code is compiled into bytecode and executed by the Java VM. B. Java bytecode can run on multiple platforms without recompilation. C. Some cell phones have Java support built into hardware. D. Java is a procedural and an O-O language.
13. One valid criticism of the Unix development platform is A. the lack of software development tools. B. the lack of an IDE (integrated development environment). C. both A and B
14. Which language has dominated scientific computing over the past 40 years? A. Fortran B. Cobol C. Lisp D. C
15. Which language has dominated business applications over the past 40 years? A. Fortran B. Cobol C. Ada D. C
16. Scheme is a dialect of which language? A. Fortran B. Cobol C. Lisp D. SNOBOL
17. What programming language is used primarily for AI? A. Fortran B. Cobol C. Lisp D. SNOBOL
18. The UNIX operating system is written primarily in which language? A. Fortran B. Assembly C. Lisp D. C
19. What is the primary disadvantage to multiple ways of doing the same thing? A. readability B. reliability C. writeability
20. Which of the following does not promote readability? A. orthogonality B. type checking C. code reusability
21. What is true about user-defined operator overloading? A. If done improperly, it can harm the readability of a program. B. If done properly, it can improve the readability of a program. C. both A & B
22. Which is an example of non-orthogonality in the design of C? A. The meaning of the '*' symbol depends on the context. B. Arrays cannot be returned by functions. C. Both A & B
23. What language uses orthogonality as a primary design criterion? A. Ada B. ALGOL 68 C. Java D. Python
24. What primitive control statement can build all others? A. switch B. goto C. for D. if-else
25. What is the disadvantage to using the same closing reserved word or symbol for more than one kind of control statement? A. readability B. writeability C. both A and B
26. The licensing costs of the compiler is part of the overall cost of a programming language.
27. What construct of a programming language provides process abstraction? A. subprograms B. if statements C. while loops D. structures
28. Software reliability means that the program A. never has an exception during runtime. B has an intuitive user interface. C. behaves according to specifications under all conditions.
29. Two or more distinct referencing names for the same memory location is A. parallelism B. aliasing
30. In a exception handling facility, what type of code would you put after a throw in a try block? A. The code you want executed after a non-critical exception has occurred. B. The code you want executed if an exception hasn't occurred. C. You should not put any code after a throw in a try block.
31. The strongest influence on language design over the past 45 years has been A. improvements in computer architecture B. memory cost C. the need to make programs more reliable D. object-oriented methodology
32. Which categories of languages are dictated by the von Neumann architecture? A. functional B. procedural C. imperative D. declarative
33. Which two deficiencies were discovered as a result of research in software development in the late 60s and early 70s and which subsequently resulted in structured languages such as Pascal? A. insufficient control statements B. insufficient data structures C. insufficient type checking D. lack of recursion
34. Which two language design criteria are more often in direct conflict? A. readability and reliability B. readability and writability
35. Which approach to language implementation generally results in the fastest program execution? A. compilation B. runtime interpreter
36. What is true about the symbol table used by the compiler? A. It is created during compilation and used throughout program execution. B. It contains information needed by the compiler such as type and scope attribute of all symbols. C. both A & B
37. What does a static linker do? A. collects system libraries and links them to user programs B. resolves external linkage between compilation units C. both A and B
38. The "von Neumann bottleneck" is the limit on what? A. speed of execution due to memory-to-processor throughput B. the amount of memory that can be used for cache C. both A and B.
39. Which are advantages of coding under a pure interpreter over a compiler? A. ease of modification B. ease of runtime debugging facilities C. runtime efficiency D. source portability
40. A declarative language can also be imperative.
Right: Wrong: Percent: (Must be 100% for credit)
Errors:
Name (first name only): Sleipnir Username: 3-digit ID: