Showing posts with label Collections. Show all posts
Showing posts with label Collections. Show all posts

Friday, 6 November 2015

Xebia

Date: 5 November 2015
Telephonic

Java:

  1. Difference between List and Set?
  2. How does Set ensure unique values?
  3. What if I want to add multiple objects with same values to Set (or something like that).
  4. Why hashcode() when equals is already there?
  5. Difference between HashMap and HashTable?
  6. Which of them takes "null" value for key?
  7. What if two objects with same values are pushed in HashMap?
  8. Why should the HashMap key be immutable?
  9. What are immutable object? Example in java.
  10. How many objects are created for different cases of String creation?
  11. In what scenarios will the different String objects result true for == and equals?
  12. What is Java SOLID? Hint: SOLID is an acronym.


Design Pattern:

  1. Name a few.
  2. What are build patterns?


Spring:

  1. What is singleton?
  2. What is prototype?
  3. What about a singleton bean inside prototype?
  4. What about a prototype beans inside singleton?
  5. Bean life cycle?
  6. Dispatcher servlet?
  7. Entity manager at DAO?
  8. Spring MVC entries.
  9. What if there is a cyclic dependency between beans.
  10. What is DI?



Saturday, 18 April 2015

Born Group

Questions:

Round I:
There were very long uncomfortable pauses between each question.
  1. What all modules in hybris have you worked upon?
  2. How to use the REST webservices of hybris?
  3. How to use the SOAP webservices of hybris?
  4. How to create a SOAP client?
  5. How to do a server side validation using Spring?
  6. What all classes are in Collections framework?
  7. Difference between ArrayList and LinkedList?
  8. How to define a cronjob in Hybris?
  9. How to customize solr?
  10. How does data from solr comes to Product listing page?
  11. What is association?
  12. How to implement association in hybris?
  13. Which element implement association in hybris in items.xml?
  14. Implementing cardinality in hybris?

    Lots of questions about web-services, spring MVC and their implementation in Hybris.
Round II:
    1. What is deployment table in hybris? How is it stored internally?
    2. Entire story about WCMS?
    3. Simple database table to store details of a family and their relations.
    4. How to override a service or any bean in java? What are the best practices?
    Round III:
    HR round
       This is where it gets interesting. The HR's have a mood swing. One moment they are the nicest, coolest most co-operating saints in corporate industry. Next moment they turn angry, fussy, exceptionally dumb, bullies. And then they turn back to their efforts for canonization. Just bear with their antics and any revolutionary idea that they come up with. Having said that these guys like to believe that they are an elite club of hybris nerds. And this means that they won't mind dolling out large lumps of CTC to pump their egos. Good for them, good for us.
    My advice is that negotiate hard, they are willing to walk the extra mile.  

    Thursday, 13 November 2014

    Deloitte interview

    Just had a telephonic interview with Deloitte. And Deloitte exploited Hybris real bad.

    Hybris Questions:

    1. Lots of question about items.xml.
    2. Difference between Collection and relation?
    3. Dynamic attribute in an item type.
    4. How to declare an item?
    5. How to extend an item?
    6. Structure of items.xml.
    7. Various tags in items.xml.
    8. Difference between type and item.
    9. How to ensure that some particular attribute is not added to DB through persistence. Something to do with dynamic attribute.
    10. Catalog vs Catalog version?
    11. How many active catalogs are there?
    12. How to make more than one active catalog?
    13. Architecture of cockpit.
    14. What are interceptor? 
    15. How many types of interceptor?
    16. What is modelcontext?
    17. Difference between save() and saveall() in modelservice.
    18. Entire hierarchy of catalog. Whatever that means!
    19. Relation between cronjob and trigger.
    20. Flexiquery.getbyexample() or something like that.
    21. Impex structure.
    22. Lazy loading in hybris.
    23. Price Groups in Hybris
    24. What if the delimiter in impex file i.e.semicolon(;) is changed to something else. How can this be done? 
    Then it was plain ol' Java stuff. Its remarkable how the java questions were so easy while Hybris ones were tougher beyond recognition.
    1. What is dynamic polymorphism, with examples.
    2. Difference between final, finalize and finally.
    3. Daemon threads
    4. Difference between ArrayList and LinkList.
    5. Difference between Set and HashSet.
    6. Objects in a JSP.
    7. Life-cycle of JSP.
    8. Tag files.
    Now, all this and more was bombarded within 15 minutes. And my eager interviewer was asking the next question before i can answer the previous one.
    Gotta say i feel quite drenched. Need a chilled cold coffee, though a nice fuck wont hurt either!!!!

    Interview dare of the century

    Tomorrow i will attempt the interview dare of this century. Okay, maybe that's exaggerated a bit, but I will be attending three interviews back to back on Friday, Saturday and Sunday. All of them in very well reputed firms. The catch is that i am not intending to join any of them.

    1. Ebix solutions: Or should i say, some Ebix Solutions. Must be a small firm with couple of employees and even lesser projects running on support. As usual, they will ask the finest of the finest details of Java and J2EE. Stuff that you never use in development, with the sole purpose of proving that interviewer is the most awesome dude in documented universe. The interview is scheduled from 10:00 am to 4:00 pm. I am planning to visit around 3:00 pm. The location is some God-forsaken place in Noida extension.
    2. Amazon: Here it gets interesting. Its AMAZON guys. Yes, that one firm for which honest, good to earth engineers will slit throats and dance nude. Its simply the best that India has to offer, apart from Microsft, Google, Adobe, Google and Facebook. And if you clear this one then you are licensed to get selected in all of them. However, its not exactly an easy-peesy task. Amazon (and the likes) are obsessed with algorithms and data structures beyond your wildest imaginations. They want you to create a double link list out of a red-brown tree that satisfies AVL by using stacks that are implemented through queues for a data that is arranged in a sparse matrix in O(1). Yes O(1), O(n) is not enough O(log n) is not enough and even though the question might ask you to sort entire libraries the answer HAS to be in O(1). Still, there are tips and tricks. Decent amount of time on GeeksForGeeks and similar websites can provide you with some ammo. How lethal it is can only be confirmed in the interview. By the way, how do i know all this? Well, because i have attended the interview before as well. Though i have told the HR that i have never been through one. This interview is on Saturday in some 5-star hotel. Sounds promising.
    3. HCL: Good old HCL. The Flying Dutchman must always have a captain. Any job seeker must always go to HCL. I already have an entire post on my previous experience. What happens on coming Sunday, must not be very different. Again, i lied to the HR guy about never attending an interview there.
    All in all, its gonna be hectic as hell. I can only wish that they are not releasing any must-watch movie this weekend and i am really glad about catching 'Interstellar' last week. Also, pardon me for any silly mistake in the article. The bloke sitting in front is watching a scantily clad Gauhar Khan and it isn't exactly serving as a booster to my concentration. And, they say i am the only one does not do any work in the company. Anyway guys keep watching this space for more. Long live interview tourism.

    Monday, 4 August 2014

    HCL Interview Walk In

    Date : 26 July 2014
    Venue : HCL TECHNOLOGIES, SEC-125, MAPLE TOWER, NOIDA.
                 It's right behind Amity University. Hire an auto from Sec-37 or get one from Kalindi Kunj (if you are coming from Delhi). It's strange how both of them charge you the same amount.

    Pre-Interview:
        The event being a walk-in, was swarmed by job seekers from nook and corners of Delhi-NCR. A long line awaited entry in the much-desired HCL building. The guard provides an entry slip (make sure to keep it carefully). You will be asked to return it on exit. Also, an id for verification would be required (PAN, Passport, Voter ID or Driver Licence). Its pathetic how grown ass bastards (mostly girls), don't bring an i-card and start whining before the guard. Bhaiyaaaaa...plzzzzzzz......Also, they will keep your bags before they move you for interview. So, make sure that you do not bring anything valuable. Then i was moved for the interview. And this is where i got judgmental. The seating arrangement was made in the basement cafeteria which boasted of an abominable stink. With the HR, busy, having her larger than life phone call, petty issues like collecting resumes, sorting them and then calling the candidates for interview were left to the guards. They created two groups according to the experience level, candidates with 3+ years of experience and candidates with less than 3 years of experience. Finally the concerned HR guy showed up. Took a few resumes and called the guys to first floor. Here, i was asked to wait for some time. This hall however did appear to be the waiting room of India's premier IT firm. Much to my relief. There were sofas, paintings and a terrace garden. Really what were they thinking when they zeroed in on the basement. Also, a few HR's were also running around looking busy. I had expected a long wait before my name is called upon as the hall was jam packed. Instead i was called pretty early. 

    Round I:

    No conference room again. I was simply sent to some guys desk. 
    Q.1 Comparator vs Comparable?
    Q.2 What are Collections?
    Q.3 How many objects are there in a JSP?
    Ans. 9
    Overview: I totally failed to get this one. While i replied with session, application and config, i failed to put down the entire list. JSP also has a special object by the name of pageContext. The interviewer was pretty satisfied though. 
     This was followed by basic discussion of who i am and what i do (in corporate sense). All through the interview i observed a sulking demeanor in my esteemed interviewers attitude. Clearly, he did not like his job. Then he got personal and started asking why i want to switch and why i want to switch to a firm like HCL (no positive vibe was observed in his statement). Then came the grand confession. He was a former employee in my current firm. And though he moved to HCL he does acknowledges that HCL does not pay very well. To my horror he straightaway jumped to the discussion regarding package. I was expecting a package of 7, (my current package being 4.5). And for some strange reason i got real comfortable around him. Now i realize how funny it was, but right there i lifted my leg and crossed it over the other while sulking back in the chair. The guy did give me a disapproving nod but i just did not cared. Getting even more candid he came to the point. HCL does not gives 7 to a guy with less than 3 years of experience. At max i can get 6 but that's it and even that's highly unlikely. Then he took his feedback form. Wrote my skills over there and randomly scored me 2 and 2.5 in all of them. The marking was perhaps on a scale of 5.

    Round II:

    Finally some professionalism and a conference room.

      

    Tuesday, 6 August 2013

    Sirion Labs Interview

    Sirion Labs
    Interview:
    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()
      {
              Y();
      }
      public static void Y()
      {
            System.out.println("parent");
      }
    }

    public class B extends A
    {
            public void Y()
            {
                    System.out.println("Child");
            }
    }
    What will the following code snippet print?
    B.X() ?
    Ans.
    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;
       System.out.println("Try");
    }
    catch(Exception e)
    {
        System.out.println("Exception is ="+a);
    }
    What will be printed on running the above code snippet?
    Options:
    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.
    Options:
    A)     CBDAE, CDBAE
    B)     Insufficient data, CDBAE
    C)     Insufficient data, CABDE
    D)     Insufficient data, insufficient data
    Ans.
    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;
        System.out.println("c");
       
    What will be the output on running the above code snippet?
    Options:
    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?
    Ans.
    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++)
           {
                  result+=i+j;
           }
         }
         What will be the value of result?
    Ans.
    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)

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



           

    Sunday, 28 July 2013

    Amazon interview

    Q.1 Sort a link list of 0's, 1's and 2's. Or something similar.
    Q.2 Find the second smallest number to a given number in a tree.
    Q.3 

    Belzabar interview

    Q. Find median of two sorted arrays?

    Blackrock interview

    Q.1 How to use Comparator with collection?
    Q.2 What is a serializable object? How to use it? When is it used? Is it used over networks?
    Q.3 What are immutable objects?
    Q.4 What is the big deal with java 1.5?
    Q.5 If HashTable was always there, why come up with a HashMap?
    Q.6 SQL query to get the second largest element in a table?

    hCentive interview

    Lots of questions about enums and static imports.
    How to intialize Locale.

    Intelligrape interview

    Section 1
    Q.1 WAP to print the sum of characters in a String. Assuming that A=1, B=2, C=3.....So DAD will be 4+1+4=9.
    Q.2 Make a HashMap for the class Student.
    class Student
    {
    String name;
    Date dateOfBirth;
    Integer fees;
    }
    Q.3 Given a series :
    GGG
    RRR
    BBB
    Convert it into:
    GRB
    GRB
    GRB
    Q.4 Given an array of positive, negative and zero's. Arrange the array such that all negative numbers are on the left, zeroes in the centre and positive numbers in the right.

    Section - 2
    Q.1 Create a database(tables) for the given relationship. Do not draw ER diagrams.
    A group may have many challenges. A challenge can have many users. A user can have many challenges.