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 for 'Apis' - 57 question(s) found - Order By Newest | ||||
Very frequently asked. Among first few questions in almost all interviews. Among Top 5 frequently asked questions. Frequently asked in Indian service companies (HCL,TCS,Infosys,Capgemini etc based on multiple feedback ) and Epam Systems | ||||
| ||||
Ans. "equals" is the method of object class which is supposed to be overridden to check object equality, whereas "==" operator evaluate to see if the object handlers on the left and right are pointing to the same object in memory. x.equals(y) means the references x and y are holding objects that are equal. x==y means that the references x and y have same object. Sample code: String x = new String("str"); String y = new String("str"); System.out.println(x == y); // prints false System.out.println(x.equals(y)); // prints true | ||||
Sample Code for equals | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   string comparison   string   object class   ==   equals   object equality  operator   == vs equals   equals vs == Asked in 294 Companies basic   frequent | ||||
Try 6 Question(s) Test | ||||
Advanced level question. Frequently asked in High end product companies. Frequently asked in Google , Cognizant and Deloitte ( Based on 2 feedback ) | ||||
| ||||
Ans. 1. String Pool - When a string is created and if it exists in the pool, the reference of the existing string will be returned instead of creating a new object. If string is not immutable, changing the string with one reference will lead to the wrong value for the other references. Example - String str1 = "String1"; String str2 = "String1"; // It doesn't create a new String and rather reuses the string literal from pool // Now both str1 and str2 pointing to same string object in pool, changing str1 will change it for str2 too 2. To Cache its Hashcode - If string is not immutable, One can change its hashcode and hence it's not fit to be cached. 3. Security - String is widely used as parameter for many java classes, e.g. network connection, opening files, etc. Making it mutable might possess threats due to interception by the other code segment. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   oops   string   string class   immutable  immutability   advanced Asked in 39 Companies expert   frequent | ||||
Try 4 Question(s) Test | ||||
| ||||
Ans. OOPs or Object Oriented Programming is a Programming model which is organized around Objects instead of processes. Instead of a process calling series of processes, this model stresses on communication between objects. Objects that all self sustained, provide security by encapsulating it's members and providing abstracted interfaces over the functions it performs. OOP's facilitate the following features 1. Inheritance for Code Reuse 2. Abstraction for modularity, maintenance and agility 3. Encapsulation for security and protection 4. Polymorphism for flexibility and interfacing | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  oops  oops features Asked in 260 Companies basic   frequent | ||||
Frequently asked at Manhattan Associates ( Based on 2 feedback ) | ||||
| ||||
Ans. Its an anonymous method without any declaration. Lambda Expression are useful to write shorthand Code and hence saves the effort of writing lengthy Code. It promotes Developer productivity, Better Readable and Reliable code. | ||||
Sample Code for lambda | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   java8   lambda expression   architecture Asked in 58 Companies expert   frequent | ||||
Try 1 Question(s) Test | ||||
Frequently asked question in companies using Hibernate. | ||||
| ||||
Ans. It's a feature to lazily initialize dependencies , relationship and associations from the Database. Any related references marked as @OneToMany or @ManyToMany are loaded lazily i.e when they are accessed and not when the parent is loaded. | ||||
Sample Code for Lazy Initialization | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  hibernate   lazy loading hibernate   lazy initialization hibernate   architecture Asked in 77 Companies Basic   frequent | ||||
Try 2 Question(s) Test | ||||
Very Frequently asked. Have been asked in HCL Technologies very frequently ( based on 3 feedback ). Among first few questions in many interviews. | ||||
| ||||
Ans. Abstract classes can have both abstract methods ( method declarations ) as well as concrete methods ( inherited to the derived classes ) whereas Interfaces can only have abstract methods ( method declarations ). A class can extend single abstract class whereas it can implement multiple interfaces. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   classes   abstract class   interfaces   abstract class vs interface   abstract classes vs interfaces Asked in 82 Companies basic   frequent | ||||
Very Frequently asked to fresh graduates and less experienced. Favorite question in Walk in drives. Frequently asked in Indian Services companies. | ||||
| ||||
Ans. Overloading - Similar Signature but different definition , like function overloading. Overriding - Overriding the Definition of base class in the derived class. | ||||
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  java   oops   overloading   overriding   oops concepts   basic interview question   overloading vs overriding Asked in 86 Companies basic   frequent | ||||
Try 1 Question(s) Test | ||||
Frequently asked to fresh graduates. | ||||
| ||||
Ans. ACID stands for Atomicity, Consistency, Isolation, Durability is a set of properties of database transactions. Atomicity means all or nothing. i.e parts of a transaction shouldn't commit if any one of them fails. Either the whole transaction should succeed or it should be complete rollback. Consistency means that any transaction should lead database from one stabe state to another. Isolation means that the execution of transaction results in a system state that would be obtained if transactions were executed serially. Durability means that when a transaction is committed it forms the permanent state of database. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  database  acid Asked in 7 Companies Intermediate | ||||
Try 1 Question(s) Test | ||||
Very frequently asked in companies using SOA. | ||||
| ||||
Ans. REST or Representational State Transfer is a flexible architecture style for creating web services that recommends the following guidelines - 1. http for client server communication, 2. XML / JSON as formatiing language , 3. Simple URI as address for the services and, 4. stateless communication. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   web services   rest   java   j2ee  architecture Asked in 14 Companies intermediate   frequent | ||||
| ||||
Ans. It in Java is used to indicate that a field should not be serialized. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   oops   serialization   transient   java keywords Asked in 39 Companies intermediate   frequent | ||||
Try 2 Question(s) Test | ||||
| ||||
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 | ||||
Frequently asked to fresh graduates. | ||||
| ||||
Ans. When two threads are waiting each other and cant precede the program is said to be deadlock. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   threads   multi threading   operating system   deadlock  concurrency Asked in 23 Companies basic   frequent | ||||
| ||||
Ans. It is the process of examining / modifying the behaviour of an object at runtime. | ||||
Sample Code for reflection | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   reflection   reflection api   ebay   mindtree Asked in 29 Companies basic   frequent | ||||
Usually asked to entry level software developers. | ||||
| ||||
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 | ||||
| ||||
Ans. An API is a kind of technical contract which defines functionality that two parties must provide: a service provider (often called an implementation) and an application. an API simply defines services that a service provider (i.e., the implementation) makes available to applications. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  j2ee   api   java basic   frequent | ||||
Very frequently asked. Usually asked with questions related to String. Frequently asked at CTS / Cognizant | ||||
| ||||
Ans. Object that can't be changed after instantiation. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   oops   immutable  immutability Asked in 27 Companies basic   frequent | ||||
Try 2 Question(s) Test | ||||
| ||||
Ans. Stands for Java API for XML Processing. This provides a common interface for creating and using SAX, DOM, and XSLT APIs in Java regardless of which vendor’s implementation is actually being used. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   java api   xml   xml processing   jaxp   abbreviation   technologies | ||||
| ||||
Ans. Stands for Java API for XML Binding. This standard defines a mechanism for writing out Java objects as XML and for creating Java objects from XML structures. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   xml   markup language   java api for xml binding   jaxb   abbreviation   technologies Asked in 2 Companies | ||||
| ||||
Ans. private static boolean isPalindrome(String str) { if (str == null) return false; StringBuilder strBuilder = new StringBuilder(str); strBuilder.reverse(); return strBuilder.toString().equals(str); } | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   string   stringbuilder   stringbuilder   string class   code   palindrome Asked in 38 Companies Basic   frequent | ||||
| ||||
Ans. We can either increase their visibility and mark them with annotation @VisibleForTesting or can use reflection to individually test those methods. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  junit   reflection api   @visiblefortesting   white box tester | ||||
Recently asked in Capital One. | ||||
| ||||
Ans. compiler will throws error as ambiguous methods | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  overloading   method overloading Asked in 1 Companies intermediate | ||||
| ||||
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. 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 | ||||
| ||||
Ans. We can create API gateway and give the name of lambda function in order to be linked with lambda function, deploy the API and whenever request will be made from API it will directly be linked to lambda function to perform further process. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  aws api gateway  aws lambda  aws serverless computing  amazon cloud serverless computing  amazon lambda | ||||
| ||||
Ans. Its the process of creating XML structures out of Java Objects which is used to traverse information across the network. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  xml   java api for xml   marshalling   parser   sax   dom   technologies Asked in 1 Companies | ||||
| ||||
Ans. Its the process of creating Java Objects out of XML structures. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  xml   java api for xml   unmarshalling   parser   sax   dom   architecture Asked in 1 Companies | ||||
| ||||
Ans. PATH is the variable that holds the directories for the OS to look for executables. CLASSPATH is the variable that holds the directories for JVM to look for .class files ( Byte Code ). | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   path   classpath   byte code   jvm   basic interview question Asked in 3 Companies intermediate   rare | ||||
Very Frequently asked. Favorite question in walkins and telephonic interviews. Usually among first few questions. Asked in different variants. Must know for intermediate and expert professionals.Among Top 10 frequently asked questions. | ||||
| ||||
Ans. A Class must override the hashCode method if its overriding the equals method. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   collections   hashcode  hash code   equals   collections Asked in 44 Companies intermediate   frequent | ||||
Try 1 Question(s) Test | ||||
| ||||
Ans. no, It's like challenging the design of application. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   reflection api   yes-no   architecture Asked in 1 Companies intermediate | ||||
| ||||
Ans. Because it has to inspect the metadata in the bytecode instead of just using precompiled addresses and constants. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   reflection   reflection api   architecture | ||||