|
1. One question on
- true hits & true misses
- conflict misses
- cache line ping pong
on a SMP 2 processor machine.
2. You are logged in on a system. Somebody mounts a file system on home.
a) Would you remain logged in?
b) You logout and you login back again. Would you be able to do that?
3. Some question on sorting algorithms ? which of the following algorithms is least dependent on the original ordering of the numbers: Bubble, insertion, merge & quick sort
4. Why recursion not possible in Fortran?
a) No Stack structure
b) No Dynamic Allocation etc etc
5. Some CFG is given and asked to choose the string accepted by this grammar.
6. So far that's what we have recollected...
7.The following program aims to check whether "a" is a power of 2.
int power2(int a)
{
int b;
b = _____;
if ((a^b)>>1 == b) return 1;
else return 0;
}
8. Following is used to find if a 32-bit number is divisible by 3
int div3(int n)
{
int i;
int sum = 0;
for(i = 0;i<32;i++)
{
if(i & 1)
sum += n&i;
else
sum -= n&i;
n>>=1;
}
if(sum == 0) return sum;
if(sum <0) sum = -sum; changed.
if(sum <3) return sum;
return ______;
}
9. Following is used for mutual exclusion:
Part A
while(1)
{
while(________);
if (!test_and_set(lock)) break;
}
Part B
A program is given, and to say what it prints:
char p = "char p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
Part C
main()
{
printf("%d",f(8));
}
int f(int i)
{
return ((--i>1)? f(i) - f(i-1):0);
}
10. Find whether the following programs have any compilation errors?
Part A
#define SRP1 struct record
typedef struct record SRP2;
SRP1 p1, p2;
SRP2 p3, p4;
swap()
{
SRP2 temp1, temp2;
temp1 = p1;
p1 = p3;
p3 = temp1;
temp2 = p2;
p2 = p4;
p4 = temp2;
}
Part B
#define EIGHT 08
main()
{
int nine;
char string="abcdefgh"
nine= EIGHT;
printf("%d",string[nine]);
}
|