Pages

Wednesday 12 September 2012

zynga recent paper 2012



Zynga test pattern :2012
posted by :24x7techbytes

test contains 15 questions

14 multiple choice questions and one programming question

Q1.simple puzzle

Q2.some zings are zangs ,some zangs are zongs which of following conclusion is correct

a.some zings are zongs
b.some zongs are zings
c.some zongs are zings
d.none of the above

ans :c

Q3.find next letter in sequence J,H,G,F,D,S

a.I
b.C
b.T
d,A

ans :d

Q4.what is ouput for following program
int main()
{
enum xxx{a,b,c=217483640,d}
printf("%d %d",b,d);
return 0;
}

a.2 214748364
b.1 217483641
c.compile time error
d.1 -214748364

5.what is output for following program
void f(int a)
{
 static int x=a;
if(x==a)
printf("eqaul");
else if(x>a)
printf("greaterthan");
else
printf("lessthan");
}
int main()
{
f(2);
f(1);
return 0;
}

a.equal equal
b.equal greaterthan
c.equal lessthan
d.greaterthan lessthan

ans :b

Q6.which of following is equal to !(!A&&!B)

a.!(B&&A)
b.A&&B
c.A||B
d.!(A||B)

ans :c

Q7.what is output of following code
#define f1(a,b) a+b
#define f2(c,d) c*d
int main()
{
int x=f1(12,18)/f2(6,4);
printf("%d",x);
}
a.9
b.24
c.15
d.1

ans :b

Q8.you have a piece of tape n cms long fold should result in a tape whose length is an integer number of cms for eg:
a 7cm tape can be folded at the 3 cm mark to prodece 4cm tape what is min no of folds required to reach  1 cm tape
a.log2(n)
b.log2(n)-1
c.log2(n-1)+1
d.log2(n+1)-1



Q9.what is output
 conside char takes 2 bytes and short takes 2 bytes

struct str
{
int a;
int b;
};
void main()
{
str s;
s.a=10;
s.b=10;
short *sh=(short *)((void *)&s);
cout<<*sh<<endl;
}

a.20
b.10
c.1290
d.2570

Q10.starting from a white corner cell on a 8*8 chessboard if king makes 100 moves what is number of final position he can achieve (king can move one position in west ,south and nort and east)

a.1
b.4
c.32
d.64

Q11.a perfectly balanced binary tree contains 1 to 1023 and root contains value 1 and value increasing one towards leaf then what level does 768 present
a.1
b.2
c.10
d.7

ans :c

Q12.find output for following code

#define add(a,b) a+b
#define mul(c,d) c*d

int main()
{
int a=10,b=20,c=30;
d=mul(c,add(a,b));
printf("%d",d);
}
a.320
b.900
c.610
d.none

ans :c

13.what is output of following program

int main()
{
int *a=0;
a++;
return 0;
}
a.compile time error
b.segmentation fault
c.no error
d.none of the above

14.what is output of program
#define f(a,b) a##b
 int main()
 {
 int a1=1,a2=2,a3=3,a4=4.a5=5;
 for(i=1;i<=5;i++)
 printf("%d ",f(a,i);
 }
a. 1 1 1 1 1
b. 2 2 2 2 2
c. 1 2 3 4 5
d.compile time error

15.write a program to given a linked list and input k
 
  10->20->30->40->50->60->70->80->90->100

  if  k=2
  output: 20->10->40->30->60->50->80->70->100->90

  if k=3
  output:30->20->10->60->50->40->90->80->70->100

  if k=4
  output:40->30->20->10->80->70->60->50->100->90

Tuesday 11 September 2012

microsoft interview pattern and some questions

microsoft interview pattern and some questions  from nit trichy 2012



Two fields IT and IDC

technical interview:

1.implementation of malloc
2.given a string replace spaces with %20
3.atoi implementaion
4.given a list,a part of list is reversed  write a optimized program to sort
   1 2 3 6 5 4 7 8 9
  so 6 5 4 is reversed
5.dubly linked list to binary search tree

6.given filte is going to land but conditions are not good then what u will u do (this is not technical questions)

Direct i paper pattern in 2010 and 2011


Latest Directi Placement Papers 2010
Package: 10Lakh
Paper Type: Mostly Technical but they allow to appear all branches Students(CSE,ECE,CE,Civil..)
Experience: Question is base on C/C++/Algo ,OS(little) ,Puzzles mixed Apti.

Questions: 30 questions are there and you have given 45min to solve.
All Questions are multiple type. I just mention the questions options not remember.
1. What is Zombie process(From OS)

2. In decimal 184 which is equal to 1234 in x-ary format. Value of x is:
i. 3
ii. 4
iii. 5
iv. None of the above
Ans : iv

3. Find the complexity of the Equation: F(n)=F(n/2)+logn
i. logn
ii. loglogn
iii. log(n)^2
iv. (logn)^2

Ans i

4. You have 25 horses and you have to select fastest 3. You can make a race of 3 horses in one time. So how many time you have to make a race?
i. 6,
ii. 7
iii. 8
iv. 9
Ans ii

5. 4. You have 9 horses and you have to select fastest 3. You can make a race of 3 horses in one time. So how many time you have to make a race?
i. 3,
ii. 5
iii. 6
iv. 7
Ans ii

6. An AVL tree with height d. How many children it have?


7. 2^x=x^2 How many real roots are there?

8. In a ternary Tree No of leaves 28. How many nodes it have?

9. In tank with two pipes, filled within 24hrs and 16hrs and another pipe which empties it within 12hrs. If 3 pipes are opened together and what the time it requires to fill an empty thrice volumes Tank.
Ans: 144hours

10. In n-ary tree, how many leaves are there?

11. one man first go 1mile in east,1/2 mile in north, 1/4 mile in west, 1/8 mile in south, 1/16 mile in east and so on.. Now distance between destination and origin(0,0)?

12. How many 3-digit numbers are there whose sum is 13?

13. C program:
int x=150
for(y=x;y>0;y=(x&(y-1))
printf(Hi, There");
How many times how will be printed?
i. 0
ii. 1
iii. 75
iv. 150
ans: 150(not sure)

14. Get the output of the C program
int i=5;
printf("%u",&i);
What it will print:
i. 5
ii. Base address of the memory
iii. Physical address
iv. Logical address



15. A B C D ....Z
AA AB AC ....AZ
BA BB BC ....BZ
..
..
AAA AAB ... AAZ
Find the 1000th term of the sequence?




Directi Coding Question In IIT Guwahati 2010::::

In an n*n chess board you are given a position of a Knight(K) and the target position it has to reach(T). There are certain cells marked as X which the knight should not touched.
Find the least number of steps required for Knight to reach T from K.

Input:

First line  n.
Second line K in x space y format
Third line T in x space y format
Until you encounter -1 space -1, each line will have x space y format numbers indicating the locations of X.
(X and Y will be 1 based)

Output:
Integer value
(-1 if the knight cant reach T)


Example 1:

 Input:
3
11
22
33
32
-1-1
output:
-1

Example 2:

  Input:
4
11
23
-1-1
Output:
1



Directi Placement Paper 2011 NSIT
1. What is the big-O time complexity of func(p)?
 C++ code follows.
int get_power(int a, int b)
{
if(!b) return 1;
if(b%2) return a * get_power(a, b/2);
return get_power(a, b/2);
}
int func(int p)
{
int sum = 0;
for(int i = 1; i <= p; ++i) {
sum += get_power(i, 5);
}
return sum;
}
a. O(p log5)
b. O(plogp)
c. O(logp)
d. O(p)
e. O(p + logp)


2.Given a number N, generate a sequence S such that
S[ 0 ] = N
S[ i+1 ] = (3 * S[ i ] + 1) / 2 if S[ i ] is odd,
= S[ i ] / 2, if S[ i ] is even,
till you reach 1.
For example for N = 5, the sequence is 5, 8, 4, 2, 1
Given two numbers 20 and 35, generate the sequence S for A
and B, and find the number where the two sequences meet.
a.20
b.30
c.35
d.40

3.Question 6: Multiple Answer
If at least two of the statements below
are false, what is the probability that
statement 2 is true?
1. A is true.
2. B is true.
3. A is false and B is true.
a.0
b.0.25
c.0.5
d.0.75
e.1

4.What is the value of p, in main()? C code follows.
char* rev(char s[ ])
{
for(int i = 0, n = strlen(s); s[ i ]; ++i)
{
char c = s[ i ];
s[ i ] = s[ n-1-i ], s[ i ] = c;
}
return s;
}
int main()
{
char s[ ] = "uncommon ideas!";
char *p = rev(s);
}
a. !saedi nommocnu
b. ideas! uncommon
c. uncommon ideas!
d. nommocnu !saedi

5.Given 4 processes with their entering
time and execution time as follows :
Process
Name
Entering
Time
Execution
Time
P1 2 10
P2 3 8
P3 6 4
P4 10 6
A CPU following the shortest job first
algorithm(preemptive) is going to execute
them.
A shortest job first algorithm will execute
a process with the smallest CPU burst
first, because it is preemptive, If a
process is in excution and another
process comes in with CPU burst being
smaller than the remaining execution
time of the currently executing process,
then the new process will be alloted the
CPU and the process currently executing
will be sent to the waiting queue.
For the given processes above Calculate
the average waiting time.
a. 7.25
b. 6.75
c. 5.25
d. 6.25
e. None of the above

6. Given below is the post-order traversal of
a binary search tree. Which of the
following is its pre-order traversal?
(6, 5, 12, 13, 11, 15, 14, 20, 16, 10)
a. 10, 5, 6, 16, 14, 11, 13, 12, 15, 20
b. 10, 5, 6, 15, 14, 13, 11, 12, 16, 20
c. 10, 5, 6, 14, 13, 11, 12, 16, 15, 20
d. 10, 5, 6, 16, 13, 11, 12, 14, 15, 20


7. Insert the numbers in the sequence "8, 5, 1, 4, 2, 10, 12, 7, 3" into a min-heap. The order of insertion is as given. The insertion happens as described here.
If the root is said to be at level 1, the root's children at level 2, and so on, what is the level in which 8 occurs in the heap?
·         a. 1
·         b. 2
·         c. 3
·         d. 4
·         e. 5
8.
You are given a wall that is 50m wide and a rope that is 20m in length. Place the two ends of the rope on the wall and form a figure such that the enclosed area between the wall and the rope is maximized. What is this area?
·         a. 63.63
·         b. 127
·         c. 50
·         d. 127.26
·    
9. Two players are playing a game on a checker board (see image below). There is a queen at (i,j) and it can only move such that either "i" or "j" or both decrease (by any amount), that is, it can move only left, or down, or diagonally left-down. The players take turns moving the queen, and the player who first reaches origin wins. Which (i,j) values will result in a win for the first player, among the following? Assume that both players play optimally.
You cannot leave the board.
Optimal Play: A player is said to make an "optimal move" if he has considered all his moves, and all the opponent's and his subsequent moves till one of them wins. An optimal player chooses his current move assuming that the opponent will force him into a losing position, if he can.
Example: If the queen is initially at (2,1), your possible moves are to (1,1), (0,1), (2,0) or (1,0). Every one of these moves will make the opponent make his next move to (0,0) and hence (2,1) is a losing position for the first player.
The following image shows a checker board with the cell (2,3) marked in red.

  a. 4,5
·         b. 5,3
·         c. 2,3
·         d. 3,4
·         e. 3,5

goldman sachs paper pattern and questions 2012


Rounds:

1. Aptitude 25 questions : really Tough one Time: 25 min

i. You have 4218 no of balls. put 1 balls at top layer 3 at 2nd top layer then 6 and then 10 ... Continue in this way. How many layers are possible.?

ii. A B and C have chance of failure of 20%, 30% and 40%. To activate the machine at least two should be active. What is the probability that machine will be active?

iii. One circle two radius are perpendicular. Their connecting end of length 7root2. What is the area of that circle?

iv. Two mixture A and B mix in ratio 5:1. the price of each is 2:5. The labor takes .25 for producing per Kg. The rate per kg is 16.50. What is the price of B?

v. Two pipes P and Q fills a tank in 30 and 60 min. a person starts that at 5am to fill. he comes when it may fill but he saw that pipe R was also opened which empties that tank. Then he closes R. Now 20 min takes to fill the tank. What time R takes to empty the tank?

vi. A B and C are going for a party. A have 5 breads and B have 3 breads. But they ate same amount of bread. Then what amount C will pay to B?

vii. In a clock between 11 and 12, how many time two sticks will meet in integer no places?

2. C and C++ : 10 question Time: 10 min only


i. One b+ tree of order 3. insert 10 8 6 4 3 2 1 will require how many time to break the leaves maximum?

ii. Show the output:
mul(int b)
{
return(b*2);
}
main()
{
a=4;
a=mul(a=mul(a=mul(4)));
printf("\n %d",a)'
}

iii. one question from Normalization from database..

iv. one question from inheritance in C++. to show output. Parent child relations like that.

v. One task to complete take 50ms by single processor. But in pipeline processor will take 10 ms. What is the speed up for the processor when doing 240 ms sized tasks?

vi. Show the output:
main()
{
*str="C:\tc\bin\random"
prtintf("\n %s",str);
}


3. Algorithm writing Time: 25min


i. WAP to find out the day where you have given a date day/month/year format. You consider the date 1/1/2001 as Saturday as base.

ii. WAP to reverse words of a sentence. Like "August first is the Sunday" Will be shown as "Sunday the is first August"


4. Writing Essay Time: 5min

Topic: If you meet with CEO of goldman Sachs in an Elevator what what conversation will make good impression on You. 1 min conversation only



One thing must to say... Time is very less and don't waste time on only one problem others may be easy....

Sunday 9 September 2012

cisco written questions 2012



1.extern keyword
2.working of extern keyword
3.linked list reverse and string reverse
4.some questions on subnetting
5.definition of cidr(class less interdomain routing)
6.what will happen when start bootup of computer in both diskless and diskfull computer
7.what will internally  happen when type www.google.com
8.explain CIDR and ARP
9.in operating system zombie process definition  and how to find zombie process
10.what File pointer what is declaration
11.difference between unix file system and windows file system
12.belady anamoly and thrashing and segmentaion and paging 
13.process states(like ready and suspended and wait .....)
14.algorithms for routing(bellmanford and ford fulkerson)
15.multi tasking and multithreading ang multi process definitions and differences
16.can we use extern static at same time for a variable
17.diff between and static and extern

adobe recent paper nit warangal and nit trichy 2012



1.number of multiplication neded for 5^12

  int computeXn(int x int n)
  {
    if(n%2=0)
   {
   return x*x;
   }
   else if(n%2=0)
   {
   int y computeXn(x n/2);
   return y*y;
   }
   else if(n%2=1)
   {
    int y computeXn(x n/2);
    return y*y*x;
    }
   }

2.finding heigth of tree

3.fork 2 times ask to find number child proecss

4.given a number we need to find what is the number formed by last k digits

5.some questions on subnetting

6.Diff between typedef and #define?

7.Polynomial A+Bx+Cx^2+....+Nx^(n-1) this representation is more suitable for which data structure. Then P and Q are two such polynomial and how to add that two using that data structure. WAP for that.

8. Specification of variables in one language: letter follow by letter or digit.
options:
  1. (LUD)*
  2. L.(LUD)* => this one right.
  3. L.(L.D)+
  4. L.(L.D)*


9. How Generic Swap of two elements can be implemented? that supports all type line int char float double etc..

10. Two rectangle is given with following data structure
rectangle {
int left_X;
int Left_X;
int right_X;
int Right_Y;
}
Two are in X-axis wise. How to find that they are intersected or not? WAP for that...

11. Free( P) How it decide how much space should be freed in c?

12. Head(aann)=a Tail(aann)=ann cont(aa,bb)=aabb;
For which of the following : cont(head(s),head(tail(tail(s)))='ac'

  i. aaac
  ii. abbc
  iii. accc
  iv. abdc


13.getbis function gives n bits from the position p of an binary no A.

14.You have to sort large data. But your memory does not have so much space. how you can sort that.



C Round:(10 question)

1. Diff between typedef and #define?

2. getbis function gives n bits from the position p of an binary no A.

3. You have to sort large data. But your memory does not have so much space. how you can sort that.

4. a[2][3][4] pointer representation

5. You have two threads T1 and T2 they are reader and writer respectively.
With some specification:
ADDNEW.Process
PROCESS.SET
PROCESS.RESET
ENTER CS
EXIT CS
LOOP
EXIT LOOP
WAIT# PROCESS

6. sprintf() function used how and what means?

7.
An array given Arr[] which is in decreasing order. How many swapping required in
for(int index=0;indexa[j+1])
{
swap(a[j],a[j+1]);
}
}
}


8. Finding Output:
int arr[]={10,20,30,40}
int varible_ptr=arr[0];
for(int index=0;index<4;index++) { printf(" arr[%d] = %d", index, *(varible_ptr+index)); varible_ptr+=sizeof(int); } Ans: output: arr[0]=10 arr[1]=30...


1. Given the binary representation of an integer in the form of a string of
zeros and ones, write a function to return the string representation of its
2’s complement. Use only one pass of the string.

2. An output based question which was very error prone and time consuming.

3. Given that file1.c contains a string definition as:
Char st[100];
Whereas file2.c contains following piece of code:
extern char * st;
func foo ()
{
st[0]++;
}
If file1 is now included in file2.c then what problems above function may
have and in which cases?

4. Define a doubly linked list. Write a function to reverse a doubly linked
list.

5. Write a function to return the maximum of three numbers using only
ternary operator (?:)

6. Given a 3D array as shown below:
int arr[3][2][4] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21};
fine the value of the following:

**(*arr+1)

7. Give a one line description of the following explaining the difference
between the two:
Void (*ptr)(int * arr[], int n)
Void * (*ptr)(int * arr, int n)

8. Give Output:
int * x, y;
x = (int *)60;
y = (int *)20;
printf(“%d\n”,x-y);

9. #define ADD(X,Y) (X*Y)
#define MULTIPLICATION(X,Y) (X+Y)
Some expression was given, you had to give the output.

10. Write a recursive function to find the GCD of two numbers.
(Hint: use repeated division )

Engineering Paper

1. Given BAC7 in base 14. Convert it to base 7.
2. A tree traversal in preorder and inorder was given. You had to construct
the tree.
3. A prefix expression was given, you have to evaluate it.
4. A long Assembly code was given, you have to tell what it does.
5. A hash function is given:
H(x) = ((H(x)mod1000)div100 * 10 + H(x)mod10)

Some hash values were given you had to tell which one of them map to the
same hash keys.
6. A Boolean expression was given, you had to solve it.
7. Given to singly linked lists A and B, find whether linked list B points
to the middle of A or not? Use only one pass of linked list A and B.
(If linked list A contains 20 nodes then middle node = 11 and for 21 nodes
middle = 11)

8. Two unsorted arrays are given A[n] and B[n+1]. Array A contains n
integers and B contains n+1 integers of which n are same as in array B but
in different order and one extra element x. Write an optimized algorithm to
find the value of element x. Use only one pass of both arrays A and B.

9. Match the following that can be used to implement the values given on the
left column:

a) Dynamic Memory management i) Tree
b) Printer Spooling ii) Linked list
c) File system iii) stack
d) Function call iv) queue

Saturday 8 September 2012

implementation of hash table in c

#include<stdio.h>
#include<malloc.h>
#include<conio.h>
#define INTCAPACITY 10

struct hashtable
{
    int size;
    int nelements;
    struct listnode **array;
};
struct listnode
{
    int data;
    struct node *next;
};
//creating hashtable

struct hashtable * createhashtbl()
{
    int i,position;
    struct hashtable *htbl;
    struct listnode *tmp;
    htbl=malloc(sizeof(struct hashtable));
    htbl->nelements=0;
    htbl->size=INTCAPACITY;
    htbl->array=malloc(INTCAPACITY*sizeof(struct listnode*));
    for(i=0;i<INTCAPACITY;++i)
    {
        tmp=malloc(sizeof(struct listnode));
        tmp->next=NULL;
        htbl->array[i]=tmp;
        }
        printf("\n hash table created successfully");
        return htbl;
}
//hash function u can use other hashfuntions
int hash(int key,int k)
{
    return key%k;
}
//for each index in hash table im maintaing linked list with sorted order
int listinsert(struct listnode *head,int i)
{
    struct listnode *temp,*q,*t;
    if(head->next==NULL)
    {
    temp=(struct listnode *)malloc(sizeof(struct listnode));
    temp->data=i;
    temp->next=NULL;
    head->next=temp;
     
    }
       
    else
    {
        temp=(struct listnode *)malloc(sizeof(struct listnode));
        temp->data=i;
        temp->next=NULL;
        t=head;
        q=head->next;
        while(i>q->data&&q->next!=NULL)
        {
        t=q;
        q=q->next;
         }
         if(i<q->data)
         {
         t->next=temp;
         temp->next=q;
        }
        else if(q->next==NULL)
        {
            q->next=temp;
            }   
    }
    return 1;
}


//insert in to hashtable

int add(struct hashtable *htbl,int key)
{
    int lf=1,position;
   
    if(htbl->nelements/htbl->size>lf)
    {
        rehash(htbl);
        }
   
   
    position=hash(key,htbl->size);
   
    if(listinsert(htbl->array[position],key))
    {
        htbl->nelements++;
        return 1;
        }
       
        else
        return 0;
}

//rehash when number of elements pointed to index crosses loadfactor we will do rehash       
int rehash(struct hashtable *htbl)
{
    int newsize,i,position;
    struct listnode **newarray;
    struct listnode *tmp,*current;
    newsize=2*htbl->size;
    newarray=malloc(newsize*sizeof(struct listnode *));
    printf("entered to rehash");
    for(i=0;i<newsize;i++)
    {
     tmp=malloc(sizeof(struct listnode));
            tmp->next=NULL;
            newarray[i]=tmp;
            }
    for(i=0;i<htbl->size;i++)
    {
        for(current=htbl->array[i];current->next!=NULL;)
        {
            tmp=current->next;
            position=hash(tmp->data,newsize);
            listinsert(newarray[position],tmp);
            current->next=tmp->next;
            }
        }
        htbl->size=newsize;
        htbl->array=newarray;
return 1;       
     }
//find in likned list this will be used when searching a key in table
int findlink(struct listnode *root,int j)
{
    struct listnode *temp=root->next;
    if(temp==NULL) return 0;
    while(temp->data<j&&temp->next!=NULL)
    {
        temp=temp->next;
        }
    if(temp->data==j)
    return 1;
    else return 0;
}

int find(struct hashtable *htbl,int j)
{
    int k;
    k=hash(j,htbl->size);
    return findlink(htbl->array[k],j);
}   
//remove node
int removenode(struct listnode *root,int j)
{
    struct listnode *temp1,*temp2;
    if(root->next==NULL) return 0;
    temp1=root->next;
    temp2=root;
    while(temp1->next!=NULL&&temp1->data!=j)
    {
        temp2=temp1;
        temp1=temp1->next;
        }
    if(temp1->data==j)
    {
    temp2->next=temp1->next;
    free(temp1);
    return 1;
     }
     else if(temp1->next==NULL)
     return 0;
}
//remove1 function
void remove1(struct hashtable *htbl,int j)
{
    int k,l;
    k=hash(j,htbl->size);
    l=removenode(htbl->array[k],j);
    if(l==1)
    {
        htbl->nelements--;
        printf("\n deleted successfully");
    }
    else printf("\n deletion not successfull given data not present in table");
}

void main()
{
    struct hashtable *htbl;
    int i,j;
    while(1)
    {
        printf("\n ");
    printf("\n enter 1 to initialize hashtable");
    printf("\n enter 2 to add elements to hashtable");
    printf("\n enter 3 to find whether elemnt is exist or not");
    printf("\n enter 4 to delete elment");
    scanf("%d",&i);
    switch(i)
    {
   
    case 1:
            htbl=createhashtbl();
            break;
   
    case 2:
        printf("\n enter value");
        scanf("%d",&j);
        i=add(htbl,j);
        if(i==1)
        printf("\n entered successfully");
        else printf("\n not success");
        break;
       
    case 3:
        printf("\n enter element to find");
        scanf("%d",&j);
        j=find(htbl,j);
        if(j) printf("\n element present in hashtable");
        else  printf("\n element not present in hashtable");
        break;
       
    case 4:
        printf("\n enter elemnt to delete");
        scanf("%d",&j);
        remove1(htbl,j);
        break;   
        }
    }
  }

comment here if this is usefull for anyone

oracle database questions

Oracle DBA Questions
  1. SNAPSHOT is used for [DBA]
    a. Synonym,   b. Table space,   c System server, d Dynamic data replication   Ans : D
  2. We can create SNAPSHOTLOG for[DBA]
    a. Simple snapshots, b. Complex snapshots, c. Both A & B, d Neither A nor B Ans : A
  3. Transactions per rollback segment is derived from[DBA]
    a. Db_Block_Buffers,   b. Processes,   c. Shared_Pool_Size,   d. None of the above
      Ans : B
  4. ENQUEUE resources parameter information is derived from[DBA]
    a. Processes or DDL_LOCKS and DML_LOCKS,   b. LOG_BUFFER, c. DB__BLOCK_SIZE..
      Ans : A
  5. LGWR process writes information into
    a Database files, b Control files, c Redolog files, d All the above.  Ans : C
  6. SET TRANSACTION USE ROLLBACK SEGMENT is used to create user objects in a particular Tablespace
       a True,   b False   Ans : False
  7. Databases overall structure is maintained in a file called
    a Redolog file,   b Data file,   c Control file,   d All of the above.
      Ans : C
  8. These following parameters are optional in init.ora parameter file DB_BLOCK_SIZE, PROCESSES
    a True, b False Ans : False
  9. Constraints cannot be exported through EXPORT command
      a True,   b False   Ans : False
  10. It is very difficult to grant and manage common privileges needed by different groups of database users using the roles
      a True,   b False Ans : False
  11. What is difference between a DIALOG WINDOW and a DOCUMENT WINDOW regarding moving the window with respect to the application window

    a  Both windows behave the same way as far as moving the window is concerned.
    b  A document window can be moved outside the application window while a dialog window cannot be moved
    c  A dialog window can be moved outside the application window while a document window cannot be moved
    Ans : C
  12. What is the difference between a MESSAGEBOX and an ALERT 
  1. A messagebox can be used only by the system and cannot be used in user application while an alert can be used in user application also.
  2. A alert can be used only by the system and cannot be use din user application while an messagebox  can be used in user application also.
  3. An alert requires an response from the userwhile a messagebox just flashes a message
    and only requires an acknowledment from the user
  4.  An message box requires an response from the userwhile a alert just flashes a message an only
    requires an acknowledment from the user  Ans : C  
  1. Which of the following is not an reason for the fact that most of the processing is done at the server ?
      a To reduce network traffic. b For application sharing, c To implement business rules centrally,
      d None of the above
       Ans : D
  2.  Can a DIALOG WINDOW have scroll bar attached to it ?
       a Yes,   b No Ans : B
  3. Which of the following is not an advantage of GUI systems ?
     a. Intuitive and easy to use., b. GUI's can display multiple applications in multiple windows
     c. GUI's provide more user interface objects for a developer d. None of the above
     Ans :D
  4. What is the difference between a LIST BOX and a COMBO BOX ?
    a In the list box, the user is restricted to selecting a value from a list but in a combo box the user can type in value which is not in the list
    b A list box is a data entry area while a combo box can be used only for control purposes
    c In a combo box, the user is restricted to selecting a value from a list but in a list box the
    user can type in a value which is not in the list
    d None of the above
    Ans : A
  5. In a CLIENT/SERVER environment , which of the following would not be done at the client ?
     a User interface part,  b Data validation at entry line,  c Responding to user events,
     d None of the above  Ans : D
  6. Why is it better to use an INTEGRITY CONSTRAINT to validate data in a table than to use a STORED
    PROCEDURE ?
    a Because an integrity constraint is automatically checked while data is inserted into or updated in a table while a stored procedure has to be specifically invoked
    b Because the stored procedure occupies more space in the database than a integrity constraint definition
    c Because a stored procedure creates more network traffic than a integrity constraint definition
    Ans : A
  7. Which of the following is not an advantage of a client/server model ?
    a. A client/server model allows centralised control of data and centralised implementation of business rules.
    b A client/server model increases developer;s productivity
    c A client/server model is suitable for all applications
    d None of the above.
    Ans : C
  8. What does DLL stands for ?
    a Dynamic Language Library
    b Dynamic Link Library
    c Dynamic Load Library
    d None of the above
    Ans : B
  9. POST-BLOCK trigger is a
    a Navigational trigger
    b Key trigger
    c Transactional trigger                                                                          
    d None of the above
    Ans : A
  10. The system variable that records the select statement that SQL * FORMS most recently used
    to populate a block is
    a SYSTEM.LAST_RECORD
    b SYSTEM.CURSOR_RECORD
    c SYSTEM.CURSOR_FIELD
    d SYSTEM.LAST_QUERY
    Ans: D
  11. Which of the following is TRUE for the ENFORCE KEY field
    a ENFORCE KEY field characterstic indicates the source of the value that SQL*FORMS uses to populate the field
    b A field with the ENFORCE KEY characterstic should have the INPUT ALLOWED charaterstic turned off
      a Only 1 is TRUE
      b Only 2 is TRUE
      c Both 1 and 2 are TRUE
      d Both 1 and 2 are FALSE
      Ans : A
  12. What is the maximum size of the page ?
      a Characters wide & 265 characters length
      b Characters wide & 265 characters length
      c Characters wide & 80 characters length
      d None of the above
      Ans : B
  13. A FORM is madeup of which of the following objects
      a block, fields only,
      b blocks, fields, pages only,
      c blocks, fields, pages, triggers and form level procedures,
      d Only blocks.
      Ans : C
  14.  For the following statements which is true                                               
       1 Page is an object owned by a form
       2 Pages are a collection of display information such as constant text  and graphics.
         a Only 1 is TRUE
         b Only 2 is TRUE
         c Both 1 & 2 are TRUE
         d Both are FALSE
          Ans : B
  15. The packaged procedure that makes data in form permanent in the Database is
      a Post
      b Post form
      c Commit form
      d None of the above
      Ans : C
  16.  Which of the following is TRUE for the SYSTEM VARIABLE $$date$$
     a Can be assigned to a global variable
     b Can be assigned to any field only during design time
     c Can be assigned to any variable or field during run time
     d None of the above
     Ans : B
  17.  Which of the following packaged procedure is UNRESTRICTED ?
      a CALL_INPUT,   b CLEAR_BLOCK,   c EXECUTE_QUERY,   d USER_EXIT
    Ans : D
  18. Identify the RESTRICTED packaged procedure from the following           
     a USER_EXIT,   b MESSAGE,  c BREAK,  d EXIT_FORM
    Ans : D
  19. What is SQL*FORMS
     a SQL*FORMS is a 4GL tool for developing & executing Oracle based interactive applications.
     b SQL*FORMS is a 3GL tool for connecting to the Database.
     c SQL*FORMS is a reporting tool
     d None of the above.
     Ans : A
  20. Name the two files that are created when you generate a form using Forms 3.0
     a FMB & FMX,  b FMR & FDX,  c INP & FRM,  d None of the above
      Ans : C
  21. What is a trigger
      a A piece of logic written in PL/SQL
      b Executed at the arrival of a SQL*FORMS event
      c Both A & B
      d None of the above
      Ans : C
  22. Which of the folowing is TRUE for a ERASE packaged procedure
       1 ERASE removes an indicated Global variable & releases the memory associated with it
       2 ERASE is used to remove a field from a page
       1 Only 1 is TRUE
       2 Only 2 is TRUE
       3 Both 1 & 2 are TRUE
       4 Both 1 & 2 are FALSE                                                              
       Ans : 1
  23. All datafiles related to a Tablespace are removed when the Tablespace is dropped
      a TRUE
      b FALSE
      Ans : B
  24. Size of Tablespace can be increased by
        a Increasing the size of one of the Datafiles
        b Adding one or more Datafiles
        c Cannot be increased
        d None of the above
        Ans : B
  25. Multiple Tablespaces can share a single datafile
       a TRUE
       b FALSE
       Ans : B
  26. A set of Dictionary tables are created
      a Once for the Entire Database
      b Every time a user is created
      c Every time a Tablespace is created
      d None of the above
      Ans : A
  27. Datadictionary can span across multiple Tablespaces          
      a TRUE
      b FALSE
      Ans : B
  28. What is a DATABLOCK
      a Set of Extents
      b Set of Segments
      c Smallest Database storage unit
      d None of the above
      Ans : C
  29. Can an Integrity Constraint be enforced on a table if some existing table data does not satisfy the constraint
      a Yes
      b No
      Ans : B
  30. A column defined as PRIMARY KEY can have NULL's
      a TRUE
      b FALSE
      Ans : B
  31. A Transaction ends
      a Only when it is Committed
      b Only when it is Rolledback
      c When it is Committed or Rolledback
      d None of the above
      Ans : C
  32. A Database Procedure is stored in the Database                               
      a In compiled form
      b As source code
      c Both A & B
      d Not stored
      Ans : C
  33. A database trigger doesnot apply to data loaded before the definition of the trigger
     a TRUE
     b FALSE
     Ans : A
  34. Dedicated server configuration is
      a One server process - Many user processes
      b Many server processes - One user process
      c One server process - One user process
      d Many server processes - Many user processes
      Ans : C
  35. Which of the following does not affect the size of the SGA
      a Database buffer
      b Redolog buffer
      c Stored procedure
      d Shared pool
      Ans : C
  36. What does a COMMIT statement do to a CURSOR
      a Open the Cursor
      b Fetch the Cursor
      c Close the Cursor
      d None of the above
      Ans : D
  37. Which of the following is TRUE
     1 Host variables are declared anywhere in the program
     2 Host variables are declared in the DECLARE section
       a Only 1 is TRUE
       b Only 2 is TRUE
       c Both 1 & 2are TRUE
       d Both are FALSE
       Ans : B
  38. Which of the following is NOT VALID is PL/SQL
       a Bool boolean;
       b NUM1, NUM2 number;
       c deptname dept.dname%type;
       d date1 date := sysdate
       Ans : B
  39.  Declare
     fvar number := null; svar number := 5
     Begin
     goto << fproc>>
     if fvar is null then
       << fproc>>
       svar := svar + 5
       end if;
       End;
     What will be the value of svar after the execution ?
    a Error
    b 10
    c 5
    d None of the above
    Ans : A
  40. Which of the following is not correct about an Exception ?
      a Raised automatically / Explicitly in response to an ORACLE_ERROR
      b An exception will be raised when an error occurs in that block
      c Process terminates after completion of error sequence.
      d A Procedure or Sequence of statements may be processed.
      Ans : C
  41. Which of the following is not correct about User_Defined Exceptions ?            
     a  Must be declared
     b  Must be raised explicitly
     c   Raised automatically in response to an Oracle error
     d   None of the above
     Ans : C
  42. A Stored Procedure is a
    a Sequence of SQL or PL/SQL statements to perform specific function
    b Stored in compiled form in the database
    c Can be called from all client environmets
    d All of the above
    Ans : D
  43. Which of the following statement is false
    a Any procedure can raise an error and return an user message and error number
    b Error number ranging from 20000 to 20999 are reserved for user defined messages
    c Oracle checks Uniqueness of User defined errors
    d Raise_Application_error is used for raising an user defined error.
    Ans : C
  44. Is it possible to open a cursor which is in a Package in another procedure ?
    a Yes
    b No
    Ans : A
  45.  Is it possible to use Transactional control statements in Database Triggers?          
    a Yes
    b No
    Ans : B
  46. Is it possible to Enable or Disable a Database trigger ?
    a Yes
    b No
    Ans : A
  47. PL/SQL supports datatype(s)
    a Scalar datatype
    b Composite datatype
    c All of the above
    d None of the above
    Ans C
  48. Find the ODD datatype out
    a VARCHAR2
    b RECORD
    c BOOLEAN
    d RAW
    Ans : B
  49. Which of the following is not correct about the "TABLE" datatype ?             
    a Can contain any no of columns
    b Simulates a One-dimensional array of unlimited size
    c Column datatype of any Scalar type
    d None of the above
    Ans : A
  50. Find the ODD one out of the following
    a OPEN
    b CLOSE
    c INSERT
    d FETCH
    Ans C
  51. Which of the following is not correct about Cursor ?
    a Cursor is a named Private SQL area
    b Cursor holds temporary results
    c Cursor is used for retrieving multiple rows
    d SQL uses implicit Cursors to retrieve rows
    Ans : B
  52. Which of the following is NOT VALID in PL/SQL ?
    a Select ... into
    b Update
    c Create
    d Delete
     Ans : C
  53. What is the Result of the following 'VIK'||NULL||'RAM' ?              
    a Error 
    b VIK RAM
    c VIKRAM
    d NULL 
    Ans : C
  54. Declare
      a number := 5; b number := null; c number := 10;
      Begin
      if a > b AND a < c then
      a := c * a;
      end if;
     End;
     What will be the value of 'a' after execution ?
      a 50
      b NULL
      c 5
      d None of the above
     Ans : C
  55. Does the Database trigger will fire when the table is TRUNCATED ?
    a Yes
    b No
    Ans : B
  56. SUBSTR(SQUARE ANS ALWAYS WORK HARD,14,6) will return                 
    a ALWAY
    b S ALWA
    c ALWAYS
    Ans : C
  57. REPLACE('JACK AND JUE','J','BL') will return
    a JACK AND BLUE
    b BLACK AND JACK
    c BLACK AND BLUE
    d None of the above
    Ans : C
  58.  TRANSLATE('333SQD234','0123456789ABCDPQRST','0123456789') will return
    a 333234
    b 333333
    c 234333
    d None of the above
    Ans : A
  59. EMPNO ENAME SAL
    A822 RAMASWAMY 3500
    A812 NARAYAN 5000
    A973 UMESH 2850
    A500 BALAJI 5750
    Use these data for the following Questions
    Select SAL from EMP E1 where 3 > ( Select count(*) from Emp E2 where E1.SAL > E2.SAL ) will retrieve
    a 3500,5000,2500
    b 5000,2850
    c 2850,5750
    d 5000,5750
    Ans : A
  60. Is it possible to modify a Datatype of a column when column contains data ?
    a Yes
    b No
    Ans B
  61. Which of the following is not correct about a View ?
    a To protect some of the columns of a table from other users               
    b Ocuupies data storage space
    c To hide complexity of a query
    d   To hide complexity of a calculations
    Ans : B
  62. Which is not part of the Data Definiton Language ?
    a CREATE
    b ALTER
    c ALTER SESSION
    Ans : C
  63. The Data Manipulation Language statements are
    a  INSERT
    b  UPDATE
    c  SELECT
    d  All of the above
    Ans : D
  64. EMPNO ENAME SAL
    A822 RAMASWAMY 3500
    A812 NARAYAN 5000
    A973 UMESH
    A500 BALAJI 5750
    Using the above data
    Select count(sal) from Emp will retrieve                                          
    a 1
    b 0
    c 3
    d None of the above
    Ans : C
  65. If an UNIQUE KEY constraint on DATE column is created, will it accept the rows that are inserted with
    SYSDATE ?
    a Will
    b Won't
    Ans : B
  66. What are the different events in Triggers ?
    a Define, Create
    b Drop, Comment
    c Insert, Update, Delete
    d All of the above
    Ans : C
  67. What built-in subprogram is used to manipulate images in image items ?
    a Zoom_out
    b Zoom_in'
    c Image_zoom
    d Zoom_image
    Ans : C 
  68. Can we pass RECORD GROUP between FORMS ?
    a Yes
    b No
    Ans : A
  69. SHOW_ALERT function returns
    a Boolean
    b Number
    c Character
    d None of the above
    Ans : B
  70. What SYSTEM VARIABLE is used to refer DATABASE TIME ?          
    a $$dbtime$$
    b $$time$$
    c $$datetime$$
    d None of the above
    Ans : A
  71. SYSTEM.EFFECTIVE.DATE varaible is
    a Read only
    b Read & Write
    c Write only
    d None of the above
    Ans : C
  72. How can you CALL Reports from Forms4.0 ?
    a Run_Report built_in
    b Call_Report built_in
    c Run_Product built_in
    d Call_Product built_in
    Ans : C
  73. When do you get a .PLL extension ?
    a Save Library file
    b Generate Library file
    c Run Library file
    d None of the above
    Ans : A
  74. What is built_in Subprogram ?
    a Stored procedure & Function
    b Collection of Subprogram
    c Collection of Packages
    d None of the above
    Ans : D
  75. GET_BLOCK property is a
    a Restricted procedure
    b Unrestricted procedure
    c Library function
    d None of the above
    Ans : D
  76. A CONTROL BLOCK can sometimes refer to a BASETABLE ?              
    a TRUE
    b FALSE
    Ans : B
  77. What do you mean by CHECK BOX ?
    a Two state control
    b One state control
    c Three state control
    d none of the above
    Ans : C - Please check the Correcness of this Answer ( The correct answeris 2 )
  78. List of Values (LOV) supports
    a Single column
    b Multi column
    c Single or Multi column
    d None of the above
    Ans : C
  79. What is Library in Forms 4.0 ?
    a Collection of External field
    b Collection of built_in packages
    c Collection of PL/SQl functions, procedures and packages
    d Collection of PL/SQL procedures & triggers
    Ans : C
  80. Can we use a RESTRICTED packaged procedure in WHEN_TEXT_ITEM trigger ?
    a Yes
    b No
    Ans : B
  81. Can we use GO_BLOCK package in a PRE_TEXT_ITEM trigger ?            
    a Yes
    b No
    Ans : B
  82. What type of file is used for porting Forms 4.5 applications to various platforms ?
    a . FMB file
    b . FMX file
    c . FMT file
    d . EXE file
    Ans : C
  83. What built_in procedure is used to get IMAGES in Forms 4.5 ?
    a READ_IMAGE_FILE
    b GET_IMAGE_FILE
    c READ_FILE
    d GET_FILE
    Ans A
  84. When a form is invoked with CALL_FORM does Oracle forms issues SAVEPOINT ?
    a Yes
    b No
    Ans : A
  85. Can we attach the same LOV to different fields in Design time ?             
    a Yes
    b No
    Ans : A
  86. How do you pass values from one form to another form ?
    a LOV
    b Parameters
    c Local variables
    d None of the above
    Ans : B
  87. Can you copy the PROGRAM UNIT into an Object group ?
    a Yes
    b No
    Ans : B
    100. Can MULTIPLE DOCUMENT INTERFACE (MDI) be used in Forms 4.5 ?
    a Yes
    b No
    Ans : A
  88. Can MULTIPLE DOCUMENT INTERFACE (MDI) be used in Forms 4.5 ?
    a Yes
    b No
    Ans : A
  89. When is a .FMB file extension is created in Forms 4.5 ?                          
    a Generating form
    b Executing form
    c Save form
    d Run form
    Ans : C
  90.  What is a Built_in subprogram ?
    a Library
    b Stored procedure & Function
    c Collection of Subprograms
    d None of the above
    Ans : D
  91. What is a RADIO GROUP ?
     a Mutually exclusive
     b Select more than one column
     c Above all TRUE
     d Above all FALSE
    Ans : A
  92. Identify the Odd one of the following statements ?
    a Poplist
    b Tlist
    c List of values
    d Combo box
    Ans : C
  93. What is an ALERT ?
    a Modeless window
    b Modal window
    c Both are TRUE
    d None of the above
    Ans : B
  94. Can an Alert message be changed at runtime ?
    a Yes
    b No
    Ans : A
  95. Can we create an LOV without an RECORD GROUP ?                   
    a Yes
    b No
    Ans : B
  96. How many no of columns can a RECORD GROUP have ?
    a 10
    b 20
    c 50
    d None of the above
    Ans D
  97. Oracle precompiler translates the EMBEDDED SQL statemens into
    a Oracle FORMS
    b Oracle REPORTS
    c Oracle LIBRARY
    d None of the above
    Ans : D
  98. Kind of COMMENT statements placed within SQL statements ?
    a Asterisk(*) in column ?
    b ANSI SQL style statements(...)
    c C-Style comments (/*......*/)
    d All the above
    Ans : D
  99. What is TERM ?
    a TERM is the terminal definition file that describes the terminal from which you are using R20RUN
    ( Reports run time )
    b TERM is the terminal definition file that describes the terminal from which you are using R20DES
    ( Reports designer )
    c There is no Parameter called TERM in Reports 2.0
    d None of the above
    Ans : A
  100. If the maximum records retrieved property of a query is set to 10, then a summary value will
    be calculated
    a Only for 10 records
    b For all the records retrieved
    c For all therecords in the referenced table                                              
    d None of the above
    Ans : A
  101. With which function of a summary item in the COMPUTE AT optio required ?
    a   Sum
    b   Standard deviation
    c   Variance
    d   % of Total function
    Ans : D
  102. For a field in a repeating frame, can the source come from a column which does not exist in
    the datagroup which forms the base of the frame ?
    a Yes
    b No
    Ans : A
  103. What are the different file extensions that are created by Oracle Reports ?
    a . RDF file & .RPX file
    b . RDX file & .RDF file
    c . REP file & .RDF file
    d None of the above
    Ans : C
  104. Is it possible to Disable the Parameter form while running the report?
    a Yes
    b No
    Ans : A
  105. What are the SQL clauses supported in the link property sheet ?               
    a WHERE & START WITH
    b WHERE & HAVING
    c START WITH & HAVING
    d WHERE, START WITH & HAVING
    Ans : D
  106. What are the types of Calculated columns available ?
    a Summary, Place holder & Procedure column
    b Summary, Procedure & Formula columns
    c Procedure, Formula & Place holder columns
    d Summary, Formula & Place holder columns
    Ans.: D
  107. If two groups are not linked in the data model editor, what is the hierarchy between them?
      a There is no hierarchy between unlinked groups
      b The group that is right ranks higher than the group that is to theleft
      c The group that is above or leftmost ranks higher than the group that is to right or below it
      d None of the above
      Ans : C
  108. Sequence of events takes place while starting a Database is
    a Database opened, File mounted, Instance started
    b Instance started, Database mounted & Database opened
    c Database opened, Instance started & file mounted
    d Files mounted, Instance started & Database opened
    Ans : B
  109. SYSTEM TABLESPACE can be made off-line
    a Yes
    b No
    Ans : B
  110. ENQUEUE_RESOURCES parameter information is derived from  
    a PROCESS or DDL_LOCKS & DML_LOCKS
    b LOG BUFFER
    c DB_BLOCK_SIZE
    d DB_BLOCK_BUFFERS
    Ans : A
  111. SMON process is used to write into LOG files
    a TRUE
    b FALSE
    Ans : B
  112. EXP command is used
    a To take Backup of the Oracle Database
    b To import data from the exported dump file
    c To create Rollback segments
    d None of the above
     Ans : A
  113. SNAPSHOTS cannot be refreshed automatically
    a TRUE
    b FALSE
    Ans : B
  114. The User can set Archive file name formats
    a TRUE
    b FALSE
    Ans : A
  115. The following parameters are optional in init.ora parameter file DB_BLOCK_SIZE, PROCESS
    a TRUE
    b FALSE
    Ans : B
  116. NOARCHIEVELOG parameter is used to enable the database in Archieve mode
    a TRUE
    b FALSE
    Ans : B
  117. Constraints cannot be exported through Export command?
    a TRUE
    b FALSE
    Ans : B
  118. It is very difficult to grant and manage common priveleges needed by             
    different groups of database users using roles
    a TRUE
    b FALSE
    Ans : B
  119. The status of the Rollback segment can be viewed through
    a DBA_SEGMENTS
    b DBA_ROLES
    c DBA_FREE_SPACES
    d DBA_ROLLBACK_SEG
    Ans : D
  120. Explicitly we can assign transaction to a rollback segment
    a TRUE
    b FALSE
    Ans : A
  121. What file is read by ODBC to load drivers ?
    a ODBC.INI
    b ODBC.DLL
    c ODBCDRV.INI
    d None of the above
    Ans : A

Friday 7 September 2012

zynga previous papers 2011

zynga previous papers 2011

1.Find duplicates in Array. I presented solution in O(n) time and space using hash.
  we can do it in O(n) time and constant space. Assumption: range of numbers is known.

2.Reverse a Linked List. Iterative and then recursive

3.Reverse words : "I love to play" becomes "play to love I".
 
 sol:
  reverse each word in string then reverse total string

4.n=4 and k=3 . team name can be formed by four digits 1,2,3,4 . so n=4 now make team number using any three digits so that b1<b2<b3.
  Basically print numbers which are in form b1<b2<b3..e.g. 123,124,234 etc

5. write a function that takes two numbers a and b and returns a.b eg: a=10 and b=12 output will be 10.12

NEVIS NETWORKs Interview Questions

NEVIS NETWORKs Interview Questions 2010 IIT Guwahati
Test+ interview + Telephonic Interview

Selection criteria :
They prefer candidates with network project either in BTP or in MTP.
Test contains two parts, part A have C programming questions and part b has C questions and VLSI . U can choose either one.
Intreview (only Project)
Telephonic Interview(only abt Resume)
All the c questions are from Kernighan and Ritchie book .

Q. WAP for conversion string to float.
Q.Preorder Traversal for a given tree.
Q. WAP for DFS(depth first search).
Q. Question about storage classes.
Q. What is linkage error ?
Q. Program for Number conversion (octal to binary)


Q. Int i=0;
   While(++i<5)
    {
       For(j=0;j<10;j++)
           If(i==j)
             break;
What is the value of i at end of the program ?

 Q. #define min(a,b) (a)<(b) ? a: b;
     Main()
      {
           Int a=5,b=4,k;
           K=min(a++,b--);
           Printf(“%d %d %d”,a,b,k);
        }
     What is the o/p;
Q.
     struct
      {
       Int a;
       Char ch;
      }x;
    Printf(“%d”,sizeof(x));

  What is the o/p;

NetApps Written to Interview : IIT Guwahati

Institute: IIT Guwahati

Date of test: 3/12/2010

Package: 9Lakh

Paper Type: CSE B Tech/M Tech



Time: 1 hour only



Hei,

Written Test:


They have 4 sections,
1. Apti and analytical
2. Coding knowledge : just showing the output
3. Computer c++/Os questions..
4. Computer Systems


My suggestion: Do not start from the beginning means section 1. Start from the technical round. Read the questions and no need to waste more time for long programs see others.

Some concepts from :

1. C++ virtual functions

2. Some from on network.. to transfer 1000 meter propagation delay and transmission delay was given. and asked for 1 bit delay equals to what meter?

3. One 1000ms time to short by one PC of 1000 values by quick sort. What time require to solve 100 values in that PC

Ans: 6.67 ms



4. One system have 8 processor and 8bit require to access one block. and 12 bit require for one instruction accessing within of a block. Amount of memory have?

5. Some Programming questions on C and algo. Just not remember those.

6. Like quick sort complexity

7. U have given the code of insertion sort. But one line missing only. Fill this line...
like A[i+1=key;

8. Max heap is given. u have to insert two more keys. then what will be the inorder sequence.




Interview:

Round 1:
4 question:


1. U have given two array A[n] and B[n+1]. A and B have same elements but B have only one elements more than A. Now U have to find out that element in O(n).

I did that
2. U have to check a number is 2^n or not in constant time.

I did that


3. U have to check a binary tree is BST or not?
Write the algorithm for that.

I did that

4. a,b,c,d are the four values. U have to find out the minimum with ternary operator.

I cant do that

Just within 5min they called for the 2nd round interview..



Round 2:

He asked many question:

1. Why u r doing M tech?

2. What are inside the process?

3. What use of stack in process?

4. What is thread? Why used in OS?

5. What difference with thread and process?

6. Why demand paging is required?

7. Write the code for writing the number of lines reading from a text file. And each line u have to print the number of words that have to print also.

8. What interests u to come in NetApps?

worx-300x250-holiday

Round 3:HR round

1. Tell me about urself?

2. Scholling btech and mtech details?

3. Why u did BE in IT? Not in CSE?

4. What subjects u prefered?

5. What post u like? Development or Quality testing?

6. What u expects NetApps?

7. Will you have questions on NetApas?

Tuesday 4 September 2012

Bit Magic


1.Given a integer x, write a function that multiplies x with 3.5 and returns the integer result. You are not allowed to use %, /, *.

Examples:
Input: 2
Output: 7

Input: 5
Output: 17 (Ignore the digits after decimal point)

#include<stdio.h>
int main()
{
    int i,j,k;
    printf("enter number");
    scanf("%d",&i);
    j=i<<1;
    k=i>>1;
    i=i+j+k;
    printf("\n number after multiplying with 3.5 is %d ",i);
    return 0;
}

2.Count total set bits in all numbers from 1 to n

#include<stdio.h>
int main()
{
    int i=0,n;
    scanf("%d",&n);
    while(n>0)
    {
    i++;
    n=n&(n-1);   
    }
    printf("%d",i);
}

3.Smallest of three integers without comparison operators

#include<stdio.h>
int main()
{
    int i,j,k;
    scanf("%d%d%d",&i,&j,&k);
    while(i&&j&&k)
    {
    !(--i)&&printf("first number is small")||!(--j)&&printf("second number is small")||!(--k)&&printf("3rd number is small");   
    }
}

4.Program to count number of set bits in an (big) array

#include<stdio.h>
int fun(int n)
{
    int i=0;
    while(n>0)
    {
    i++;
    n=n&(n-1);   
    }
    return i;
}
int main()
{
    int i,k,j,sum=0;
    printf("enter no of elements in array\n");
    scanf("%d",&i);
    for(j=0;j<i;j++)
    {
    scanf("%d",&k);   
    sum=sum+fun(k);
    }
    printf("\ntotal number of set bits is %d",sum);
}

5.Count number of bits to be flipped to convert A to B
int fun(int n)
{
    int i=0;
    while(n>0)
    {
    i++;
    n=n&(n-1);   
    }
    return i;
}
#include<stdio.h>
int main()
{
    int a,b,c;
    printf("enter  a and b values");
    scanf("%d %d",&a,&b);
    c=a^b;
    printf("number of bits to filp to convert a to b is %d",fun(c));
}


6.Swap bits in a given number

Given a number x and two positions (from right side) in binary representation of x, write a function that swaps n bits at given two positions and returns the result. It is also given that the two sets of bits do not overlap.

Examples:

Let p1 and p2 be the two given positions.

Input:
x = 47 (00101111)
p1 = 1 (Start from second bit from right side)
p2 = 5 (Start from 6th bit from right side)
n = 3 (No of bits to be swapped)
Output:
227 (11100011)
The 3 bits starting from the second bit (from right side) are
swapped with 3 bits starting from 6th position (from right side) 

#include<stdio.h>
int main()
{
    int n,i,j,k,m;
    printf("enter number");
    scanf("%d",&n);
    printf("enter positions");
    scanf("%d %d",&i,&j);
    m=j;
    for(k=i;k<m&&j<32;)
    {
     if(n&(1<<k)&&n&(1<<j));//when both digits 1 no need to swap
     else if(!(n&(1<<k))&&!(n&(1<<j)));//when both digits no need to swap
     else //when both digits are not same do swap
     {
        n=n^(1<<k);
        n=n^(1<<j);       
      }
     k++;
    j++;
    }
    printf("%d",n);
    return 0;
}

7.Add 1 to a given number

Write a program to add one to a given number. You are not allowed to use operators like ‘+’, ‘-’, ‘*’, ‘/’, ‘++’, ‘–’ …etc.

Examples:
Input: 12
Output: 13

Input: 6
Output: 7

#include<stdio.h>
int main()
{
    int i,k=0;
    printf("\n enter numeber ");
    scanf("%d",&i);
    while(i&(1<<k))//go untill u find 0 digit in number then change it as 1
    {
     i=i^1<<k;   
     k++;
    }
    i=i^1<<k;
    printf("%d",i);
}

   If im wrong please correct me or give comment and you can post your solutions and questions here