More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know.
Ans. Transaction isolation levels are a measure of the extent to which transaction isolation succeeds. In particular, transaction isolation levels are defined by the presence or absence of the following phenomena:
Dirty Reads, Nonrepeatable Reads, Phantoms.
The four transaction isolation levels (as defined by SQL-92) are defined in terms of these phenomena: Read uncommitted, Read committed, Repeatable read, Serializable
Help us improve. Please let us know the company, where you were asked this question :
Ans. Java provides a new additional feature in Array class which is used to sort array elements in parallel.New methods have been added to the java.util.Arrays package that use the JSR 166 Fork/Join parallelism common pool to provide sorting of arrays in parallel.
The methods are called parallelSort() and are overloaded for all the primitive data types and Comparable objects.
Help us improve. Please let us know the company, where you were asked this question :
Ans. null is a literal similar to true and false in Java. These are not keywords because these are the values of something. As null is the value of a reference variable, true is the value of a boolean variable.
Help us improve. Please let us know the company, where you were asked this question :
Ans. When we start two or more threads within a program, there may be a situation when multiple threads try to access the same resource and finally they can produce unforeseen result due to concurrency issues.
For example, if multiple threads try to write within a same file then they may corrupt the data because one of the threads can override data or while one thread is opening the same file at the same time another thread might be closing the same file.
So there is a need to synchronize the action of multiple threads and make sure that only one thread can access the resource at a given point in time. This is implemented using a concept called monitors. Each object in Java is associated with a monitor, which a thread can lock or unlock. Only one thread at a time may hold a lock on a monitor."
Help us improve. Please let us know the company, where you were asked this question :
Ans. Subject has state, it keeps a list of observers. On the other hand, an Observable is really just a function that sets up observation. While Subjects are Observables, Subjects also implement an Observer interface.
Help us improve. Please let us know the company, where you were asked this question :
Ans. We can use LinkedHashMap as it will give time complexity of O(1) for lookup and We can maintain the insertion order to identify the Last used elements for eviction.
Help us improve. Please let us know the company, where you were asked this question :
Q980. Write a method that takes a string as input and identifies if any permutation of the String is Palindrome ? For example - ttoobb has a permutation 'bottob' which is a palindrome.
Ans. pop method pulls the top element from the stack and then move the top to the next element whereas peek only get the top element but doesn't move the top.
Help us improve. Please let us know the company, where you were asked this question :
Q985. Write a program to sort a stack in ascending order You should not make any assumptions about how the stack is implemented The following are the only functions that should be used to write this program: push | pop | peek | isEmpty
Q986. How would you design a stack which, in addition to push and pop, also has a function min which returns the minimum element? Push, pop and min should all operate in O(1) time