Interview Questions and Answers - Order By Newest Q661. Can we synchronize the run() method in Java? Core Java
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  synchronization  multithreading  run method Q662. 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 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  Data Stricture   Big O Notation  time complexity Q663. What are the uses of Abstraction ? Core Java
Ans. Loose Coupling
Facilitates designing complex applications by making them modular. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  oops concepts  abstraction Asked in 1 Companies Q664. Lets say we have a set "set1" with objects of Class A, Class has a non static string called element1, Write a code ( using lambda expression ) to see if there is any object in the set with element1 = "Hello". Core Java
Ans. set1.stream().filter(p->p.element1.equals("Hello")).findAny().isPreent();
or
set1.stream().map(A::getElement1).anyMatch("Hello"::equals) Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  lambda expressions  java 8  java8  java 8 filter  findAny() Q665. Which of the OOP's features facilitate dependency injection ? Design
Ans. Inheritance , Runtime Polymorphism and Composition. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  dependency injection  inversion of control  ioc  oops  oops features Q666. Is dependency injection possible if we don't have inheritance / Composition ? Design
Ans. Without composition - No, as it's the core of dependency injection.
With Inheritance - Yes, through interface implementation. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  dependency injection  inversion of control  ioc Q667. As root, if you have to assign the owner for the file and set only read permission for the owner, Write a unix command to do it. Unix
Ans. chmod 477 Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  unix commands  setting file permissions  chown  chmod Q668. Which of the two - iteration or recursion - is slower ? Core Java
Ans. Any function call is slower than the code in the same method as Java has to maintain stack of meta and function call information. So recursion is slower. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  iteration  recursion  iteration vs recursion Q669. Explain Hibernate Validation ? Hibernate
This question was recently asked at 'Sofi'.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  hibernate  hibernate validation Asked in 1 Companies Q670. Which validation frameworks have you worked on ? Frameworks
This question was recently asked at 'Sofi'.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  validation frameworks Asked in 1 Companies Q671. How different is the Search algorithm when we query Cassandra Tables and When we query Oracle Tables ? Cassandra
Ans. Relational Database uses linear search if we don't query using indices. Performance for linear search is O(n). If indices have been used , relational database uses binary search. Performance for binary search is O(Log n).
Casandra uses hash search. Performance for Hash Search is O(1). Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  cassandra vs oracle  nosql vs relational  search algorithm Q672. Difference between Normalization and Denormalization ? Database
Ans. Normalization is the process of splitting one Table into multiple so as to avoid Data duplication whereas Denormalization is the process of reducing Tables that creates data duplication but would remove joins in the queries. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  normalization  denormalization  normaization vs denormalization Asked in 1 Companies Q673. Which of the two Normalization / Denormalization facilitate better performance ? Which of the two facilitate better space management ? Database
Ans. DeNormalization facilitate better performance. Normalization remove data duplication and hence facilitate better database space management. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  normalization  denormalization  normalization vs denormalization Q674. Which of the following databases - Cassandra / Oracle - provides more flexibility about querying the database ? Database
Ans. Oracle as it is not modeled for a particular query or set of queries. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Cassandra  Nosql database  nosql vs relational database Q675. What could be the driving force to have dependencies injected through class than through config file while using IOC or Dependency Injection ? Design
Ans. Unit Testing Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  dependency injection  inversion of control Q676. Write a Program to print fibonacci series using recursion. Core Java
Ans. public class FibonacciUsingRecursion {
public static void main(String[] args) throws IOException{
getNextFibanocci(1,1);
}
static int getNextFibanocci(int a,int b){
if(a+b >= 100){
return 0;
} else {
System.out.println(a+b);
getNextFibanocci(b,a+b);
}
return 0;
}
} Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  fibonacci  recursion Q677. Can we use primitive types with Collection classes ? Core Java
Ans. No, As collection classes involve use of Generics, they cannot accept primitive types. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  collection classes  collections Q678. Which objects are eligible for garbage collection ? Core Java
Ans. Objects that have lost their reference i.e. they cannot be accessed/used by the program anymore. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  garbage collection Asked in 1 Companies basic Q679. Which Data structure can be used for creating Queue ? Data Structure
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  queue  collections  data structure 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  queue  blockingqueue  collections Q681. Which immutable classes have you worked with ? Can you name some immutable Collections ? How to make an immutable collection ? Core Java
Ans. string and wrapper class objects Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  immutability  immutable  immutability classes   immutable  immutability collections Asked in 3 Companies Q682. Which of the two - Arrays or LinkedList - is a better data structure for implementing Queue ? and Why ? Data Structure
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  Arraylist  linkedlist  queue  collections Q683. How is LinkedList collection class internally implemented ? Is it a Linked List or Doubly Linked List ? Core Java
This question was recently asked at 'Ancestry'.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  internal implementation of linkedlist Asked in 1 Companies Q684. Suppose we have a string "Java is object oriented language" and we have to reverse every alternate word in string. How would we do that using Java program. Core Java
This question was recently asked at 'datalake solutions'.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  string manipulation  code  coding Asked in 1 Companies Q685. Can you write the code for implementing the one to many (student -> courses) relationship in hibernate? Hibernate
Ans. @OneToMany(cascade = CascadeType.ALL)
@JoinColumn(name = "student_id")
private Set countries; Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q686. Can you explain software design principles cohesion and coupling with an example? Design
This question was recently asked at 'Fidelity Information Services (FIS)'.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  cohesion  coupling Asked in 1 Companies   frequent Q687. What is read and write optimization in relation to databases ? Which database facilitates read optimization and which facilitates write optimization ? Database
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  read optimization   write optimization Q688. Does relational database facilitate read or write optimization while storing information ? database
Ans. Usually Relational Databases are optimized for writing. Some exception being usage of indices where indices needs to be updated after insertion and eventually helps with Log(n) reading time. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  read optimization  rdbms  relational database Q689. How does relational database facilitates read optimization ? Database
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  database  rdbms  read optimization Q690. how does abstraction help your application ? Core Java
This question was recently asked at 'Intel'.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  abstraction  oops concepts Asked in 1 Companies basic