Interview Questions and Answers for 'Deloitte' | Search Interview Question - 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 for 'Deloitte' - 47 question(s) found - Order By Rating

next 30
 Q1. What is the main difference between unique key and primary key ?Database
Ans. Primary key will not accept NULL values whereas Unique key can accept one NULL value.

A table can have only primary key whereas there can be multiple unique key on a table.

A Clustered index automatically created when a primary key is defined whereas Unique key generates the non-clustered index.

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

   Like         Discuss         Correct / Improve     Unique Key  Primary Key     Asked in 1 Companies


 Q2. Have you ever heard about csrf attacks ?Security
Ans. Yes, Cross-Site Request Forgery (CSRF) is an attack that forces an end user to execute unwanted actions on a web application in which they're currently authenticated.

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

   Like         Discuss         Correct / Improve     csrf attack  Cross-Site Request Forgery (CSRF)     Asked in 16 Companies


 Q3. Sort an Employee Object based on Name or AgeDatabase
Ans. Use Comparable or Comparator interface

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

   Like         Discuss         Correct / Improve     sql query     Asked in 1 Companies


  Q4. What are the types of authentication used in Web services ?Web Service
Ans. Encrypted User Name / Password
Encrypted Password within Cookie
Encrypted Tokens
IP
Client Certificates
Oauth

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

   Like         Discuss         Correct / Improve     authentication  security  web service     Asked in 12 Companies      basic        frequent


 Q5. Difference between Component-Scan and @Component annotation ? Spring
Ans. @component mark a java class as a bean so that component scan mechanism of spring pick it up and register in IOC container.

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

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q6. Given an Employee Table with Salary Column, Find 2nd and 5th highest salary in a particular department.SQL
Ans. Select salary from (select salary from employee where department = order by salary desc limit 5) emp order by salary limit 1 AND Select salary from (select salary from employee where department = order by salary desc limit 2) emp2 order by salary limit 1

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

   Like         Discuss         Correct / Improve     sql  database   find 2nd highest salary sql database     Asked in 1 Companies


 Q7. How to sort objects based on one of the field ?Core Java
Ans. Using comparable and comparator and sorted collections like TreeSet or TreeMap.

or

use stream api from java 8 onwards which internally refers to comparable and comparator through lambda expressions

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

   Like         Discuss         Correct / Improve     sort  sorting  comprator  comparable  treeset  treemap  sorting collections     Asked in 1 Companies      Basic        frequent


 Q8. What are different types of IOC containers ?Design
Ans. J2ee Web Containers and Core Containers

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

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q9. If SOAP is more secure than Rest, Why many applications today use Rest ?Web Service
Ans. SOAP supports only xml whereas Rest support many other formats.

Rest services are very light weight compared to SOAP.

SOAP services are code heavy as they require creation. of stubs and skeltons.

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

   Like         Discuss         Correct / Improve     soap  rest  soap vs rest     Asked in 2 Companies


 Q10. If your application has multiple databases, how many changes you have to made in Hibernate? Hibernate
Ans. If you have mulitple Databases you just need to add multiple configuration files and create the corresponding SessionFactory object.

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

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q11. Write code to print a Pyramid pattern ?Core Java
Ans. public static void printTriagle(int n)
{
// outer loop to handle number of rows
// n in this case
for (int i=0; i1; j--)
{
// printing spaces
System.out.print(" ");
}

// inner loop to handle number of columns
// values changing acc. to outer loop
for (int j=0; j<=i; j )
{
// printing stars
System.out.print("* ");
}

// ending line after each row
System.out.println();
}
}

// Driver Function
public static void main(String args[])
{
int n = 5;
printTriagle(n);
}

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

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q12. Describe structure of a Web application.architecture
Ans. WEB APP |WEB-INF - META-INF | | | META-INF.MF | lib - WEB.xml - Classes

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

   Like         Discuss         Correct / Improve     web application     Asked in 3 Companies      intermediate        frequent


 Q13. Can we have multiple inheritance in java using abstract class ?Core Java
Ans. No

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

   Like         Discuss         Correct / Improve     abstract class   multiple inheritance  object oriented programming (oops)  oops concepts     Asked in 2 Companies


 Q14. What is the difference between abstraction and abstract class ?Core Java
Ans. Abstract class is one of the facility for achieving abstraction in Java.

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

   Like         Discuss         Correct / Improve          Asked in 1 Companies


  Q15. Difference between == and === ?JavaScript
Ans. == compares values === is used in scripting languages for comparing two values as well as there data tpe. like in js,php.

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

   Like         Discuss         Correct / Improve     ==  ===  == vs ===     Asked in 13 Companies      basic        frequent


  Q16. Write code to sort an array.Algorithm
Ans. https://www.geeksforgeeks.org/arrays-sort-in-java-with-examples/

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

   Like         Discuss         Correct / Improve     array  sorting     Asked in 16 Companies      basic        frequent


 Q17. Create a stack of specific size using arrayList?Data Structure
Ans. public class StackUsingArrayList {
   public static void main(String[] args) {
      List list = new ArrayList();
      list.add("A");
      list.add("B");
      list.add("C");
      
      Stack stack = new Stack();

      list.forEach(a -> stack.add(a));
      System.out.println(stack);
   
   }
}

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

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q18. Is HttpServlet an abstract class ?Java EE
Ans. Yes

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

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q19. what is fail fast and Fail Safe in collections?Core Java
Ans. Iterators in java are used to iterate over the Collection objects.

Fail-Fast iterators immediately throw ConcurrentModificationException if there is any addition, removal or updation of any element.

Fail-Safe iterators don't throw any exception if a collection is structurally modified while iterating over it. This is because, they operate on the clone of the collection and not on the original collection.

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

   Like         Discuss         Correct / Improve     ail fast   fail saf     Asked in 9 Companies      intermediate


Frequently asked Spring interview question.
 Q20. What are the components of Spring framework ?Spring
Ans. Core: [Core, Bean, Context, Expression Language]

Web: [Web, Portlet, Servlet, etc]

Data Access [JMS, JDBC, etc]

AOP, Aspect

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

   Like         Discuss         Correct / Improve     spring  spring framework components     Asked in 12 Companies


Usually asked to entry level software developers.
  Q21. Write a program to swap two variables without using thirdCore Java
Ans. public static void main(String[] args) {
   int num1 = 1;   
   int num2 = 2;
   num1 = num1^num2;
   num2 = num1^num2;
   num1 = num1^num2;
   System.out.print("num1 = " + num1 +", num2 = "+num2);
}

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

   Like         Discuss         Correct / Improve     code  coding     Asked in 37 Companies      basic        frequent


 Q22. What is a binary tree ?Algorithm
Ans. Binary tree is a tree in which each node has up to two children.Tree is a data structure composed of nodes.Each tree has a root node(not necessary in graph theory). The root node has zero or more child nodes.Each child node has zero or more child nodes, and so on.The tree cannot contain cycles.

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

   Like         Discuss         Correct / Improve     binary tree     Asked in 1 Companies


 Q23. Write an algorithm / Java Program to show duplicates in an array of n elements?Algorithm
Ans. int duplicateArray[] = { 1, 2, 2, 3, 4, 5, 6, 8, 9}
Set unique = new HashSet();
for (int i = 0; i < duplicateArray.length; i) {
if (unique.contains(duplicateArray[i])) {
System.out.println(duplicateArray[i]);
} else {
unique.add(duplicateArray[i]);
}
}

Complexity O(n) = nHashSet contains and add has O(n) = 1

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

   Like         Discuss         Correct / Improve     coding  code     Asked in 2 Companies


 Q24. Write an algorithm / java program for Heap Sort ?Algorithm
Ans. https://www.geeksforgeeks.org/heap-sort/

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

   Like         Discuss         Correct / Improve     sorting  heap sort     Asked in 1 Companies        frequent


  Q25. What is an exception and exception handling in Java ?Core Java
Ans. An Exception in java is the occurrence during computation that is anomalous and is not expected.

Exception handling is the mechanism which is used to handle such situations.


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

   Like         Discuss         Correct / Improve     exception handling     Asked in 18 Companies      basic        frequent


Frequently asked in high end product companies. Frequently asked in Deloitte.
  Q26. How is Hashmap internally implemented in Java ?Core Java
Ans. https://medium.com/javarevisited/internal-working-of-hashmap-in-java-97aeac3c7beb#:~:text=HashMap%20internally%20uses%20HashTable%20implementation,the%20entries%20into%20the%20map.

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

   Like         Discuss         Correct / Improve     hashmap  collections  hashmap internal implementation     Asked in 20 Companies      expert        frequent


Basic and Very Frequently asked.
  Q27. What is Polymorphism in Java ?Core Java
Ans. Polymorphism means the condition of occurring in several different forms.

Polymorphism in Java is achieved in two manners

1. Static polymorphism is the polymorphic resolution identified at compile time and is achieved through function overloading whereas

2. Dynamic polymorphism is the polymorphic resolution identified at runtime and is achieved through method overriding.

  Sample Code for overloading

  Sample Code for overriding

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

   Like         Discuss         Correct / Improve     polymorphism  object oriented programming (oops)  oops concepts  oops concepts     Asked in 108 Companies      Basic        frequent

Try 2 Question(s) Test


Very frequently asked.
 Q28. What is the use of synchronized keyword ?Core Java
Ans. Synchronize is used to achieve mutual exclusion i.e at one time, the segment of the code, method that has been declared synchronized should be executed by single thread only and hence the lock needs to be retrieved before executing the segment and then released.

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

   Like         Discuss         Correct / Improve     threads  multithreading  synchronized     Asked in 5 Companies      basic        frequent


 Q29. What are the disadvantages of multithreading ?Core Java
Ans. 1. Switching Overheads - Even though multi threading aims at improving performance by reducing the wait time and hence improving overall throughput, there is a cost of switching resources between threads and sometime this cost can surpass the benefits if there isnt much wait for IO or external communication.

2. Debugging is hard with multi threaded code.

3. Deadlock - Execution of multi threaded code many a times lead to deadlock due to shared resources.

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

   Like         Discuss         Correct / Improve     multithreading  threads     Asked in 4 Companies


Frequently asked at HCL Technologies ( Based on 3 feedback )
  Q30. Difference between Checked and Unchecked exceptions ?Core Java
Ans. Checked exceptions are the exceptions for which compiler throws an errors if they are not checked whereas unchecked exceptions are caught during run time only and hence can't be checked.

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

   Like         Discuss         Correct / Improve     java   exceptions   checked exceptions   unchecked exceptions   exception handling   checked vs unchecked exceptions     Asked in 39 Companies      basic        frequent

Try 1 Question(s) Test


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: