4. A low-degree programming language permits the programmer to describe extra environment friendly computations, whereas a high-stage programming language describes less environment friendly computations. Give a short motivation for every choice of the question above, why you made your choice (that's, why it's appropriate if you selected it, or why it is wrong if you happen to did not choose it). Keep your motivation quick: write at most two sentences per selection. What statements about pure and impure expressions are true? Choose one or more correct reply from below. 1. There exists an expression that is considered impure in case you have a look at its parts, however which has no effect on the program state after it's fully evaluated. 2. An expression is simply impure if its evaluation requires a large amount of time or space. 3. Impure expressions must don't have any facet-impact on this system state when they are evaluated. 4. Assignment statements with impure expressions on the proper-hand aspect can be eliminated, leading to an equal program with none impure expressions.
Give a brief motivation for every selection of the previous query above, why you made your selection (that is, why it is true if you chose it, or why it is not true if you didn't select it). Keep your motivation brief: write at most two sentences per choice. What statements about exceptions are true? Choose one or more right reply from beneath. 1. Numerical errors comparable to division by zero must instantly trigger a program crash. 2. It is rarely potential to rethrow an exception that was caught before. 3. Throwing an exception all the time requires unwinding the entire name stack to seek out an exception handler. 4. An unhandled exception that was thrown might lead to a program crash. Give a brief motivation for every selection of the earlier question above, why you made your choice (that's, why it's true if you chose it, or why it's not true if you happen to didn't select it). Keep your motivation short: write at most two sentences per alternative.
What statements about object-oriented programming are true? Choose one or more appropriate reply from under. 1. Dynamic dispatch is a calling convention, the place the strategy body that is definitely invoked is determined by the run-time sort of the callee. 2. Class inheritance may generally be incompatible with Liskov's substitution precept (the place code that works on an object of kind A also works for any object that is a subtype of A). 3. Every class has an object as an occasion. 4. Objects reside on a heap, and in garbage collected languages reachable objects could also be eliminated in the background whereas the program is working. Give a brief motivation for each choice of the previous question above, why you made your choice (that's, why it's true if you chose it, or why it is not true in case you didn't select it). Keep your motivation brief: write at most two sentences per alternative. The beginning image is .
Which of the next strings are in the language outlined by the grammar above? Choose a number of right reply from under. Motivate, for each string in the earlier query above, why you made your choice (i.e. why the string is in the language if you selected it, or why it is not when you did not choose it). We use only single letter variables. Use the standard approach of resolving ambiguity: utility associates to the left, abstraction precedes software (that's, abstraction binds extra strongly than utility, or, in different phrases, abstraction has the next priority than utility). Expressions can use parentheses for disambiguation (not shown in the grammar). Draw the summary syntax tree of the next lambda expressions (in black). Circle the free variable occurrences (in red). Show the binding of variables (in inexperienced). Give five different executions of the program, i.e. 5 executions that every prints a special worth. The outcome (of the five executions) alone just isn't ample. Please additionally describe, for every execution, what occurred/how you obtained the consequence. Decide for yourself what you think of the answers. I'm impressed: the answers generated by ChatGPT seem closely related to the question, and make sense grammatically. However, when wanting extra intently into the solutions, it's revealed that the chat bot shouldn't be ready to give moderately correct answers to all questions.