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 Newest | ||||
Frequently asked to fresh graduates and less experienced. | ||||
| ||||
Ans. Inheritance. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  inheritance  object oriented programming (oops)  oops concepts   java   oops   composition  object oriented programming (oops)  oops concepts Asked in 1 Companies basic   frequent | ||||
Very frequently asked in phone and walk in interviews. | ||||
| ||||
Ans. An interface without any method declaration is called as marker interface. there are 3 in-built interfaces in JVM i.e. serializable, clonable, remote | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   oops   interfaces   marker interface   serializable   clonable Asked in 21 Companies intermediate   frequent | ||||
Try 1 Question(s) Test | ||||
| ||||
Ans. Builder is a creational Design Pattern whereas Composite is a structural design pattern. Composite creates Parent - Child relations between your objects while Builder is used to create group of objects of predefined types. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   design pattern   builder   composite   creational design pattern   structural design pattern | ||||
| ||||
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 | ||||
| ||||
Ans. Garbage Collector wont remove a strong reference. A soft reference will only get removed if memory is low. A weak reference will get removed on the next garbage collection cycle. A phantom reference will be finalized but the memory will not be reclaimed. Can be useful when you want to be notified that an object is about to be collected. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   memory management   jvm   garbage collections   references   strong reference   soft reference   weak reference   phantom reference   architecture Asked in 2 Companies | ||||
| ||||
Ans. Yes, We can call garbage collector directly but it doesn't guarantees that the gc will start executing immediately. This gc( ) method appears in both Runtime and System classes of java.lang package. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   garbage collection   java memory management   jvm   gc   yes no Asked in 4 Companies expert | ||||
Try 1 Question(s) Test | ||||
| ||||
Ans. Java uses Just-In-Time compiler to enable high performance. Just-In-Time compiler is a program that turns Java bytecode into instructions that can be sent directly to the processor. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   compiler   jvm   bytecode   justintime compiler   architecture | ||||
| ||||
Ans. The purpose of comparator interface is to compare objects of the same class to identify the sorting order. Sorted Collection Classes ( TreeSet, TreeMap ) have been designed such to look for this method to identify the sorting order, that is why class need to implement Comparator interface to qualify its objects to be part of Sorted Collections. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   collections   treemap   treeset   comparator Asked in 2 Companies Intermediate | ||||
Try 2 Question(s) Test | ||||
| ||||
Ans. Yes, but the overloaded main methods without single String[] argument doesn't get any special status by the JVM. They are just another methods that needs to be called explicitly. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   main method   overloading   yes-no Asked in 6 Companies intermediate   frequent | ||||
| ||||
Ans. No. compareTo method is declared final for the Enumerations and hence cannot be overriden. This has been intentionally done so that one cannot temper with the sorting order on the Enumeration which is the order in which Enum constants are declared. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   compareto   final methods   enum   enumeration expert | ||||
| ||||
Ans. BlockingQueue is a Queue that supports operations that wait for the queue to become non-empty when retrieving and removing an element, and wait for space to become available in the queue when adding an element. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  blockingqueue   collections   java   concurrent collections Asked in 10 Companies | ||||
This question can be asked in different variants like performace improvement of an application, improving performance for DB communication etc. | ||||
| ||||
Ans. This depends on entirely upon the code type. For example 1.If its just logic, we can try it to short circuit or put the if / switch case with maximum probability in the beginning. 2. Can use faster data structures, for eg - random retrieval instead of sequence / iterator 3. Working with primitive types or even bytes instead of Objects, even though it may result in marginal improvement. 4. If its service call, then service call with bulk load can help 5. If DB Operation, then with use of Indices , Views or using ORM , cache etc. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  performance improvement  code optimization Asked in 1 Companies | ||||
| ||||
This question was recently asked at 'Myntra,Compro 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 2 Companies | ||||
| ||||
Ans. class A { void test() { System.out.println("test() method"); } } class B { void test() { System.out.println("test() method"); } } Suppose if Java allows multiple inheritance like this, class C extends A, B { } A and B test() methods are inheriting to C class. So which test() method C class will take? As A & B class test() methods are different , So here we would Facing Ambiguity. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  multiple inheritance  object oriented programming (oops)  oops concepts  diamond problem Asked in 20 Companies basic   frequent | ||||
| ||||
Ans. Cloud Computing is a way of using IT infrastructure with following traits - 1. On Demand Infrastructure 2. Broad Network Access 3. Resource Pooling 4. Rapid Elasticity 5. Measured Service | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  google cloud platform (GCP)  Amazon Web Services (AWS | ||||
| ||||
Ans. Warm up time for certain technologies like Java ( JVM Warmup ) Performance Size of Deployable ( Bigger size packaging should go in S3 ) | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  serverless technologies  aws lambda  aws serverless computing  amazon cloud serverless computing  amazon lambda Asked in 1 Companies | ||||
| ||||
Ans. In AWS Lambda we can run a function in synchronous or asynchronous mode. In synchronous mode, if AWS Lambda function fails, then it will just give an exception to the calling application. In asynchronous mode, if AWS Lambda function fails then it will retry the same function at least 3 times.If AWS Lambda is running in response to an event in Amazon DynamoDB or Amazon Kinesis, then the event will be retried till the Lambda function succeeds or the data expires. In DynamoDB or Kinesis, AWS maintains data for at least 24 hours. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  aws lambda  aws serverless computing  amazon cloud serverless computing  amazon lambda | ||||
| ||||
Ans. Because it gives the ability to provision infrastructure on Demand with No contracts and strings attached. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  Amazon Web Service (AWS)   Google Cloud Platform (GCP) | ||||
| ||||
Ans. If the computation required is Spiky and unpredictable. If it's first time use. If the lifespan of the application isn't known. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  aws ec2  aws computing  amazon cloud computing  amazon ec2 | ||||
| ||||
Ans. If the usage is non continuous and have flexible start and End Time. For ex - Analysis , Research , mining etc. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  aws ec2  aws computing  amazon cloud computing  amazon ec2 spot | ||||
| ||||
Ans. On Demand Reserved Spot Dedicated Host | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  aws ec2  aws computing  amazon cloud computing  amazon ec2 | ||||
| ||||
Ans. Keeping Low cost for processing , i would choose Spot Price Plan F1 or P3 Instance Type Cold Hdd (SCI ) EBS Volume | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  aws ec2  aws computing  amazon cloud computing  amazon ec2 | ||||
| ||||
Ans. Computation Spot Price Plan F1 or P3 Instance Type Cold Hdd (SCI ) EBS Volume Storage S3-IA | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  aws computation  aws ec2  aws computing  amazon cloud computing  amazon ec2 | ||||
| ||||
Ans. We can assign multiple security groups to single instance and we can use single security group with multiple instances. It never results in conflict as security groups only have allow rules and no deny rules. Multiple security groups for an instance results in union of all rules. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  aws ec2  aws computing  amazon cloud computing  amazon ec2  aws security group | ||||
| ||||
Ans. JSON is "JavaScript Object Notation", primarily used for client-server or server-server communication. Its a much lighter and readable alternative to XML. JSON is language independent and is easily parse-able in all programming languages. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  json   markup language   client server communication Asked in 26 Companies basic   frequent | ||||
Try 2 Question(s) Test | ||||
| ||||
Ans. One can import the same package or same class multiple times. Neither compiler nor JVM complains wil complain about it. And the JVM will internally load the class only once no matter how many times you import the same class. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   import   jvm   advanced Asked in 1 Companies intermediate   rare | ||||
| ||||
Ans. Enables the programmer to abbreviate the names of classes defined in a package. | ||||
Sample Code for import | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   import   java keyword | ||||
| ||||
Ans. By static import , we can access the static members of a class directly without prefixing it with the class name. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   java5   static import   static   java keyword   static import Asked in 4 Companies basic   frequent | ||||
Frequently asked to fresh graduates. | ||||
| ||||
Ans. Its an interpretor. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   jvm   compiler   interpretor basic   frequent | ||||
| ||||
Ans. Externalizable interface is used to write the state of an object into a byte stream in compressed format. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   oops   serialization   externalizable interface   interface Asked in 3 Companies | ||||