Question 71
Question 72
Question 73
I1: ADD R2←R7+R8 I2 : SUB R4← R5-R6 I3 : ADD R1← R2+R3 I4 : STORE Memory [R4]←[R1] BRANCH to Label if R1== 0Which of the instructions I1, I2, I3 or I4 can legitimately occupy the delay slot without any other program modification?
Question 74
Question 76
The subset-sum problem is defined as follows. Given a set of n positive integers, S = {a1 ,a2 ,a3 ,...,an} and positive integer W, is there a subset of S whose elements sum to W? A dynamic program for solving this problem uses a 2-dimensional Boolean array X, with n rows and W+1 columns. X[i, j],1 <= i <= n, 0 <= j <= W, is TRUE if and only if there is a subset of {a1 ,a2 ,...,ai} whose elements sum to j. Which of the following is valid for 2 <= i <= n and ai <= j <= W?
Question 77
Question 78
Question 79
Question 80
1. f(int Y[10], int x) {
2. int i, j, k;
3. i = 0; j = 9;
4. do {
5. k = (i + j) /2;
6. if( Y[k] < x) i = k; else j = k;
7. } while(Y[k] != x && i < j);
8. if(Y[k] == x) printf (\"x is in the array \") ;
9. else printf (\" x is not in the array \") ;
10. }
There are 85 questions to complete.