You are on page 1of 7

Academy of Professionals for Aptitude Research and Training

PRACTICE TEST (Persistent) Paper Pattern: Round-1 (Objective Type): Total questions: 60 Total time: 60 minutes The first 5 questions are based on percentage, age factors, ratio and proportion etc. The next 55 questions are all from Computer Science/IT subjects like Data Structures, Microprocessor, C/C++, Java, DBMS, Networking, Operating Systems and Communication Systems. Questions can be of find the output, find the error or fill in the blanks type. Round-2 (Subjective Type): Total time: 30 minutes Essay Writing and a C program (if you cant write the program, just write the algorithm or the pseudo code). Round-3 (Technical Interview).

DATA STRUCTURE 1. Question of Binary search tree to find node when 43 will not be found. Ans: every data set was having 43 as its last element. 2. 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. a) O(m*n) 3. 4. b) O(m*(m+n)) c) O((m+n)*log(m+n))

Adjacency matrix question to find shortest path. Forest & Tree question to find total no of nodes. a) n-(p+2) b) n-p+2 c) n-p etc.

5.

Infix to Postfix expression of A+B* (C+D)/E+F Ans: ABCD+*E/+F+

DBMS 1. Query from Navathe. Select fname,lname from employee where eno is (select eno from works-on where pno=(select * from project)); What is the output? A query is given. e.g. Select name from employee where salary=salary. They ask whether query runs or not so just check it. 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 and in options, relationship is given. To find the one which has greater tuples? To save space which option is better? a) Write all join operation than select than project.

2.

3.

5.

Persistent_Practice - Page 1

Academy of Professionals for Aptitude Research and Training

b) Write all join operation than project than select. c) Write all join operation in between select & project. OS 1. 2. 3. Using LRU how many page faults are generated? 20 pages are there. Match the columns. One question on file locking. Scenario is given. Ans: Provide indefinite locking. 4. 5. Prevent intermediate file Access. If there are n processes & each process waits p time in waiting state then CPU utilization is? a) n(1-p) 6. b) (1-pn) c) 1-np d) n*p

A critical section is? Ans: a set of instruction which is shared by many processes.

General 1. 2. 3. Probability to find numbers from 100 to 999 which do not contain 7. Difference between Packet switching & Circuit Switching. Ans: CS takes more time to establish circuit. Hash table question. A hash table has size of 11 & data filled in its positions like {3, 5, 7, 9, 6}. How many comparison s are made if data is not found in the list in worst case? From the set {a, b, c, d, e, f} find no. of arrangements for 3 alphabets with no data repeated.

4.

C Programming 1. 2. 3. An array pointer is passed. String Buffer Question. String Concatenate (Char *s1, Char *s2) { Char buf[1000]; Buf[0]=null; Strcat(buf,s1); Strcat(buf,s2); Return buf; } a) Should not return pointer to local variable. b) Nothing wrong in this function.

Persistent_Practice - Page 2

Academy of Professionals for Aptitude Research and Training

c) It wont work if length exceeds 1000 char. d) Error in this code. 4. foo() is called how many times? for (i=1;i<=100;i++) for (j=1;j<=100;j++) foo(); Ans: 5050 Programming Section (mainly 2 programs) 1. Occurrence of letters in String. Get string of any length & print letters coming maximum time first than second largest i.e in descending order. Make this program using linked list. Must allocate memory dynamically. Use proper assumptions and comments everywhere. This will add more advantage. Sparse Matrix Addition. A structure of sparse matrix is given. You have to create a function sparseadd to add 2 sparse matrices. Structure is somehow like: Struct Sparsematrix { int row ; int col ; int val; SparseMatrix *next; } You have to make a function to add two sparse matrices. Function is like SparseMatrix SparseAdd(SparseMatrix s1,SparseMatrix s2).

2.

1.

Which key word in SQL restricts the user to some particular conditions? a) Password Ans: b) b) Constraint c) Username d) None of the above

2.

"int * p1,p2" will create . . . a) Tow pointers b) Single Pointer c) Compiler error d) None of the above Ans: b)

3.

Queue follows . . . a) FIFO Ans: a) b) LIFO c) BST d) AVL Tree

4.

Disk read/write header is in 15th sector and the new sectors are (25, 35, 68, 90). If it follows the Shortest Seek time first algorithm, then what will be the total seek time? (Read from a single sector is takes 3 ms) void fun (void) { FILE *fp; fp = fopen ("test.txt","w");

5.

Persistent_Practice - Page 3

Academy of Professionals for Aptitude Research and Training

fprintf (fp,"Hello"); fclose (fp); fp = fopen ("test.txt", "w"); fprintf (fp,"World"); fclose (fp); } What will be the size of "test.txt" file in bytes? Ans: 5 bytes (Content is: World) 6. The initial value of counting semaphore is 10, after which operations that value will be 7? Ans: after 3 p-operations. 7. Which modal is sufficient for GAME creation? a) Water fall modal c) Incremental Modal Ans: a) 8. If page size increases then what will be the fragmentation? a) Decreases Ans: b) 9. 10. 11. How many ways can we put 10 rings to your 4 fingers? One odd man out question. If a month of 31 days consists 4 Sundays and 4 Tuesdays, then what will be the starting day of that month? Ans: Monday 12. In how many comparisons you can find out the defective (heavier) one from 8 balls with pan balance machine? Ans: 2 iterations 13. Eliminate comments in C Program: #include <stdio.h> void main (void) { FILE *ip, * op; chat ch; int flag = 1; ip = fopen("Source.c","r"); op = fopen ("Output.txt","w"); if (ip == NULL) { printf ("Source.c file not found!"); exit(0); } b) Increases c) Remain Same b) Iterative modal c d) Spiral Modal

Persistent_Practice - Page 4

Academy of Professionals for Aptitude Research and Training

while ((ch == fgetc(ip)) != EOP) { if (ch == '/' && fgetc(op) == '*') flag = 0; if (ch == '*' && fgetc(op) == '/') flag = 1; if (flag == 1) fprintf (op,"%c",ch); } } 14. Convert non intended lines program to intended lines: Non Intended line program: if(con) { stmt } Intended line program: if(con) { stmt } Program: #include <stdio.h> void main (void) { FILE *ip, * op; chat ch; ip = fopen("Source.c","r"); op = fopen ("Output.txt","w"); if (ip == NULL) { printf ("Source.c file not found!"); exit(0); } while ((ch == fgetc(ip)) != EOP) { fprintf (op,"%c",ch); if (ch == '{') fprintf (op,"\n\t"); } fclose (fp); fclose (op); }

Persistent_Practice - Page 5

Academy of Professionals for Aptitude Research and Training

1.

What does it do? void f(int n) { if(n>0) { if(A[i]>A[j]) swap(); } else f(n-1); } a) Swap. b) Sort in ascending order. c) Sort in descending order. d) Computes permutation.

2.

Given a Fibonacci function: f(1)=1;f(2)=1 f(n) = f(n-1)+f(n-2) Which of the following is true? a) Every Second element is even. c) The series increases monotonely. e) None. b) Every third element is odd. d) For n>2, f(n)=ceiling(1.6 * f(n-1)).

3.

Where the root dir should be located? a) Anywhere on System disk. c) In Main memory. b) Anywhere on Disk. d) At a fixed location on Disk.

e) At fixed location on System Disk. 4. 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 matrixes given, suppose m1 and m2, then add them and return the resultant sparse matrix. 5. A program to arrange a string in order of occurrence of the character.

1.

Which of the following cannot be implemented efficiently in Linear Linked List? a) Quick sort b) Radix Sort c) Polynomials d) Insertion Sort e) Binary Search

2.

In a binary search tree, n=nodes, h=height of tree, what's the complexity? a) o(h) b) o(n*h) c) o(nLogn) d) o(n*n) e) None

3.

Printf("%d%d",i++,i++);

Persistent_Practice - Page 6

Academy of Professionals for Aptitude Research and Training

a) Compiler Dependent 4. void main() { printf("persistent"); main(); } a) Till stack overflows 5.

b) 4 4

c) 4 3

d) 3 4

e) None of above

b) Infinite

c) 65535

d) 34423

e) None

If table A has m rows and table B has n rows, then how many rows will the following query return? Select A.A1, B.B1 from A,B where A.A3=B.B3 a) <=(m*n) b) m*n c) <=(m+n) d) >=(m+n) and <=(m*n) e) m+n

6.

A Query optimizer optimizes according to which of the following criteria? a) Execution time b) Disk access c) CPU usage d) Communication time e) None

7.

Which of the following is not a characteristic of a transaction? a) Atomicity b) Consistency c) Normalization d) Isolation e) Durability

8.

The definition of Foreign Key is there to support a) Referential integrity b) Constraint c) None

9.

Problem: Process A, Process B WRITELOCK(X) WRITELOCK(Y) READ(X) READ(Y) ... ... a) The problem is serializable. c) It can be run in parallel. b) The problem is not serializable. d) None.

10.

Here is a file server which provides locking for mutual exclusion. If any process locks the file and is abruptly terminated, it will result in indefinitely locking. The solution they found is to implement a timer for locking of file i.e. if time is out then server assumes that the file is indefinitely locked and will terminate the process. a) This solution is perfect for mutual exclusion. b) This will solve indefinite locking. c) This will result in interleaving of file between processes.

Persistent_Practice - Page 7

You might also like