Interview Question and Answers | Search Coding Interview Questions - javasearch.buggybread.com
Javasearch.buggybread.com

Search Interview Questions


 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.
Label / Company      Label / Company / Text

   



Interview Questions and Answers - Order By Newest

   next 30
 Q2371. Write code to see if a Linked List has cycle in it ?

or

Write code using Floyd Algorithm to see if a linked list has cycle in it ? What is it's comlexity ?
Algorithm
Ans. public class LinkedList {

Node start = null;
Node head = null;

class Node {
Integer body;
Node nextNode;

Node(Integer value) {
body = value;
}
}

public static void main(String[] args) {
LinkedList ll = new LinkedList();

ll.addNodeToEnd(5);
ll.addNodeToEnd(10);
ll.addNodeToEnd(15);

ll.traverse();

if(checkIfLoop(l1)){
System.out.println("There is a Loop");
} else {
System.out.println("No Loop");
}
}

private boolean checkifLoop(Test l1) {
Node slow = start;
Node fast = start;
Node faster = start;
      
while(slow != null ) {
fast = slow.nextNode;
faster = fast.nextNode;
if(slow == fast || slow == faster) {
return true;
}
slow = slow.nextNode;
}
      
return false;
}

}

Complexity of this algorithm is O(n)

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     LinkedList  Cyclic LinkedList


 Q2372. What is the access time for ArrayList and LinkedList ?Data Structure
Ans. O(1) for ArrayList
O(n) for LinkedList

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 2 Companies


 Q2373. What is the runtime complexity of appending strings to string object and Why ?Algorithm
Ans. O(n^2) because each time a string is appended a new String is created and it runs through all the letters to copy them over.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     


 Q2374. Write code to reverse a C-Style StringDesign
 This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     


 Q2375. Design an algorithm and write code to remove the duplicate characters in a string without using any additional buffer.Algorithm
 This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     


 Q2376. Write a method that returns maximum depth of a tree ?Algorithm
 This question was recently asked at 'One Click Retail'.This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     tree  data structure  maximum depth of tree     Asked in 1 Companies


 Q2377. Given a sorted array, write an algorithm to create a binary tree.Algorithm
 This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     


 Q2378. Difference between Left and Inner Join ?SQL
 This question was recently asked at 'Canopy Tax,Cogent Infotech Corp'.This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     sql     Asked in 2 Companies


 Q2379. 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. Design
 This question was recently asked at 'Canopy Tax'.This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies      expert


 Q2380. Given a list of People, We need to distribute their gifts in such a way that

Any Person shouldn't get it's gift back
If A's gift goes to B, B's gift shouldn't go to A

Write a method that returns a Map where Key is the Person's name and value is the name of person whose gift was exchanged.
Design
 This question was recently asked at 'Canopy Tax'.This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q2381. What are the challenges you faced in any of your project ?General
 This question was recently asked at 'Bloomberg'.This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q2382. How can you identify Performance issues before going to production ?General
 This question was recently asked at 'Bloomberg'.This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q2383. What is the difference between time and space complexity ?Algorithm
 This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     


 Q2384. Which data structure would you use to implement LRU cache and Why ? Can you tell me the time complexity for it ?Algorithm
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 :   

   Like         Discuss         Correct / Improve     LRU Cache     Asked in 1 Companies


 Q2385. What is the difference between Observer and Subscriber ?Design
 This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     Design Patterns


 Q2386. What are Ractive Streams ?ReactiveX
 This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     


 Q2387. What is the difference between subscribe and blockingSubscribe method ?RxJava
Ans. blockingSubscribe will block the current thread and wait till the chain completes

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     


 Q2388. Difference between concatMap and flatMap ?RxJava
Ans. Flatmap converts stream(s) into a single streams without maintaining a order where as concatmap does the same along with maintaining the order

flatmap example -[[1,2,3],[4,5,6],[7,8,9]] -> [1,4,7,2,5,8,3,6,9]

concatmap example -[[1,2,3],[4,5,6],[7,8,9]] -> [1,2,3,4,5,6,7,8,9]

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     


 Q2389. Have you heard of reactive extensions ?ReactiveX
 This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     


 Q2390. What is a lapsed listener problem ?Design
 This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     


 Q2391. How observer pattern can introduce memory leaks ?Design
 This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     


 Q2392. What are the drawbacks of Reactive extensions ?ReactiveX
Ans. Reactive extensions have a steep learning curve which makes it confusing for beginner and intermediate developers.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     RxJava  ReactiveX  Reactive Programming


 Q2393. What can we do if we need to retrieve Fibonacci value at a particular index faster ? Can we use Linked List ?Data Structure
 This question was recently asked at 'Canopy Tax'.This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     LinkedList     Asked in 1 Companies


 Q2394. Sort a List of Objects using comparable and comparatorCore Java
 This question was recently asked at 'HCL Technologies'.This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q2395. What is synchronization in multithreading ?
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 :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q2396. can we use null as keyword ? Core Java
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 :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q2397. what is parallel array sorting?Algorithm
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 :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q2398. what is transaction isolation level?
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 :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q2399. What is Angular JS ?Angular JS
Ans. It is javascript framework which is written in javascript.It is best for single page application.It extends the html with new attributes which makes it more useful for ui dveloper.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q2400. What is two way binding ?Angular JS
Ans. Two-way binding means that any data-related changes affecting the model are immediately propagated to the matching view(s), and that any changes made in the view(s) (say, by the user) are immediately reflected in the underlying model. When app data changes, so does the UI, and conversely.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


previous 30   next 30

Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: