Write and test an ARMv8 program to sort an array of elements. As I mentioned in

Write and test an ARMv8 program to sort an array of elements. As I mentioned in class, this problem uses a portion of your Programming Assignment 1 where you computed the smallest and largest values in an array. Here we will extend that assignment to find the “index” of the smallest and the index of the largest elements of the array. The following C code segment illustrates how we can sort the element of an array. i =0; while (i largest) { largest = a[j]; index = j;} void swap (long long int *a, long long int i, long long int j) { temp = a[i]; a[i] = a[j]; a[j] = temp; }

1. Compare and contrast the exception-handling facilities of C++ and Java. Is it

1. Compare and contrast the exception-handling facilities of C++ and Java. Is it possible in one of these languages for a client module to not have a handler for an exception that it may encounter? Which language enforces defensive design? 2. Consider the design of module SYMBOL_TABLE shown in Figure 4.16. Consider a MIDI program in which the number of begin symbols is greater than the number of end symbols Clearly, the program is syntactically incorrect. How does the module of Figure 4.16 behave in this case? How can you improve the design to deal with such a situation?

1. Suppose you decide to adopt the following policy: A module M1 may be implemen

1. Suppose you decide to adopt the following policy: A module M1 may be implemented before a module M2 if MI has no components and does not use M2 or any module comprising M2. Describe this policy formally as a relation between modules. 2. For the Ada programmer; Consider the specification part of Ada packages as a module interface description. What is the difference between exporting a type and exporting a private type? Describe this difference in terms of the exported functionality.

1. Complete the design of the language recognizer. Use both TDN and GDN to descr

1. Complete the design of the language recognizer. Use both TDN and GDN to describe your design. Describe what changes are needed to transform a two-pass solution into a one-pass solution. 2. Define the interface of a module that implements the abstract data-type STACK, where operation pop raises an exception if called to operate on an empty stack. 3. Suppose we are asked to build a cross-reference table for the variables appearing in a pro-gram. A cross-reference program is an aid to reconstructing documentation from other programs that are, by assumption, correct. Thus, according to the specification, it should never happen that a variable is used without or before being declared. For simplicity, we assume that the language does not provide rules specifying the scope of variables: All van- . able names are global. We design a cross-reference table Module CRT—an abstract object—that exports two operations: (1) Procedure NOTIFY is called to insert a variable's name in the table, along with the number of the line on which the declaration of the variable occurred. (2) Procedure OCCUR is called to record the occurrence of a variable in a statement, by specifying the variable's name and the number of. the line on which the variable occurs. As part of the contract with client modules, we specify in the interface that NOTIFY can-not be called if a variable with the same namb is already in the cross-reference table. Also, OCCUR can be called only if the variable we are transmitting as a parameter has already • been declared (i.e., it was in the cross-reference table).11ese protocols are consistent with , the 'assumption that the source program is Correct. Design a robust CRT module and provide its TDN description. Implement your design in a programming language  your choice, assuming that suitable other modules drive CRT: . Discuss the pros and cons of the language as far as exception handling is concerned.

1. Suppose that we use a language supporting procedure parameters. For example,

1. Suppose that we use a language supporting procedure parameters. For example, module M. may call a procedure P of module m:,s, passing to it procedure Q of module Mk as a para-meter. How could you define the USES relation for 143, considering the modules it uses by calling its formal procedure parameter? 2. Are IS_COMPOSED_OF and IMPLEMENTS relations on S?

Describe the stepwise refinement of the sort-by-straight-selection example discu

Describe the stepwise refinement of the sort-by-straight-selection example discussed in Example 4.10 in terms of the corresponding decomposition tree. Example 4.10 As an example, we discuss the derivation of the selection sort algorithm by stepwise refinement. This is a small programming example, not a design exercise. However, the example clearly illustrates how stepwise refinement works. Shortly, we shall see another example in which stepwise refinement is applied at the design level. The selection sort algorithm proceeds as follows:

1. Consider procedure calls that may be taken to be instances of the USES relati

1. Consider procedure calls that may be taken to be instances of the USES relation. Mutually recursive modules do not form a hierarchy. Direct recursion within a module, however, is allowed in a hierarchy. Are these statements correct? If so, what is their justification? 2. Can you define the concept of level for a general graph rather than for a DAG? Why? Why not? What does this imply about a USES relation that is not a hierarchy?

1. Discuss the effectiveness of conditional compilation as the differences betwe

1. Discuss the effectiveness of conditional compilation as the differences between the  versions become complex. 2. How can you use the generic facility in Ada to carry out the same task as in without resorting to conditional compilation?   3. Describe the USES relation among the modules we introduced to represent the stepwise refinement illustrated in and show the module structure, using GDN.

1. Do you have any personal experience with software changes in the underlying a

1. Do you have any personal experience with software changes in the underlying abstract machine? Briefly present your experience and discuss what made your software difficult to change. 2. For some existing or hypothetical application, give an example of a software change that might be due to a change in the social environment. 3. Consider the case where the USES relation is defined by a tree. What does the fact that the structure is a tree, and not a DAG, represent? In general, would you prefer a design in which the USES relation is a tree or a design in which the relation is a DAG?