cck3 java help them all If a processor exhibited one branch delay slot how would you reorder
Question:
cck3 java help them all If a processor exhibited one branch delay slot how would you reorder (and possibly modify) the instructions in the following loop to gain a performance advantage? loop ldr r2,r3,#4 % r2=load(r3), r3=r3+4 add r4,r4,r2 % r4=r4+r2 add r1,r1,#1 compare r1 with constant 10 bne loop % branch if not equal to loop Digital Communication I X A B C D Y Hosts X and Y are communicating through the data network provided by the switches A, B, C and D and the links interconnecting them as shown above. Initially all packets are travelling through switches A, C and D. (a) A packet is corrupted on the link between C and D. Describe the events that take place to recover from the error when (i) an end to end flow and error control protocol is in operation (ii) flow and error control are performed on a hop by hop basis [5 marks] (b) Switch C fails. Describe the events that follow to recover when (i) the network is a datagram network (ii) the network is connection oriented
The quantum teleportation protocol is a means by which one party, Alice, can send a quantum state to another party, Bob, by transmitting just two classical bits, provided that the two already share an entangled 2-qubit state. Explain how the quantum teleportation protocol works, sketching any circuit that may be used. [6 marks] (c) The Deutsch-Jozsa problem assumes that we are given a function f : {0, 1} {0, 1} in the form of a quantum black box performing a unitary operation Uf : |abi 7 |a(b f(a))i. Sketch a circuit with only one use of Uf that determines whether f is constant or balanced. Explain carefully what measurement is performed and why it gives the desired result. [8 marks] 4 CST.2008.9.5 5 Artificial Intelligence II A friend of mine likes to ... [9:30 PM, 4/19/2022] fridahkathambi71: Fortran gives semantic meaning to parentheses, i.e. a+b+c permits compiler re-arrangement whereas (a+b)+c does not. This matters for floating point. However, since Fortran '+' is left associative the above two expressions yield the same parse tree, and we have a contradiction. (d) Two alternatives to conservative garbage collection are liberal garbage collection or new labour style de-allocation. (e) Any type 3 (regular) grammar is also a type 2 (context-free) grammar. Hence any lexer generated by lex (or JLex) could instead be generated by yacc (or Cup). (f ) When a compiler for a language like Java compiles e1+e2, it computes the types of e1 and e2 so that it can treat it as e1+(float)e2 if e1 is of type float and e2 is of type int. (g) A syntax-tree interpreter can fail (give an error) when evaluating a variable name which does not appear in the current environment. Any program which fails using static scoping will fail using dynamic scoping. (h) A syntax-tree interpreter can fail (give an error) when evaluating a variable name which does not appear in the current environment. Any program which fails using dynamic scoping will fail using static scoping. (i) A dynamically-typed language is one in which the type of a value is carried around at run-time; a type error is given at run-time if values are used inappropriately. Such languages must be dynamically linked otherwise type errors will occur. (j) Java .class files and ELF-style .o (or .obj) object files represent similar information, i.e. compiled code, a list of symbols made available to other functions, and a list of undefined symbols which the file expects to be defined elsewhere. [2 marks each] 6 CST.2003.6.7 7 Artificial Intelligence I A simple game works as follows. We have a board divided into n by m square cells. We also have an unlimited number of L-shaped tiles, each made to cover exactly three squares. The tiles can appear in any of the four possible orientations. Our aim is to cover the board completely with non-overlapping tiles. (a) A single tile on the board can be described using a list such as [[1,1],[1,2],[2,1]] containing three tuples, specifying the position of each part of the tile on the board. Consider the following Prolog predicate, which is true if the six variables describe a correct, L-shaped tile. tile([[A,B],[C,D],[E,F]]) :- C is A+1, D is B, E is A, F is B-1; C is A+1, D is B, E is A, F is B+1; C is A-1, D is B, E is A, F is B+1; C is A-1, D is B, E is A, F is B-1. Explain what happens in response to a query of the form tile([[4,5],[B,C],[D,E]]). Keep in mind the effects of backtracking. [2 marks] (b) Write a Prolog predicate goodplace([[A,B],[C,D],[E,F]],[N,M]) that is true if [[A,B],[C,D],[E,F]] is a validly shaped tile and all of its parts lie within an N by M board. Your predicate should behave under backtracking in such a way that the response to a query of the form goodplace([[10,4],[B,C],[D,E]],[10,10]). is to find the unspecified values for all tiles which have a valid shape and fall within the board. In this example there would be two such tiles. [6 marks] (c) Write a Prolog predicate tiling(Available,Solution,Size). Here, Size is the size of the board represented as above, Solution is a list of tiles that solves the problem, and Available is a list of available positions on a board of the given size. For example, if Size is [2,2] then Available is [[1,1],[1,2],[2,1],[2,2]]. Your predicate should be true if the Solution given is a valid one, and should be capable of finding a valid Solution in response to a query such as tiling([[1,1],[1,2],...,[10,10]],X,[10,10]). Full marks will only be given for predicates that can exploit backtracking to find all possible solutions.
Write program that receives a positive integer n from the user and then calculates the sum below by using a loop. Your program needs to ask the user to re-enter a different number if the user enters a non-positive one. a program that asks the user for a positive integer number. If the user enters anything else, the program would ask the user to re-enter a number or enter -1 to quit. If it is a positive number, the program then prints out a multiplication table that goes up to that number.
become a gambling cheat. He has a biased coin with Pr(head) = p and two dice. The first die is biased with Pr(n) = pn for the nth outcome with n {1, 2, 3, 4, 5, 6}. The second die is also biased, and has different numbers: its distribution is Pr(n) = qn with n {4, 5, 6, 7, 8, 9}. Evil Robot flips the coin. If he gets a head then he rolls the first die, otherwise he rolls the second. He then tells you the outcome. You see only the number obtained and nothing else. He does this m times, so you observe a sequence of m numbers in the range 1 to 9. Your aim is to estimate p and the distributions of each die, given the m numbers. In the following, n is the vector of m observed numbers (n1 nm) T , is the set of parameters {p, p1, . . . , p6, q4, . . . , q9} and we define q = 1 p. (a) Write down an expression for the distribution Pr(n|) where n {1, . . . , 9}.
(a) (i) Calculate gcd(144, 77), the greatest common divisor of 144 and 77, as an integer linear combination of 144 and 77. [4 marks] (ii) What is the multiplicative inverse of 77 in Z144 and the multiplicative inverse of 67 in Z77? [2 marks] (iii) Describe all integers x that solve the following two congruences
77 x 1 (mod 144) 67 x 3 (mod 77) Indicate how one may calculate the least natural number solution to the above. [4 marks] Justify your answers. (b) For a string w {1, 2} , let P(w) N denote the sum of all the numbers in it. For instance, P() = 0 for the null string, and P(1212) = 6. For every n N, define Sn =
w {1, 2} | P(w) = n
. In particular, S0 and 1212 S6. (i) List the elements of Sn for each n {0, 1, 2, 3, 4, 5}. [2 marks] (ii) What is the cardinality of Sn for each n N? Prove your claim. [5 marks] (iii) For all m, n N, define a bijective function
(Sm+1 Sn+1) ] (Sm Sn)
Sm+n+2
Explain (a) a technique that you could use to implement a pure functional programming language using applicative order (eager) evaluation; [6 marks] (b) a technique suitable if your implementation must use some form of lazy or normal-order evaluation. [6 marks] Comment on whether the behaviour of your implementation (b) is strictly and exactly the same as normal order evaluation in lambda-calculus. [3 marks] Comment about similarities and differences between your two techniques and any predictions you can make about their relative simplicity, performance or convenience. [5 marks] 11 Complexity Theory (a) For each k, the k-clique problem is defined as the following decision problem: Given a graph G, does it contain a clique with at least k vertices? Show that k-clique is in P for each k. [6 marks] (b) The problem Clique is defined as the following decision problem: Given a graph G and an integer k, does G contain a clique with at least k vertices? Show that Clique is NP-complete, using the assumption that 3-SAT is NP-complete. [10 marks] (c) Explain why, if P=NP then there is a polynomial time algorithm for factorising numbers.
Explain mathematically why this is the case and show how to calculate the location on the screen of the vanishing point for lines in a particular direction. [5 marks] [Hint: It may be helpful to represent lines parametrically in vector form as P(s) = A + sV where V is a direction and A is any point on the line.] 4 Computer Graphics and Image Processing Consider a curve defined by polynomial parametric segments Pi(s) for i = 1, 2, . . . m that interpolates a set of points {Ai}0im in three dimensions. (a) What is meant by Ck continuity at the junction of two segments? [3 marks] (b) What is the least order of the polynomials that must be used to achieve Ck continuity at the junctions? [2 marks] (c) Derive the Overhauser formulation for a set of weighting functions w2(s), w1(s), w0(s) and w1(s) so that the cubic curve segment joining Ai1 and Ai can be expressed as Pi(s) = w2(s)Ai2 + w1(s)Ai1 + w0(s)Ai + w1(s)Ai+1 for 1 < i < m. [10 marks] (d) Extend this formulation to give a set of parametric patches Pi,j (s, t) for 1 < i < m and 1 < j < n interpolating a surface through an array of points {Ai,j}0im,0jn. [5 marks]
A full adder for a single bit has three inputs, a, b and cin, and two outputs, s and cout for the sum and carry-out. State the formulae for s and cout in disjunctive normal form. [2 marks] (b) Explain the operation of the following three approaches for handling carry in n-bit word adders, deriving formulae for the signals involved and explaining the limiting factors on their speed: (i) ripple carry, [2 marks] (ii) carry-skip with fixed-size blocks, and [6 marks] (iii) carry-skip with variable-size blocks. [4 marks] (c) Assuming a delay of for a round of combinational logic consisting of negation, conjunction and disjunction, estimate the delays for the three designs applied to a 48-bit adder. [3 2 marks] 3 Digital Communication II (a) In the context of Quality of Service (QoS) in networking, what do we mean by elastic and inelastic applications? [2 marks] (b) Give two examples of each type of application and discuss the application attributes and QoS requirements. [8 marks] (c) Discuss the problems faced by traditional Internet routers in dealing with inelastic traffic. [6 marks] (d) How do the IntServ and DiffServ architectures differ in offering QoS, and how might they be employed together to provide an end-to-end QoS? [4 marks] 3 (TURN OVER) CST.2008.9.4During the past year, Captain's Cook found that whenever the sales increased by 25 percent, the restaurant could boost its operating cash flow by 15 percent. What is the degree of operating leverage for the restaurant? 1.6 0.40 0.6 1.43 0.65 Declaration date, Ex-dividend date, Date of payment, Date of record. Declaration date, Date of record, Ex-dividend date, Date of payment. Question 5 The length of time that a company spends on converting its inventory into sales is called the ______. Inventory period. Accounts receivable period. Accounts payable period. Operating cycle. Cash cycle. Q8) George works as an accountant for a plumbing company which needs a new equipment. The equipment will cost $50,000, and it must be replaced in six years, after which it is worthless. It falls under Class 8 so the CCA rate is 20%. The firm can issue debt at 5%. If not buying the equipment, the company can also lease the equipment for $9,000 per year. If the tax rate is 35%, what is the after-tax cost of debt? 8.40% 3.25% 4.00% 1.00% 1.75% Q9)Sam spent $200,000 on acquiring new equipment, which can be classified as a Class 10 asset for CCA purposes. He finds that the CCA rate is 30%. Calculate CCA for the year 2. (The first-year rule should be applied in this question) Question 3 options: $70,000 $35,700 $30,000 $119,000 $51,000 Q10)Battery Depot Inc. has sales of $800,000, average accounts receivable of $35,000, and average accounts payable of $22,500. The cost of goods sold is equivalent to 50% of sales. How many times does Battery Depot Inc. pay their suppliers in a year? Question 4 options: 22.86 times 15.97 times 17.78 times 35.56 times 20.53 times Q20)Jim just got a coding job so he will need a new laptop. He finds a good one, which costs $20,000 and can be used for 6 years. After that, the computer will be useless with zero salvage value due to a massive coding work. Jim has insufficient money to buy it, but he can borrow funds at an annual interest rate of 2.5%. The tax rate is 28%. The store said if Jim chooses to lease the laptop, Jim will pay for $3,500 per year (pre-tax). What is the amount of the after-tax lease payment? $2,520 $87.5 $14,400 $980 $1,067.5 Q22)Firm A has accumulated 2 million shares of firm B, hoping to acquire firm B fully. To discourage such an unfriendly takeover attempt, firm B has agreed with firm A to repurchase back those 2 million shares from firm A. Such a tactic is called (a): Golden parachute. Greenmail. Poison pill. Standstill. White knight. Q24)Your company are about to acquire a new equipment. The equipment will cost $300,000, and it must be replaced in four years, after which it is worthless. The equipment can be depreciated at a 20% CCA rate. Your company decides to raise funds by issuing debt with an interest rate of 8%. If the tax rate is 34%, what would be the break-even pre-tax lease fee? $59,673 Cannot be determined. $85,200 $90,413 $95,187
Use the following version of Model 1 to address parts a -e. Show your work. W/P = d0 -d1*L + d2*K + d3*RM (1) Endogenous Exogenous Ls = so + s1*(W/P) - s2*T (2) W, P, L, Ls, Y K, RM, T L = Ls (3) AD, C, I M, k, G Y = 100*L.7K.3 (4) AD = k*M/P (5) AD = C + I + G (6) C = .8* (Y-T) (7) 4 Quantum Computing (a) The no-cloning theorem is a statement that is often said to show that a quantum state |i cannot be exactly duplicated. (i) Give a mathematically precise statement of the no-cloning theorem. [2 marks] (ii) Give a proof of the no-cloning theorem. [4 marks]
Computer Organization and Design The Hardware Software Interface
ISBN: 978-0124077263
5th edition
Authors: David A. Patterson, John L. Hennessy