April 02, 2016

All About Agile!!

What is Agile?
In traditional software development methodologies like Waterfall model, a project can take several months or years to complete and the customer may not get to see the end product until the completion of the project.

A non-Agile projects allocate extensive periods of time for Requirements gathering, design, development, testing and UAT, before finally deploying the project.

In contrast to this, Agile projects have Sprints or iterations which are shorter in duration (Sprints/iterations can vary from 2 weeks to 2 months) during which pre-determined features are developed and delivered. 

We can say that, Agile is a time boxed, iterative approach to software delivery that builds software incrementally from the start of the project (incremental delivery), instead of trying to deliver it all at once near the end.

What is User Story?
User stories are short, simple descriptions of a feature told from the perspective of the person who desires the new capability, usually a user or customer of the system.

April 01, 2016

#Collections: Part 1- Java Collections Interview Questions and Answers


JDK 1.2 introduces a new framework for collections of objects, called the Java Collections Framework.

What are Collections?

A collection (sometimes called a container) is simply an object that groups multiple elements into a single unit. Collections are used to store, retrieve, manipulate, and communicate aggregate data.

Part 7: Java Thread Interview Questions & Answers (Thread Pool, Executor)



What is ThreadLocal variable in Java?

ThreadLocal is a special class for which each thread accessing the variable would have a separate instance of it. This was introduced on JDK 1.2 but it was later generified in JDK 1.4 to introduce type safety on ThreadLocal variable.

The ThreadLocal variable becomes eligible for Garbage collection after the thread finished or died, normally or due to any Exception (given those ThreadLocal variable doesn't have any other live references).

ThreadLocal is a generic class and can be applied to any type.

ThreadLocal variables in Java are generally private static fields in Classes and maintain its state inside Thread. e.g :

private static final ThreadLocal < SimpleDateFormat > dateformatter = new ThreadLocal < SimpleDateFormat > ();

Part 6: Java Thread Interview Questions & Answers (CountDownLatch vs CyclicBarrier)


Let's first understand what exactly CountDownLatch and CyclicBarrier do.

Part 5: Java Thread Interview Questions & Answers (UncaughtExceptionHandler, Synchronization, Context-Switching)


What happens when an exception occurs in a thread?
If an exception is not caught thread will die, else if an uncaught exception handler is registered then it will get a callback.

What is the use of Thread.UncaughtExceptionHandler interface?
Thread.UncaughtExceptionHandler is an interface, defined as a nested interface for handlers invoked when a Thread abruptly terminates due to an uncaught exception.

Checked exceptions must be specified in the throws clause of a method or caught inside them. Whereas, Unchecked exceptions don’t have to be specified or caught.

Part 4: Java Thread Interview Questions & Answers (Race condition, Deprecated Methods, isInterrupted and interrupted)


What is a race condition in Java?
  • A race condition occurs when the critical section is concurrently executed by two or more threads. This can lead to incorrect behaviour of a program. 
  • We can say it is a condition in which two or more threads compete together to get certain shared resources.
  • A race condition is when multiple threads read and write the same variable i.e. they have access to some shared data and they try to change it at the same time. This results in a non-deterministic bug, which is one of the hardest bugs to find and re-produce because of the random nature of racing between threads.
There are the following two solutions to avoid race conditions.
a). Mutual exclusion: If a thread is using a shared variable or thread, another thread will exclude itself from doing the same thing.
b). Synchronize the process: A thread can prevent this from happening by locking an object. When an object is locked by one thread and another thread tries to call a synchronized method on the same object, the second thread will block until the object is unlocked.

Part 3: Java Thread Interview Questions & Answers (Thread lifecycle)

What are the different states of a thread's lifecycle?
  • Runnable: waiting for its turn to be picked for execution by the thread scheduler based on thread priorities.
  • Running: The processor is actively executing the thread code. It runs until it becomes blocked, or voluntarily gives up its turn with this static method Thread.yield(). Because of context switching overhead, yield() should not be used very frequently.
  • Waiting: A thread is in a blocked state while it waits for some external processing such as file I/O to finish.
  • Sleeping: Java threads are forcibly put to sleep (suspended) with this overloaded method: Thread.sleep(milliseconds), Thread.sleep(milliseconds, nanoseconds);
  • Blocked on I/O: Will move to runnable after I/O conditions like reading bytes of data etc changes.
  • Blocked on synchronization: Will move to Runnable when a lock is acquired.
  • Dead: The thread is finished working.

Part 2: Java Thread Interview Questions & Answers (volatile and AtomicInteger)

What is a volatile variable in Java?
volatile variable in Java is a special variable that is used to signal threads, a compiler that the value of this particular variable is going to be updated by multiple threads inside the Java application.

When we make a variable volatile, we ensure that its value should always be read from the main memory and the thread should not use the cached value of that variable from its own stack.

The volatile keyword can only be applied to a variable, it can not be applied to a class or method. Using volatile keywords along with class and method will result in a compile-time error.

Part 1: Java Thread Interview Questions & Answers

What is Multithreading and why does it Exist?

Let's take an example to understand this. Assume we need to compute a simple multi-step mathematical computation problem. ((2 + 5) * (6 + 4)). The computer is going to compute this in 3 steps:
1). Find (2 + 5)
2). Find (6 + 4)
3). Lastly, multiply the results of steps 1 and 2.

Now let's assume each step takes exactly 1 unit of time, the above would be completed in 3 units of time. But what if two threads could be run simultaneously to solve the above problem?

When we used 2 threads, steps 1 and 2 will be performed simultaneously and then subsequently multiplied by each other once the result is found. the same computation that previously took 3 units of time would be completed in only 2 units of time — a saving of 33%.


Multithreading enables us to run multiple threads concurrently. For example, after you log in to your Instagram account, one thread will load the stories of the accounts you are following, whereas another thread updates your Instagram feed with the latest posts. 

We can say multithreading improves the responsiveness of a system. Imagine what would happen if Instagram ran in a thread? It might take 10 seconds to fetch the stories, and after that, it might take another 10 seconds to fetch the posts. This might make Instagram completely unresponsive because it won't allow users to perform another operation till all the stories and posts are loading.

What is Thread in Java?

Thread in Java is a lightweight process and represents an independent path of execution. It's a way to take advantage of multiple CPUs available on a machine. By employing multiple threads we can speed up CPU-bound tasks.

Let's assume that one thread takes 100 milliseconds to do a job, we can use 10 threads to reduce that task to 10 milliseconds. Java provides excellent support for multithreading at the language level, and it's also one of the strong selling points.

March 31, 2016

BARC Ratings (Impressions)- Week 12, 2016

  
Top 10 Hindi GEC Channels
  • STAR Plus : 710064
  • Colors : 657379
  • Zee TV : 613620
  • Zee Anmol : 568682
  • Sony Pal : 533954
  • STAR Utsav : 519207
  • DD National : 517653
  • Life Ok : 468788
  • Rishtey : 433109
  • SONY SAB : 387634

March 29, 2016

Madhuri Dixit to judge the Indian version of ‘So You Think You Can Dance’

Lights. Camera. Dance! The stage is set for the biggest dancing battle the nation has ever seen. After captivating the audience across the globe, the world’s BIGGEST dance platform, So You Think You Can Dance is all set to take India by storm. &TV will host the India chapter of the biggest dance competition that will be an ultimate battle to prove supremacy over the dance floor. And who better to judge the show then India’s biggest dancing diva Madhuri Dixit herself.

March 28, 2016

BARC Ratings (Impressions)- Week 11, 2016

  
In week 11 (12- 18 March, 2016) of BARC data, Star Plus retained its top spot whereas, Colors remained at No.2. Zee TV too, like the previous two weeks acquired the third spot. The fourth spot was acquired by Sony Pal replacing Zee Anmol which now stands at No.5.

March 17, 2016

BARC Ratings (Impressions)- Week 10, 2016

  
In week 10 (5- 11 March, 2016) of BARC data, Star Plus retained its top spot whereas, Colors remained at No.2. Zee TV too, like the previous week acquired the third spot. The fourth spot was acquired by Zee Anmol and at No.5 stood Sony Pal replacing DD National.

March 16, 2016

Season break for Zindagi's Bhaage Re Mann..

The show that stole our hearts with its simple yet emotional story, Bhaage Re Mann, Zindagi’s first original series is set to have the season finale of this season on Saturday, 19th March 2016. Bhaage Re Mann that premiered on 30th November 2015 has created a lasting impression in the hearts and minds of viewers across the country. A unique slice of life show that advocates following your heart, the show revolves around the life of Padmini (Karuna Pandey) an independent woman who through her innovative and quirky take on life, deals with her challenges head on.

Benaifer Kohli slams Shilpa Shinde for baseless allegations..

Lately, Shilpa Shinde who portrayed the character of Angoori Devi in &TV's show - Bhabi Ji Ghar Par Hai (which airs from Monday to Friday at 10:30pm) has refused to come on the set leaving the makers in a lurch. Furthermore, she has been making false allegations and floating baseless stories in the media defaming the channel as well as the Production House (Edit II). However now the production house has broken the silence and has issued a legal notice to the actress and also filed a complaint against her in CINTAA.

March 10, 2016

I am really excited to be a part of Bhaage Re Mann: Aamir Dalvi

The versatile and dashing Aamir Dalvi will soon make an entry in Zindagi’s ‘Bhaage Re Mann’ that airs 8:30 pm from Monday to Saturday. One of the more prominent faces of the Indian television today, Aamir Dalvi will be seen in the show as Padmini’s old friend Rudra from her travelling days. Aamir will enter the show, amidst all the tension brewing in the Awasthi family at the request of his old friend, Padmini. She reaches out to Rudra to help her solve issues that she is unable to handle alone.