April 26, 2016

Java Design Pattern Interview Questions & Answers

What are Design Patterns?
Design patterns are tried and tested way to solve particular design issues by various programmers in the world. Design patterns are extension of code reuse.

April 25, 2016

Serialization Interview Questions and Answers for Experienced Developers

What is Serialization in Java?
Serialization is a process by which you can save or transfer the state of an object by converting it to a byte stream.

During Serialization, the Object is converted into a binary format ,which can be persisted into disk or sent over network to any other running Java virtual machine. During deserialization the reverse process is performed by creating object from binary stream.

April 24, 2016

JDBC Interview Questions And Answers

What is JDBC?
JDBC (Java Database Connectivity) is a Java API that is used to connect and execute query to the database. JDBC API uses jdbc drivers to connects to the database.

April 22, 2016

Madhuri shoots barefoot for the opening act of So You Think You Can Dance..

Everyone is aware of Madhuri’s love for dance. She believes that dance is an art and she has carved her niche in it. Madhuri Dixit who will be soon seen as the judge on &TV’s latest offering ‘So You Think You Can Dance - Ab India Ki Bari’ has done something phenomenal for the show. Read on to know more!

Tiger Shroff joins &TV’s 'So You Think You Can Dance'..

The new Baaghi in town, Tiger Shroff dropped by on the sets of &TV’s upcoming dance reality show SO YOU THINK YOU CAN DANCE. The actor showed off his cool dance moves and impressed everyone with his ‘Street’ style of dancing.

April 21, 2016

BARC Ratings (Impressions)- Week 15, 2016

In week 15 (9-15 April, 2016) of the BARC Ratings, Star Plus continued to be the most watched Hindi GEC. Colors remained at No.2 followed by Zee TV at No.3. Life OK took a leap to the fourth spot from seventh in week 14. Sony Pal remained at No.5.

April 15, 2016

Difference between Stack vs Heap in Java

1). Heap memory is used by java runtime to allocate memory to Objects and JRE classes. Whenever we create any object, it’s always created in the Heap space. Garbage Collection runs on the heap memory to free the memory used by objects that doesn’t have any reference. Any object created in the heap space has global access and can be referenced from anywhere of the application.

Java Stack memory is used for execution of a thread. They contain method specific values that are short-lived and references to other objects in the heap that are getting referred from the method. Stack memory is always referenced in LIFO (Last-In-First-Out) order. Whenever a method is invoked, a new block is created in the stack memory for the method to hold local primitive values and reference to other objects in the method. As soon as method ends, the block becomes unused and become available for next method.

A Fairy Tale Visit To Neuschwanstein Castle!!

Neuschwanstein Castle has been on my bucket list for ages because of its mesmerizing aura, breathtaking views and incredible artworks. That's why for me this visit was very, very thrilling. The kind of excitement where I let out little screams in complete anticipation.😻

April 13, 2016

All About jQuery..

What is jQuery?
Its a'lightweight' javascript library. With jQuery we, 'write less, and do more'.  jQuery also simplifies a lot of the complicated things from JavaScript, like AJAX calls and DOM manipulation. jQuery run exactly the same in all major browsers, including Internet Explorer 6.

The jQuery library contains the following features:
# HTML/DOM manipulation
# CSS manipulation
# HTML event methods
# Effects and animations
# Utilities

Download jquery-1.12.2.min.js from jQuery.com, add the .js in your page. e.g

< head>
< script src="jquery-1.12.2.min.js">< /script>
< /head>
NOTE: type="text/javascript" is not added inside the < script>

jQuery CDN : If you don't want to download and host jQuery yourself, you can include it from a CDN (Content Delivery Network). Both Google and Microsoft host jQuery.

Google CDN:
< head>
< script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js">< /script>
< /head>

Microsoft CDN:
< head>
< script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.12.2.min.js">< /script>
< /head>

jQuery Syntax
Basic syntax is: $(selector).action()
$ sign to define/access jQuery
(selector) to "query (or find)" HTML elements
jQuery action() to be performed on the element(s)

$(this).hide() : hides the current element.
$("p").hide() : hides all elements.
$(".test").hide() : hides all elements with class="test".
$("#test").hide() : hides the element with id="test".

Document Ready Event
All jQuery methods are written inside a document ready event to prevent any jQuery code from running before the document is finished loading (is ready). Else, the method might fail, e.g:
  •     Trying to hide an element that is not created yet
  •     Trying to get the size of an image that is not loaded yet
   // jQuery methods go here...

or use the shorter version

   // jQuery methods go here...

jQuery Selectors allow you to select and manipulate HTML element(s).

HTML elements are "find" (or select) based on their name, id, classes, types, attributes, values of attributes and much more. It's based on the existing CSS Selectors, and in addition, it has some own custom selectors.

All selectors in jQuery start with the dollar sign and parentheses: $().

The element Selector selects elements based on the element name.

You can select all elements on a page like this:

e.g: This will hide paragraphs when button is click

< html >
< head>
< script language="javascript" src="javascript/jquery-1.12.4.min.js">< /script>
< script>
< /script>
< /head>
< body>
< h2>Hide The Para..< /h2>
< p>First paragraph.< /p>
< p>Second paragraph.< /p>
< button>Click me to hide paragraphs< /button>
< /body>
< /html >

The #id Selector
uses the id attribute of an HTML tag to find the specific element.
An id should be unique within a page, so you should use the #id selector when you want to find a single, unique element.
To find an element with a specific id, write a hash character, followed by the id of the HTML element:

e.g. This will hide 'Second Para' with 'id=test' when button is click

< html>
< head>
< script language="javascript" src="javascript/jquery-1.12.4.min.js">< /script>
< script>
< /script>
< /head>
< body>
< h2>Hide The Para..< /h2>
< p>First paragraph.< /p>
< p id="test">Second paragraph.< /p>
< button>Click me to hide paragraphs< /button>
< /body>
< /html>

The .class Selector finds elements with a specific class.
To find elements with a specific class, write a period character, followed by the name of the class:

e.g:This will hide the para with 'class=testclass' when button is click
< html>
< head>
< script language="javascript" src="javascript/jquery-1.12.4.min.js">< /script>
< script>
< /script>
< /head>
< body>
< h2>Hide The Para..< /h2>
< p>First paragraph.< /p>
< p class="testclass">Second paragraph.< /p>
< button>Click me to hide paragraphs< /button>
< / body>
< /html>

A few examples of jQuery Selectors
  • $("*")     Selects all elements    
  • $(this)     Selects the current HTML element    
  • $("p.intro")     Selects all < p> elements with class="intro"    
  • $("p:first")     Selects the first < p> element    
  • $("ul li:first")     Selects the first < li> element of the first < ul>    
  • $("ul li:first-child")     Selects the first
  • element of every < ul>    
  • $("[href]")     Selects all elements with an href attribute    
  • $("a[target='_blank']")     Selects all < a> elements with a target attribute value equal to "_blank"    
  • $("a[target!='_blank']")     Selects all < a> elements with a target attribute value NOT equal to "_blank"    
  • $(":button")     Selects all < button> elements and < input> elements of type="button"    
  • $("tr:even")     Selects all even < tr> elements    
  • $("tr:odd")     Selects all odd < tr> elements 
JQuery Interview Questions
Whether jQuery HTML work for both HTML and XML documents?
jQuery HTML only works for HTML documents not for XML Documents.

Where jQuery code is getting executed?
jQuery code is getting executed on a client browser.

Which command will give a version of jQuery?
The command $.ui.version returns jQuery UI version.

What is the difference between size and length of jQuery?
Size and length both returns the number of element in an object. But length is faster than the size because length is a property and size is a method.

Can we add more than one ‘document.ready’ function in a page?
Yes, we can add more than one document.ready function in a page. But, body.onload can be added once in a page.

What is the difference between onload() and document.ready()?
In a page, we can have only one onload function but we can have more than one document.ready function. Document.ready function is called when DOM is loaded but onload function is called when DOM and images are loaded on the page.

What is the use of jQuery load method?
jQuery load method is a powerful AJAX method which is used to load the data from a server and assign the data into the element without loading the page.

Which sign is used as a shortcut for jQuery?

Dollar ($) sign is used as a shortcut for jQuery.

Whether our own specific characters are used in place of $ in jQuery?
Yes, We can use our own variable in place of $ by using the method called no Conflict () method.
var sample = $.noConflict()

Is jQuery is a client or server scripting?
jQuery is a client scripting.

Is jQuery is a replacement of JavaScript?


Why jQuery is better than JavaScript?
jQuery is a library used for developing Ajax application and it helps to write the code clean and concise. It also handles events, animation and Ajax support applications.

What are the advantages of jQuery?
  • Just a JavaScript enhancement
  • Coding is simple, clear, reusable
  • Removal of writing more complex conditions and loops
What is the use of jQuery each function?
It is used to loop through each and every element of the target jQuery object. It is also useful for multi element DOM, looping arrays and object properties.

Which is the fastest selector in jQuery?
ID and Element are the fastest selectors in jQuery.

What is the slowest selector in jQuery?
Class selectors are the slowest selectors in jQuery.

-K Himaanshu Shuklaa..

April 07, 2016

Java Reflection API Interview Questions and Answers..

What is Reflection?
Java Reflection makes it possible to inspect classes, interfaces, fields and methods at runtime, without knowing the names of the classes, methods etc. at compile time. It is also possible to instantiate new objects, invoke methods and get/set field values using reflection. That means with reflection, we can examine or modify the runtime behavior of applications running in the Java virtual machine.

Reflection API usage can break the design pattern such as Singleton pattern by invoking the private constructor i.e violating the rules of access modifiers.

April 06, 2016

Core Java Interview Questions and Answers

What is Association, Aggregation and Composition?
Association is a relationship between two separate classes which can be of any type say one to one, one to may etc. It joins two entirely separate entities.

Aggregation is a special form of association which is a unidirectional one way relationship between classes (or entities), for e.g. Wallet and Money classes. Wallet has Money but money doesn’t need to have Wallet necessarily so its a one directional relationship. In this relationship both the entries can survive if other one ends. In our example if Wallet class is not present, it does not mean that the Money class cannot exist.

Composition is a restricted form of Aggregation in which two entities (or you can say classes) are highly dependent on each other. For e.g. Human and Heart. A human needs heart to live and a heart needs a Human body to survive. In other words when the classes (entities) are dependent on each other and their life span are same (if one dies then another one too) then its a composition. Heart class has no sense if Human class is not present.

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

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.

Why we need Collections when we have Array?
  • Arrays are immutable, once defined you cannot increase the size of an Array.
  • Array are not really thread-safe.
What is the difference between Collection and Collections?
Both are part of java collection framework, but both serve different purpose. Collection is a top level interface of java collection framework where as Collections is an utility class.

Collection interface is a member of java.util package and List, Set and Queue are main sub interfaces of this interface. JDK doesn’t provide any direct implementations of this interface. But, JDK provides direct implementations of it’s sub interfaces. ArrayList, Vector, HashSet, LinkedHashSet, PriorityQueue are some indirect implementations of Collection interface. Map interface, which is also a part of java collection framework, doesn’t inherit from Collection interface.

Collections is an utility class in java.util package. It consists of only static methods which are used to operate on objects of type Collection. e.g
  • Collections.max() : - This method returns maximum element in the specified collection.
  • Collections.min() : - This method returns minimum element in the given collection.
  • Collections.sort() : - This method sorts the specified collection.
  • Collections.shuffle() : - This method randomly shuffles the elements in the specified collection.
  • Collections.synchronizedCollection() : - This method returns synchronized collection backed by the specified collection.
  • Collections.binarySearch() : - This method searches the specified collection for the specified object using binary search algorithm.
  • Collections.disjoint() : - This method returns true if two specified collections have no elements in common.
  • Collections.copy() : - This method copies all elements from one collection to another collection.
  • Collections.reverse() : - This method reverses the order of elements in the specified collection.

Difference between CountDownLatch & CyclicBarrier in Java

The main difference between CountDownLatch & CyclicBarrier is that you can not re-use CountDownLatch once count reaches to zero, but you can reuse same CyclicBarrier even after barrier is broken. Let's first understand what exactly CountDownLatch & CyclicBarrier does..
RSSChomp Blog Directory