1st round ( MCQ questions based on aptitiude, DBMS, OS etc)
30 questions were there:-

1) count number of ones in binary representation of 1 to 100
2) ACID (databases)
3) A C program was given with 4 forks().we had to find   number of times it 
prints "hello world" (answer - 26)
4)2-3 questions related to expectation number
5)bob-alice puzzle and a mario-luigi puzzle
6)divide 40 weight,you can weigh on both sides
7)7 holes in a line and a fox hides either on left/right   
hole(http://www.gurmeet.net/puzzles/fox-in-a-hole/)
8)which statement is wrong: a)ping uses only ICMP b)ARP   belongs to link 
layer c)ftp use port 20 for control
9)You have 4*1 & 2*1 multiplexers.Design a 32*1 multiplexer   using minimum 
number of given multiplexers
10)which isn't http command (not exact wordings)
   a)CONNECT b)PATCH c)OPTIONS d)DEBUG
11)A triangle is given with longest side =28,one angle= 120 and product of 
other 2 sides = 240.Find sum of 3 sides.
12)You have 1-100 numbers.You take 2 numbers(remove them    from the 
array),add them,subtract 5 from sum and then       put this number(a1+a2-5) 
back into array.In this way,we     are left with 99 numbers.Repeat this 
procedure until we    left with only one element.What would be the last    
element left in the array ? a)5050 b)4555 c)4550 d)4545
13)int x;
for(int y=x;y>0;y=(x&(y-1)))
printf("Hey");
How many times it will print "Hey" ?
14)Find lowest number divisible by 1..10 and has odd number of divisors ?
15)n=4464
   D(n)=4+4+6+4=18=1+8=9
   How many numbers(1<n<123456789) are there with D(n)=5 ?
16)one question related to turing test.

Coding Round:-
2 Questions were there in coding round.We were given 90min to solve these 
problems
In First question,We had to implement LRU algorithm.We didn't have to write 
the whole program,but only to write a function.

#include <stdio>
#include <conio.h>
int lru(int N, int S, int A[101], int cached_pages[51]);

int main () {

        int N, S,T;
        int A[1001];
    scanf("%d",&T);
    while(T--){
    // N -> no of processes  S -> size of cache
        scanf("%d %d", &N, &S);
        for(int i = 0; i < N; i++)
          scanf("%d", &A[i]);

        int pages[51];
        int n_pages = lru(N, S, A, pages);
        for (int i = 0; i < n_pages; i++) {
            printf("%d", pages[i]);
            if (i != n_pages - 1) printf(" ");
            else printf("\n");
        }
        }
    
}


int lru(int N, int S, int A[101], int cached_page[51]) {
   
   // this stub was to be filled by us    
     
   return 0;

}

2)Program related to maximum profit in stock market.We were given an array 
containing stock prices on 1st,2nd...nth day and we had to calculate the 
maximum profit.
(seen this problem on careercup.com)

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/arc88O7bCBUJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to