Pramati Placement Paper
|
|
There is some information regarding the written test conducted by Pramati Technologies (www.pramati.com) this year. I don't have the question paper with me, but following are the questions which I know were there in their paper:
(NOTE: There were 2 sections of which, second section was subdivided into two subsections. The first section was Analytical and Logical Reasoning. The 1st and 2nd subsections of the second section were 'Computer Basics' and 'C/Java knowledge'. The no. of questions in each section and corresponding time is as follows : section no. of questions time
C/Java 1230
Computer Basics 2015
Analytical/Logical3030
)
1) Write a program in C/java for implementing towers of honoi. The function should take the number of rings as the argument. The output
should be of this form:
Move from disc 1 to 3
Move from disc 1 to 2 ...
2) Identify the error in the following code, if any. If there is no error, then mention the output of the code.
main(){
union test {
char *id;
char *name;
};
union test me;
me.id = "hello";
printf("\n%s",me.id);
printf("\n%s",me.name);
}
3) Mention the error, if any, in the following code. If there is no error, then mention the output of the code:
main(){
struct temp {
char *var1;
char *var2;
};
struct temp pn = {"Load","Reed"}, *pn1, *pn2;
void **pp;
pn1 = &pn;
pp = (void **)pn1;
*pn2 = (struct temp *)pp;
printf("%s %s\n",pn2->var1,pn2->var2);
}
4) Write a program which fork()s a child, after which, both the processes print the following information :
(a) "parent"/"child" depending upon whether it is the parent process or the child process
(b) process id
(c) parent process id
5) Write a function 'copy' which takes two file names as arguments (one source file and another target file) and copies the contents from source file to the target file.
6) There were two (multiple choice) questions regarding relation b/w threads and processes. One of them was :
--> Which is true of threads and processes:
(i) they share the same stack
(ii)they share the same heap
(iii) they take the same time for
context-switching
(iv) threads cannot communicate through sockets
7) Which of the following trees is not a height-balanced tree:
(a) AVL tree
(b) Binary-search tree
(c) Splay tree
(d) Red-black tree
8) Which of these would you use for indexing, if you want to build a
search engine:
(a) A* tree
(b) hash table
(c) B tree
(d) binary tree
9) Two questions (multi choice) on paging, trashing and segmentation. One of these questions was of the following form:
--> Which is true:
(a)Trashing results in increase in number of page faults
(b) 80X85 microprocessors don't use paging
(c) Trashing results in delay in memory access time
10) There are 6 identical cups lying inverted on a table in a row. There is a single ball under each cup. Each ball has a solid different colour. The colours of the balls are (not in order): red, magenta, purple, orange, yellow, green. The red ball is in the adjacent cup of the purple ball. The yellow ball always comes before orange ball. The green ball is in the fifth cup.
(a) Which of the following can be a possible ordering of the balls:....
11) What is the output of the following program:
#define SUM(a) (a+a)
main(){
int j = 5;
printf("\n%d",SUM(j++));
printf("\n%d",j);
}
12) Write the code for dynamically allocating memory for an m by n array using malloc();
13) Fill up the blank such that the result of the program is 10 .
float sum(float a,0 float b) { return (a+b);}
void compute(float a, float b,__________)
{
return pfunc(a,b);
}
main()
{
printf("\n%f",compute(5,5,__________));
}
14) Write the output of the following program. Some printf statements may produce undefined outputs. Indicate those statements as
<undefined>
void afunc(int i)
{
i++;
printf("%d\n",i);
}
void bfunc(int *i)
{
i++;
printf("%d\n",*i);
}
void cfunc(int *i)
{
(*i)++;
printf("%d\n",i);
}
main()
{
int i=1;
printf("%d\n",i);
afunc(i);
bfunc(&i);
cfunc(&i);
printf("%d\n",i);
}
15) The alteration of table schema will be done in
a) DDL
b) DML
c) WSDL
d) DCL
16) What is the output of the following program :-
main()
{
char c;
for (c=0; c <= 255; c++)
{
printf("\n%c %d",c,c);
}
}
17) There is a grid like structure in which each cell is either a building (obstruction), rock ( obstruction), road (conducive),
hilly terrain ( difficult for walking). One has to go from a given cell to a destination cell. The obstructions can creep
up or disappear while walking. Which algorithm is suitable to decide the next cell in the path :
a) best-first search
b) Dijkstra's Algorithm
c) A* algorithm
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|