Question

Java

1. Enter the following matrices into MATLABO. Don't clear your work after you enter them.

A=\left(\begin{array}{cc} -1 & 1 \\ 2 & 3 \end{array}\right), \quad B=\left(\begin{array}{ll} 1 & 2 \\ 3 & 4 \end{array}\right), \quad C=\left(\begin{array}{ccc} 1 & 2 & 3 \\ -2 & 6 & 9 \end{array}\right), \quad D=\left(\begin{array}{cccc} 2 & 2 & -2 & 4 \\ 1 & 3 & 5 & 7 \\ 2 & 4 & 6 & 8 \end{array}\right)

2. Using the above matrices, find A * B and B * A by hand, and then using MATLAB.

3. The rand function creates a row vector, column vector, or matrix with pseudo-random entries between 0 and 1. (type help rand for more information).Create a new matrix F which is 3 x 3 and has all random entries.

4. Store the first column of F in a vector called x, and then replace the second column of D by x. What happens if you try to replace the second column ofC by x?

5. An important operator that you will find useful in MATLAB is the : operator. It allows us to easily create vectors with equally spaced elements. For example, type z = 1:10 into MATLAB© and describe the results. Next type w = 1:2:10 into MATLAB© and describe the results. What does the middle term :2: determine? Now using this idea and the : operator to replace the first row of D with the vector (2, 4, 6, 8).

6. One nice thing about arrays and matrices is that most built-in functions for MATLAB will work using arrays and matrices as inputs. To see this, use the :(0.5..2).operator to create the vector y =Then enter sin(y) and explain the results.  Verified

### Question 33286  Java

3. Write behavioral code for up/down 2-bit binary counter (same as q2).Use state machine. Show the state machine diagram and implement code that reflects the state machine. Following is a template that you can use-

### Question 33285  Java

2. Write behavioral code for a 2-bit up/down counter. The counter should have synchronous reset. (State Machine is not needed)

### Question 33284  Java

1. Write behavioral Verilog code of 4-bit shift register with the functionalities: parallel load (select ==00), shift left (select ==01),shift right (select ==10), and no shift (select ==11). Consider serial input to be 0 in both shifts. Use two select line inputs. (State Machine is not needed)

### Question 28212  Java

Assuming a 1-KB page size, what are the page numbers and offsets for the following address references (provided as decimal numbers):
а. 3085
b. 42095
c. 215201
d. 650000

### Question 28211  Java

There exist 8 resources in the system. The current system state is as follows
Is this allocation safe, and if yes give one safe state and justify your answer?

### Question 28210  Java

The first known correct software solution to the critical-section problem for n processes with a lower bound on waiting of n -1 tums was presented by Eisenberg and McGuire. The processes share the following variables:
enumpstate idle, want_in, in_cs};
pstate flag[n];
int turn;
All the elements of flag are initially idle. The initial value of turn isimmaterial (between 0and n-1). The structure of process Piis shown in the following Figure. Prove that thealgorithm satisfies all three requirements forthe critical-section problem.

### Question 27578  Java

Consider the following weighted graph G on thirteen vertices:
Use either Kruskal's or Prim's algorithm to construct a minimum spanning tree for G. What is the weight of the minimum spanning tree?

### Question 27577  Java

Consider the following dependency graph:
Construct the component graph by identifying each of the strongly connected components (SCCS). Which of the following edges CAN be safely added to the dependency graph without reducing the number of strongly connected components?

### Question 27576  Java

What does it mean to say that an optimisation problem X is r-approximable, where r > 1?
Every polynomial-time approximate algorithm for X has an approximation ratio equal to r.greater than or
There is no exact algorithm for X that runs in polynomial-time.
There exists a polynomial-time algorithm for X than returns an approximate solution no worse than r times the global optimum.
These exists a polynomial-time algorithm for X than returns an optimal solution after at most r iterations.

### Question 27575  Java

Consider the following instance of the Travelling Salesman Problem:
Highlighted in bold is the following route of length62:
A → C → B → E → D → A
Using the 2-opt algorithm, which of the following modifications are valid swaps that can be made to the above route to obtain a shorter route?
Remove (A, D), (C, B)and Add(С, D), (A, B).
Remove (A, C'), (B, E)and Add(А, В), (С, Е)-
Remove (A, C'), (A, D)and add(C, D), (A, A).
Remove (A, D), (B, E)and add(А, В), (D, E).
Remove (A, D), (B,E)and add(А, E), (В, D).

### Submit query        