Search This Blog

Friday, 6 January 2012

Latest Persistent Placement Paper

1. find postfix and prefix of A + B * ( C + D ) / E + F

2. Find out shortest path from A to B
A B C D E
A 0 m
B m 0 2 2 m
C 0 5
D 0 6
E 0

3. void main()
{
int a[5] ={1,2,3,4,5},i,j=2;
for (i =0;i<5;i++ )
func(j,a[i]);
for (i =0;i<5;i++ )
printf(“%d”,a[i]);
}
func(int j,int *a)
{
j=j+1;
a=a+j;
}

4. oid main()
{
for (a=1;a<=100;a++)
for(b=a;b<=100;b++)
foo();
}
foo()
{ }
how many times foo will be called.
a) 5050
b) 1010
c)
d)


5. what does it do?
void f(int n)
{
if(n>0)
{
if(A[i]>A[j])
swap();
}
else
f(n-1);
}

6. A sparse matrix is a matrix in which a node with val=0 is not represented. The whole matrix is represented by a Linked list where node typedef struct Node
{
int row;
int col;
int value;
sparsematrix next;
} Element, *sparsematrix;
The problem is, if there are two matrix given suppose m1 and m2, then add them and return the resultant sparsematrix.

7. Query from Navathe Select fname,lname from employee where eno in (select eno from works-on where pno=(select * from project)); what is the output .

8. Prevent intermediate file Access. (Both 1 & 2)

9. If there are n processes & each process waits p time in waiting state then CPU utilization is (options are)

10. n(1-p)
2. (1-p to the power n) ANS (not sure)
3. 1-np.
4. n*p
5. A critical section is Ans = a set of instruction which is shared by many process.


11. packet switching is better than circuit switching coz

a) it takes less time
b) it takes less bandwidth
c) it takes low frequency
d) none

12. addition of two sparse matrix in 3 tupple notation ---time 30 min 24a tree has 1000000 nodes than how many search r required to search a node

13. A program to arrange a string in order of occurrence of the character

14. A query is given eg. Select name from employee where salary=salary. They ask whether query runs or not so just check it. Ans=Query Invalid

15. What is the main use of B & B+ trees in database Ans= For queries

16. Using LRU how many page faults are generated. 20 pages are there Ans=6 page fault

17. match the column

Options
i. semaphore i
ii. Monitor ii
iii. Deadlock iii
iv. Mutual Exclusion iv. Iv

18. One question on file locking. Scenario is given

Ans 1. Provide indefinite locking

19. Occurrence of letters in String. Get string from KB of any length & print letters coming maximum time first than second largest….. i.e in descending order.
Their requirement: They want that u make this program thru linked list if u do that than it is well n good. Must allocate memory dynamically. Use proper assumptions & Comments everywhere this will add more advantage .use in all programs.
Output look like if u enter string aababbbcba
b 5 times
a 4 times
c 1 times just like that
Hint: Make array of 256 chars. Now Scan the string pick each char and according to it’s acsii value increment that index value at last u have an array which have counter for each alphabet. Sort this array & display.

20. Sparse Matrix Addition.
A structure of sparse matrix is given. You have to create a function sparseadd to add 2 sparse matrices
Structure is some how like
Struct Sparsematrix
{
int row ;
int col ;
int val;
SparseMatrix *next;
}
You have to made function to add two sparse matrices.
Function signature like
SparseMatrix SparseAdd(SparseMatrix s1,SparseMatrix s2)

21. There was a question on automata ans – the resultant string will have even no of c

22. CFG was given
S -> 1 S 1
S-> 0 S 0
S -> 1 1
S -> 0 0
Find out the string

23. One singly circular ordered list is there if M elements are to be inserted what will be the complexity of time

a) O(M*N)
b) O(M*(M+N))
c) O ((M+N) * log(M+N))
d)none of these

24. Swap
2. Sort in Ascending order
3. Sort in Descending order
4. Computes permutation

25. Given a Fibonacci function
f1=1;f2=1
fn=f(n-1)+f(n-2) which of the following is true?

1. Every Second element is even
2. Every third element is odd
3. The series increases monotonally
4. For n>2, fn=ceiling(1.6 * f(n-1))
5. None

26. Where the root dir should be located

27. Anywhere on System disk

28. Anywhere on Disk'

29. In Main memory

30. At a fixed location on Disk

31. At fixed location on System Disk

No comments:

Post a Comment