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. |
|
| ||||
Interview Questions and Answers - Order By Rating | ||||
| ||||
Ans. Amazon Simple Storage Service or S3 is object storage with a simple web service interface to store and retrieve any amount of data from anywhere on the web. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  aws  amazon s3  aws s3  aws storage  amazon cloud storage  amazon s3 Asked in 12 Companies | ||||
Frequently asked Spring interview question. | ||||
| ||||
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 | ||||
| ||||
Ans. public class BuggyBread { public static void main(String args[]) { String str = "we are what we repeatedly Do excellence, then, is not an act but a haBit"; Set<String> words = new HashSet(); for(String word:str.split(" ")){ if(words.contains(word)){ System.out.println(word); } else { words.add(word); } } } } | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve   Asked in 1 Companies | ||||
| ||||
Ans. boolean byte char double float int long short void | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  data types  primitive data types Asked in 1 Companies Basic | ||||
| ||||
Ans. String class has a public method intern() that returns a canonical representation for the string object. String class privately maintains a pool of strings, where String literals are automatically interned. these are automatically interned so as to have efficient String comparison using == operator instead of equals which is usually slower. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  string  string pool  string intern Asked in 1 Companies | ||||
| ||||
Ans. Authentication is the process of verifying the identity and credentials of the user to authenticate him into the system. whereas Authorization is the process by which access to a segment , method or resource is determined. Authorization is usually a step next to authentication. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  authentication  authorization  authentication vs authorization Asked in 9 Companies basic   frequent | ||||
| ||||
Ans. Yes its useless if we are not going to use its objects within Hash collection, For example - HashSet , HashMap. HashCode is used internally by these collections for Search. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  hashcode  hash collections  search | ||||
| ||||
Ans. After a thread is started using a call to start method, JVM invokes the thread’s run method when the thread is initially executed. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  threads  thread run method Asked in 1 Companies | ||||
| ||||
Ans. No exit is a method to exit execution of a program. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  exit  keywords  exit a program Asked in 1 Companies | ||||
| ||||
Ans. No, delete is not a keyword in Java. Destruction of objects is taken care by Java Garbage Collection mechanism. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  delete  keywords Asked in 1 Companies | ||||
| ||||
Ans. It uses those low order bytes of the result that can fit into the size of the type allowed by the operation. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  integer  data types Asked in 1 Companies   rare | ||||
| ||||
Ans. 1. Wrap the desired code in try block followed by a catch / finally to catch the exception 2. Declare the throws clause with exceptions that the code is expected to throw as an indication to the calling method to take care of it. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  exception handling Asked in 4 Companies | ||||
Try 1 Question(s) Test | ||||
| ||||
Ans. No, Java doesn't have a sizeOf operator. In C / C++ , its required to determine how much memory allocation is required which is not the case with Java. Java handles memory allocation and deallocation intrinsically. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  sizeOf  size of object  sizeOf operator Asked in 1 Companies   rare | ||||
| ||||
Ans. It's weird that compiler doesn't complain if we declare transient with static variable because it makes no sense. At least a warning message saying "transient is useless in this situation" would have helped with code cleaning. Static variables are never serialized and transient is an indication that the specified variable shouldn't be serialized so its kind of double enforcement not to serialize. It could be that as it makes no different to the variable behavior and hence using both keywords with a variable are permitted. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  static  transient  serialization Asked in 1 Companies expert   rare | ||||
Try 1 Question(s) Test | ||||
| ||||
Ans. 1. Objects are serialized and not classes and hence Static variables are ignored. 2. Transient is an explicit declaration to ignore the variable during serialization and hence transient instance variables are ignored too. 3. Base class instance variables if the base class hasn't been declared serializable. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  serialization Asked in 1 Companies intermediate   frequent | ||||
Try 1 Question(s) Test | ||||
| ||||
Ans. Null | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  object reference  null Asked in 1 Companies basic | ||||
| ||||
Ans. No, we should be lean in loading only packages which are required. Loading packages which are not being used result in memory overheads. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  import  import packages Asked in 1 Companies | ||||
| ||||
Ans. No, but we can use wild card (*) to do so For example - import java.util.* will import all packages with name starting with java.util | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  package   import packages Asked in 1 Companies basic | ||||
| ||||
Ans. We can overload the main method by specifying different argument types. For example - 2 main methods with different arguments is perfectly legal public static void main(); public static void main(String[] args); The following are not legal as compiler will complain of duplicate methods public static void main(String[] args); public static void main(String[] args); Even The following are not legal as we cannot overload on return types public static String main(String[] args); public static void main(String[] args); | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  main method Asked in 2 Companies | ||||
| ||||
Ans. Yes we can have a main method with string[] argument in every class of an application. When we execute an app we specify the starting point i.e the class that will get the control first and hence main method of that class gets executed. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  main method Asked in 3 Companies | ||||
| ||||
Ans. PATH, CLASSPATH and JAVA_HOME | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  environment variables  path  classpath  java_home Asked in 3 Companies basic   frequent | ||||
| ||||
Ans. [Open Ended Answer] The objective of the question is to check how efficient one is in the language so that appropriate level questions are asked. Don't tell too high number if you are being interviewed for a junior or mid level position as the interviewer may throw advance level questions. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve   Asked in 17 Companies | ||||
| ||||
Ans. General contract of hashCode is: 1.Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, 2.If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result. 3.It is not required that if two objects are unequal according to the equals(java.lang.Object) method, then calling the hashCode method on each of the two objects must produce distinct integer results. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  hashcode Asked in 1 Companies expert | ||||
Frequently asked in Cognizant ( Based on 2 feedback ) | ||||
| ||||
Ans. Inner join is the intersection of two tables on the condition defined by the where clause i.e will get records from both tables matched by a column. Outer join is the union of two tables i.e will get all records from both tables and will put null in the columns where related records are not present. Left Outer join is the left union of two tables i.e all records from the table on the left and values from the right table for related records else null for the columns from right table. Right Outer join is the right union of two tables i.e all records from the table on the right and values from the left table for related records else null for the columns from left table. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  sql  inner join  outer join  right join  left join Asked in 24 Companies basic   frequent | ||||
| ||||
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 | ||||
| ||||
Ans. https://en.wikipedia.org/wiki/Database_normalization | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  normalization  database Asked in 35 Companies intermediate   frequent | ||||
| ||||
Ans. PID - process identification number is an identification number that is automatically assigned to each process when it is created USER - User Name PR - PR is the process actual priority NI is the nice value, which is a user-space concept. VIRT -Virtual Image (kb). The total amount of virtual memory used by the task. RES - Resident size (kb). The non-swapped physical memory a task has used. SHR - Shared Mem size (kb). The amount of shared memory used by a task. S - Process Status. The status of the task which can be one of: D = uninterruptible sleep R = running S = sleeping T = traced or stopped Z = zombie %CPU - % CPU usage %MEM - % MEM Usage TIME - Total CPU time the task has used since it started. COMMAND - Command which was used to execute the process | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  top command  unix command Asked in 1 Companies | ||||
| ||||
Ans. du -a /var | sort -n -r | head -n 10 | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  unix command Asked in 1 Companies | ||||
| ||||
Ans. 59 23 28-31 * * [ "$(date +%d -d tomorrow)" = "01" ] && job_name | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  unix  crontab Asked in 1 Companies | ||||
| ||||
Ans. <a href="http://javahungry.blogspot.com/2015/03/difference-between-array-and-arraylist-in-java-example.html" rel="nofollow">http://javahungry.blogspot.com/2015/03/difference-between-array-and-arraylist-in-java-example.html</a> | ||||
Sample Code for ArrayList | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  array  arraylist Asked in 11 Companies basic   frequent | ||||