Friday, 30 August 2013

One97 Communications Limited

Interview: One97 Communications Limited
Location : B-121, Sector -5 , Noida
Date : 20 August 2013
                Within a kilometer from Noida Sector-15 metro station. Got ripped by auto-wala. Paid him 40 bucks for getting from metro to the office. While returning i paid only 10 bucks for the same journey. Great way to start an interview.

Written test has three sections.
1. Aptitude
2. Java (objective type)
3. Programs and sql queries.


1.  M N O
     M N O
     M N O
+   M N O
    P O N

Find the value of  M, N, O and P ? (And stop giggling on the double meaning.)

How many triangles are in this large triangle?
Ans.  543 (weird, huh. There is an entire blog post about how weird this question is...How many triangles in my cat?)

3. A murder took place after 10 pm at night. The lone witness recorded that the clock stopped at the exact time of murder. Later it was revealed that the hands on the clock remained on the same position, however their position were interchanged. What was the actual and claimed timing of the murder?

4. Find the next number in the series ( 1 2 4 13 81 122). (I am missing a number or two).

Lots of questions about how to tell the order of arrangement of items.
Example: 5 books are arranged on a shelf. A is next to B, C is between A and D and similar stuff.

5. In a game of chess i defeated "the only brother of daughter of my grandmother". Who did i defeat?
Ans. Father


Very easy questions about boolean expressions, threads, garbage collection and inner classes.

Q.1 Which expression is same as (a>=b)
Ans.    !(a<b)


Q.1 WAP to sort an alphanumeric array of String.
   Example: {a1,j3,b2,v4} should be sorted to {a1,b2,j3,v4}.

Q.2 WAP to reverse the order of words (not characters) in  a character array.
  Example: cat boy bell bottle                      becomes                      
                 bottle bell boy cat

Q.3 WAP to print all absolute numbers between 100 and 999. Absolute numbers are those where left digit is always smaller than the right digit. Example: 345

Q.4 Suppose on facebook a user puts his status and then others comment on that status.
So, a situation like this evolves:

User 1 : My status 1
FB user 2: comment1
FB user 3: comment2
FB user 2: comment3
FB user 4: comment5

User 2 : My status 2
FB user 2: comment6
FB user 3: comment7

FB user 2: comment8

All this is stored in a table status_table as ID, Status, FB_User, Comment
Find the number of comments done by each user on a particular status.

Q.5 There are two tables

Customer (customer_id, name ,phone ,address)

Order(Order_id, date, customer_id, quantity)

Write a query to display the order of each customer along with his name and other details. Their may be some customers in customer table that do not have any order in order table. So, in front of their name, address, etc. their order details should all be displayed as NULL.

Monday, 12 August 2013

Random Interview

  1. What did you do in project?
  2. Which version of Spring did you use?
  3. Which server did you use?
  4. Was the Spring that i used Spring based or XML based?
  5.  If we declare a variable in class A as final. How can multiple objects be created of class A with different values of that variable?
  6. A class implements an interface and extends an abstract class. Both the interface and the abstract class have the same method/method signature. Now can we override that method in the subclass?
  7. If we declare the method as private in abstract class then what happens?
  8. What's the difference between a JAR and a WAR file?
  9. How to distinguish between a JAR and a WAR file if both are presented in .txt format?
  10. In thread what does join(), notify(), wait() do?
  11. Difference between Link List and Set?
  12. Difference between Array List and Vector?
  13. Does return type have any role in overloading/overriding?
  14. Between Array and Link List which is more effective and when?
  15. Which one between Array and Link List should be used when frequent insertion and deletion is involved?
  16. What actually happens when we delete an element in an array?
  17. Order of Array List and Link List.
  18. What is dependency injection?

Wednesday, 7 August 2013

Snapdeal interview

Q.1 Difference between span and div?
Q.2 Create a page with rows and columns without using tr and td. Use only div and span.
Q.3 Difference between <br> and </br>.
Q.4 Ajax something.
Q.5 CSS.
Q.6 Difference between HTML 4 and HTML 5.
Q.7 Cross browser compatibility and how to check site functioning by comparing with w3schools.
Q.8 Block elements and inline elements.

Q.9 Class and block variables

Tuesday, 6 August 2013

Sirion Labs Interview

Sirion Labs
Venue: Palm something, Gurgaon. Within 15 minutes ride from Sikandarpur metro station. Auto wala will charge around 50 bucks to land you straight up there.
Date : 3 August 2013
Round I:
First round is Java basics. Well, not that basic. The questions keep getting twisty as you move through the paper. Some of them are plain silly. And yes, there are a couple of questions relating to data structures as well.
In total there are 16 questions.
No marking at all. They will simply discuss the solution to the answers. So be cautious about any guess that you make. In the interview they will discuss any question that you marked as wrong or any such question that turned out to be right in your case, but the majority got it wrong.
Questions of first round (in no particular order):

1.             class A
    public static void  X()
  public static void Y()

public class B extends A
        public void Y()
What will the following code snippet print?
B.X() ?
Explanation: From the first look it appears that either Parent or Child will be printed. But, there’s a catch. All the methods are static and static methods cannot be overridden as they are properties of class.

2.    try
   int a = 5;
catch(Exception e)
    System.out.println("Exception is ="+a);
What will be printed on running the above code snippet?
A)     Try
B)      Exception
C)      Run time error
D)      Compile time error
Ans. D) Compile time error
Explanation: You may spend a lifetime trying to figure out what’s wrong with the above code and still write A with an uneasy feeling that something is definitely amiss, maybe I am just overlooking it. Your gut feeling is correct. Something is amiss. But it’s just silly. Did you notice that the variable ‘a’ is being called in exception block while its scope ends in ‘try’? See, it’s silly. The code will simply give a compile time error.

3.   A very long question. First it lists the definition of in order, pre order and post order traversal. It refers to post order as reverse order. Whoever came up with that? Then it innocently gives the pre order traversal of a tree. ABCDE. As expected, the question asks to come up with the corresponding in order and post order traversal.
B)     Insufficient data, CDBAE
C)     Insufficient data, CABDE
D)     Insufficient data, insufficient data
Explanation: This question can have two possible answers.
In option A if we consider the in order traversal ‘CBDAE’ as part of the question then CDBAE is indeed the correct post order traversal. Hence, A is correct.
Both, B and C are incorrect because we cannot find the post order traversal without knowing both the in order and pre order traversal.
D can also be correct as only pre order traversal cannot give us both the post order and in order traversal.

4.         String a = null;
    String b = "xyz";
    String c = a+b;
What will be the output on running the above code snippet?
A)     xyz
B)     nullxyz
C)     Complie time error
D)     Run time error

5.   public int method(int n)
        int result = 0;
        n <<= 1;
        while (n > 0) {
            result += (n / 2) % 2;
        return result;
The method is called as method(13977) or some very large odd number. What will the method return in the variable result?
Explanation: N<<=1 simply multiplies N with 2. It is equivalent of n*=2.

6.   The entire code for reversing a link list. They just removed the initialization part and the part inside the loop. You have to write that part.

7.  int result =0;
   for (int i =0; i< 10; i++)
       for (int j=0; j<10; j++)
     What will be the value of result?
Explanation: The catch in this question is that i+j will be calculated after result+=i is calculated so result will eventually be ∑(10*i) i.e. (10*0+10*1+10*2…….+10*9).

      There were 9 other questions. Most of them, related to inheritance.

Round II
All the questions were related to algorithms. You can choose any language you wish.

1.   There is a 2-D matrix of 0’s and 1’s.  Given a 2D array of 1's and 0's, find the size of the largest block of 0's. For example the following 2D array:
int[][] array = {
                     {1, 0, 1, 0, 0, 0, 1, 0 },
                     {1, 0, 0, 0, 0, 0, 1, 1 },
                     {1, 1, 1, 0, 0, 0, 1, 1 }
Will return "9", because there is a 3x3 square of 0's, and that is the biggest block of 0's in the 2D space.

2.   Find the largest distance between two nodes in a binary tree.
The diameter of a tree (sometimes called the width) is the number of nodes on the longest path between two leaves in the tree. The diagram below shows two trees each with diameter nine, the leaves that form the ends of a longest path are shaded (note that there is more than one path in each tree of length nine, but no path longer than nine nodes).
The diameter of a tree T is the largest of the following quantities:
* the diameter of T’s left sub tree
* the diameter of T’s right sub tree
* the longest path between leaves that goes through the root of T (this can be computed from the heights of the sub trees of T)

1.   Implicit objects in JSP?
2.   What happens if destroy() is called on a servlet object?