Friday, September 9, 2011

Persistent Technical Paper 4

1. To find complexity of Linked list .Singly circular ordered list is there if m elements are to be
inserted what will be the complexity of time.
i. O(m*n).
ii. O(m*(m+n)).
iii. O((m+n)*log(m+n))
2. Adjacency matrix question to find shortest path Ans=7.
A B C D E
A 0 m
B m 0 2 2 m
C 0 5
D 0 6
E 0
Where m=infinity, Find shortest path from B to E.
3. Forest & Tree question to find total no of nodes
1 n-(p+2) ANS
2. n-p+2.
3. n-p. etc
same question is in Sahni I think go thru it.
4. Infix to Postfix expression Of A+B*(C+D)/E+F {ANS=ABCD+*E/+F+ } question is not
confirm but pattern is of same type
DBMS
1. Query from Navathe Select fname,lname from employee where eno in (select eno from workson
where pno=(select * from project)); what is the output .
2. 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
3. What is the main use of B & B+ trees in database Ans= For queries
4. question on Left outer Join & Full outer Join. For both Variables are given & in options
relationship is given to find whichever have greater tuples.
5. To save space which option is better . Options are
i. Write all join operation than select than project.
ii. Write all join operation than project than select.
iii. Write all join operation in between select & project.
OS
1. Using LRU how many page faults are generated. 20 pages are there Ans=6 page fault
2. match the column
Options
i. semaphore i
ii. Monitor ii
iii. Deadlock iii
iv. Mutual Exclusion iv. Iv
3. One question on file locking. Scenario is given
Ans 1. Provide indefinite locking
4. Prevent intermediate file Access. (Both 1 & 2)
5. If there are n processes & each process waits p time in waiting state then CPU utilization is
(options are)
1. 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.
General
1. Probability to find digits which not contain 7 between 100 to 999 Ans=18/25
2. Packet switching & Circuit Switching some diff are there Ans= CS take more time to
established circuit.
3. A file have 3 bits for char such type of question Ans= 27000 or 24000(Confused)
4. Hash table question Ans=2.
A hash table has size of 11 & data filled in its positions like {3,5,7,9,6} how many comparison s
have made if data is not found in the list in worst case?.
Options= i. 2 ii. 6 iii. 11 iv. 1
5. From the set {a,b,c,d,e,f} find no. of arrangements for 3 alphabets with no data repeated.
ANS=360. OR for 4 alpha ANS=720.
C Programming
1. Array pointer is pass
2. String Buffer Question
3. String Concatenate(Char *s1,Char *s2)
{
Char buf[1000];
Buf[0]=null;
Strcat(buf,s1);
Strcat(buf,s2);
Return buf;
} i. should not return pointer to local variable.
ii. Nothing Wrong in this function.
iii. It don’t work if length exceeds 1000 char.
iv. Error in this code.
4. foo() call how many times Ans=5050.
For(i=1;i<=100;i++)
For (j=1;j<=100;j++)
Foo();
Programming Section ( mainly ask 2 programs.)
1. 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.
2. 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)

No comments:

Post a Comment