Showing posts with label singleton. Show all posts
Showing posts with label singleton. Show all posts

Tuesday, 13 December 2016

TCS interview

Date: 13 December 2016
Telephonic

Questions:
General overview.
  1. Why do we use parent attribute when declaring beans?
    1. What could be the disadvantage of using parent?
  2. Have you ever used a prototype bean in Hybris?
  3. How to override an attribute?
    1. Is that even possible?
  4. General architecture of Hybris.
    1. Architecture according to J2EE.
  5. How to publish a web-service in Hybris?
    1. Which extensions are used to publish a webservice in Hybris?
  6. Which one is preferable: Collection or relation? Why?
  7. Which extensions are used for connecting with cybersource?
    1. Whole process of connecting with cybersource.
    2. Have you connected using CI?
  8. What functionalities does Hybris get from Spring?
  9. How to use SOP-HOP instead of SOAP?
  10. What is Hybris planning to do with Promotions in v6.0?
  11. Define OCC.
    1. Is OCC required for connecting to storefront?
  12. How does decorator work?
    1. On which layer does it exist?
    2. What if I modelService.save() something on a decorator?
    3. What is resolver?
  13. More about integration.

Friday, 6 November 2015

Q3 Technologies

Date: 6 November 2015
Venue: JMD Megapolis IT Park, Sector-48, Gurgaon
The building has a wonderful architecture!!!

After a terrible wait of 1 hour.

Hybris:

  1. Full WCMS story.
  2. Difference between CSFT and CSFP?
  3. In a box show the entire process of Solr functionality by drawing everything.
  4. Which pages use Solr?
  5. How does Solr get data from hybris DB? Surely, we don't send the entire data.
  6. Where is the entry that, which product type (Style variant, size variant, etc.) needs to be indexed? solr.impex was expected!!!
  7. Difference between ant, ant clean, ant all and ant clean all?
  8. Which of them compiles the code?
  9. What new files or what changes will happen if these are run after generate="true"?
  10. What do you mean by "build successful"?
  11. Entire presentation layer?
  12. When is facade needed? When it is not? Answer: Needed only for storefront.
  13. What happens at DAO layer?
  14. Full process of making a new form entry, starting from form at front-end to DB.
  15. Tell me something about spring security in Hybris.
  16. What is singleton?
  17. Why is it created?
  18. Difference between @Resource and @Autowired?
  19. What should be done at service layer? What not?
  20. What should be done at facade layer? What not?
  21. Why use converter/populator?
  22. What is the order of AtomicType,Collection,Map,Items,etc. in items.xml? Can we change the order?

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?



Wednesday, 11 September 2013

Initialization-on-demand holder idiom

Example Java Implementation

This implementation is a well-performing and concurrent implementation valid in all versions of Java. The original implementation from Bill Pugh (see links below), based on the earlier work of Steve Quirk, has been modified to reduce the scope of LazyHolder.INSTANCE to private and to make the field final.
public class Something {
        private Something() {}
 
        private static class LazyHolder {
                private static final Something INSTANCE = new Something();
        }
 
        public static Something getInstance() {
                return LazyHolder.INSTANCE;
        }
}

How it works

The implementation relies on the well-specified initialization phase of execution within the Java Virtual Machine (JVM); see section 12.4 of Java Language Specification (JLS) for details.
When the class Something is loaded by the JVM, the class goes through initialization. Since the class does not have any static variables to initialize, the initialization completes trivially. The static class definition LazyHolder within it is not initialized until the JVM determines thatLazyHolder must be executed. The static class LazyHolder is only executed when the static method getInstance is invoked on the class Something, and the first time this happens the JVM will load and initialize the LazyHolder class. The initialization of theLazyHolder class results in static variable INSTANCE being initialized by executing the (private) constructor for the outer class Something. Since the class initialization phase is guaranteed by the JLS to be serial, i.e., non-concurrent, no further synchronization is required in the staticgetInstance method during loading and initialization. And since the initialization phase writes the static variable INSTANCE in a serial operation, all subsequent concurrent invocations of the getInstance will return the same correctly initialized INSTANCE without incurring any additional synchronization overhead.