Interview Questions and Answers for 'Atc' | 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 'Atc' - 29 question(s) found - Order By Newest

Frequently asked question in companies using Hibernate.
  Q1. What is Lazy Initialization in Hibernate ?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.
 Q2. Explain throw, throws , try and catch in Java ?Core Java
Ans. throw is used to re throw an exception.throws is used to declare that the method throws the respective exceptions.try block is used to identify if the respective block has thrown any exception.catch is used to catch the exception that has been thrown by the respective try block.

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

   Like         Discuss         Correct / Improve     java   exception handling   throw   throws   try   catch     Asked in 5 Companies      basic        frequent


 Q3. If you need to consume messages from the queue faster, which approach will you recommend - batching or concurrency ?Design
Ans. Each has it's own advantages

Batching requires less resources but may result in loosing whole batch in case of failure whereas concurrency even though is little more expensive in terms of resources but would result in minimal loss in case of failure.

In case messages are to be consumed in a particular order, batching them in that order and then consuming them makes better sense.

if incoming messages are not continuous , it makes more sense to do concurrency as we need not wait for all messages to form a batch and flush. Though time sensitivity can be added but that would add unnecessary complexity.

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

   Like         Discuss         Correct / Improve     concurrency vs batching   concurrency  multithreading  batch


 Q4. How can we make sure that a code segment gets executed even in case of uncatched exceptions ?
Ans. By putting it within finally.

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

   Like         Discuss         Correct / Improve     java   oops   exceptions   finally   uncatched exceptions      basic        frequent


 Q5. Is it necessary that each try block to be followed by catch block ? Core Java
Ans. It should be followed by either catch or finally block.

  Sample Code for Retry in case of exception

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

   Like         Discuss         Correct / Improve     java   exceptions   exception handling   try   catch   finally  Oracle OCA Test     Asked in 3 Companies      basic        frequent

Try 1 Question(s) Test


  Q6. Write a Program to check if 2 strings are Anagrams ?Core Java
Ans. public void checkIfAnagram(String str1,String str2){
boolean anagram = true;
for(char c:str1.toCharArray()){
if(!str2.contains(String.valueOf(c))){
System.out.println("Strings are Anagrams");
anagram = false;
}

if(anagram == true){
System.out.println("Strings are not Anagrams");
}
}
}

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

   Like         Discuss         Correct / Improve      check if 2 strings are Anagrams     Asked in 30 Companies      basic        frequent


 Q7. Can we have try and catch blocks within finally ?Core Java
Ans. Yes, if we have a cleanup code that might throw an exception in the finally block, then we can have a try-catch block

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

   Like         Discuss         Correct / Improve     java   exceptions   exception handling   finally   try   catch   yesno


 Q8. What's wrong with this code ?

public static void main(String[] args) {
String regex = "(\\w+)*";
String s = "Java is a programming language.";

Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(s);
while (matcher.next()) {
System.out.println("The e-mail id is: " + matcher.group());
}
}
Core Java
Ans. matcher.find() should have been used instead of matcher.next() within while.

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

   Like         Discuss         Correct / Improve     java   regex   pattern.matcher   java.util   coding   code


 Q9. How does a try statement determine which catch clause should be used to handle an exception?Core Java
Ans. When an exception is thrown within the body of a try statement, the catch clauses of the try statement are examined in the order in which they appear. The first catch clause that is capable of handling the exception is executed. The remaining catch clauses are ignored.

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

   Like         Discuss         Correct / Improve     java   exceptions   exception handling   try   catch      basic        frequent


 Q10. Can finally block be used without catch ?Core Java
Ans. Yes but should follow "try" block then.

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

   Like         Discuss         Correct / Improve     java   exceptions   exception handling   try   catch   finally   yes-no

Try 1 Question(s) Test


 Q11. Will finally be called always if all code has been kept in try block ?Core Java
Ans. The only time finally won't be called is if you call System.exit() or if the JVM crashes first.

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

   Like         Discuss         Correct / Improve     java   exceptions   exception handling   try   catch   finally   system   system.exit


 Q12. Which interfaces are implemented by BatchUpdateException?
Ans. [Iterable]

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

   Like         Discuss         Correct / Improve     java   BatchUpdateException   include


 Q13. Which of the following is not possible ?

a. try block followed by catch
b. try block followed by finally
c. try block followed by catch block and then finally
d. try block without catch or finally block
Ans. try block without catch or finally block

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

   Like         Discuss         Correct / Improve     exceptions   java   try-catch   finally

Try 1 Question(s) Test


 Q14. What is the difference between following code segments

1.

try {
for(int i=0;i<100;i++){
calculate(i);
}
} catch (Exception ex) {
System.out.println("Error while processing")
}

and

2.

for(int i=0;i<100;i++){
try {
calculate(i);
} catch (Exception ex) {
System.out.println("Error while processing")
}
}
Core Java
Ans. In first case the whole loop will terminate as soon as any exception happens in the method calculate ( assuming calculate method is not handling its exception and those are thrown back at the calling method )

In Second case exception will be caught for individual iteration and hence it wont break the loop and will continue for the next iteration.

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

   Like         Discuss         Correct / Improve     exception handling  try catch     Asked in 1 Companies


 Q15. What is the difference between CountingSemaphore and a CountDownLatch?Operating System
 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     CountingSemaphore  CountDownLatch


 Q16. Given a string and index for the opening bracket, find the index of matching closing bracket. Core Java
 This question was recently asked at 'Amazon'.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     matching bracket  stack     Asked in 1 Companies


 Q17. What is dynamic dispatch in Java ?Core Java
Ans. Dynamic dispatch in java is also known as runtime polymorphism.It is a process in which a call to an overriden method is resolved at runtime.

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

   Like         Discuss         Correct / Improve     dynamic dispatch  runtime polymorphism  object oriented programming (oops)  oops concepts


 Q18. How do you check logs for your application in AWS ?Amazon Web Services (AWS)
Ans. We can do it by either going to Elastic Beanstalk -> Respective instance -> Logs

or using CloudWatch -> Logs -> Respective Log Group

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

   Like         Discuss         Correct / Improve     aws logs  cloudwatch logs  elastic beanstalk


 Q19. What is AWS CloudWatch ?Amazon Web Services (AWS)
Ans. Amazon CloudWatch is a monitoring service for AWS cloud resources like Beanstalk and DB instances. We can use CloudWatch to monitor the state of resources, collect metrices, set alarms and appropriate response to the alarm state.

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

   Like         Discuss         Correct / Improve     aws cloudwatch  amazon cloudwatch  aws


  Q20. 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


 Q21. How can we schedule Lambda function to run daily ?Amazon Web Services (AWS)
Ans. We can schedule that through CloudWatch.

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

   Like         Discuss         Correct / Improve     lambda function  aws lambda  aws serverless computing  amazon cloud serverless computing  amazon lambda function  aws cloudwatch  amazon cloudwatch


 Q22. If you have to pull a sub string out of a string, which method would you use - using String methods or Pattern / Matcher ?Design
Ans. It depends on how complex it is and if in future it would need any sort opf debugging. It's not easy to debug code if it's making heavy use of shortcuts like Lambda , Patterns etc.

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

   Like         Discuss         Correct / Improve     pattern matching  String  design


 Q23. Which AWS service can be used for creating Billing Alarms ?Amazon Web Services (AWS)
Ans. AWS CloudWatch

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

   Like         Discuss         Correct / Improve     aws cloudwatch  amazon cloudwatch


 Q24. Which AWS service can be used to monitor EC2 ?Amazon Web Services (AWS)
Ans. CloudWatch

 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 cloudwatch  amazon cloudwatch


 Q25. Are CloudWatch metrics available with free tier ?Amazon Web Services (AWS)
Ans. Only Basic not advanced

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

   Like         Discuss         Correct / Improve     aws cloudwatch  amazon cloudwatch


 Q26. What are the Default metrics available for EC2 in CloudWatch ?Amazon Web Services (AWS)
Ans. CPU, Disk, Network, Status

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

   Like         Discuss         Correct / Improve     aws cloudwatch  amazon cloudwatch


 Q27. How frequently Cloudwatch monitor AWS services for generating metrics ?Amazon Web Services (AWS)
Ans. 5 mins for Standard / Basic
1 min for Detailed / advanced

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

   Like         Discuss         Correct / Improve     aws cloudwatch  amazon cloudwatch


 Q28. Difference between CloudWatch and CloudTrail ?Amazon Web Services (AWS)
Ans. CloudWatch is for monitoring resources whereas CloudTrail is for auditing activity.

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

   Like         Discuss         Correct / Improve     aws cloudwatch  amazon cloudwatch  aws cloudtrail  aws cloudwatch  amazon cloudwatch vs aws cloudtrail


 Q29. what is dispatcher servlet@componentScan use ?Spring Framework
Ans. @ComponentScan in a Spring Application.

With Spring, we use the @ComponentScan annotation along with the @Configuration annotation to specify the packages that we want to be scanned. @ComponentScan without arguments tells Spring to scan the current package and all of its sub-packages.

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

   Like         Discuss         Correct / Improve     ComponentScan  dispatcher  @ComponentScan annotation  @Configuration annotation     Asked in 1 Companies



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: