Interview Questions and Answers for 'ABS' | 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 - Order By Newest

   
 Q41. In the following code , how many methods needs to be implemented in Class B ?

public interface A{
   public void method1();
   public void method2();
   public void method3();
}

abstract class B implements A{
}
Core Java
Ans. As Class B has been declared abstract , we can either implement any of these methods and just declare rest of them abstract.

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

   Like         Discuss         Correct / Improve     interfaces  abstract classes  code  coding

Try 2 Question(s) Test


 Q42. What should a class do if its extending an abstract class ?Core Java
Ans. It should either implement the abstract methods or re-declare them abstract.

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

   Like         Discuss         Correct / Improve     abstract class     Asked in 2 Companies      Basic        Frequent


Frequently asked to Fresh graduates.
 Q43. Write a program to implement Binary search ?Core Java
Ans. http://algs4.cs.princeton.edu/11model/BinarySearch.java.html

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

   Like         Discuss         Correct / Improve     binary search  search     Asked in 5 Companies      basic        frequent

Try 1 Question(s) Test


 Q44. Can we declare a main method as abstract ?
Ans. No. Static methods cannot be overridden and hence make no sense to be declared abstract.

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

   Like         Discuss         Correct / Improve     main method   abstract

Try 1 Question(s) Test


 Q45. When should we use Abstract classes ?Core Java
Ans. Abstract classes provide a mechanism of interfacing ( using abstract method ) as well as inheritance ( extending abstract class ). So they should be used in place of interfaces in case there is some code ( methods ) or object body ( member elements ) that can be reused with inheritance.

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

   Like         Discuss         Correct / Improve     abstract classes     Asked in 1 Companies


  Q46. What are the core OOPs concepts ?Core Java
Ans. Abstraction, Encapsulation, Polymorphism , Composition and Inheritance

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

   Like         Discuss         Correct / Improve     core oops concepts     Asked in 65 Companies      basic        frequent


 Q47. Write program to create a linked list and perform different operations on it.Algorithm
Ans. import java.util.*;
class LinkedListSolution{
protected LinkedList list;
public LinkedListSolution(){
list = new LinkedList();
}
public Object pop() throws NoSuchElementException{
if(list.isEmpty())
throw new NoSuchElementException();
else
return list.removeFirst();
}
public void push(Object obj){
list.addFirst(obj);
}
public Object peek() throws NoSuchElementException{
if(list.isEmpty())
throw new NoSuchElementException();
else
return list.getFirst();
}
public boolean isEmpty(){
return list.isEmpty();
}
public String toString(){
return list.toString();
}
}
class TestStack{
public static void main(String args[]){
LinkedListSolution s = new LinkedListSolution();
s.push("First");
s.push("Second");
s.push("Third");
System.out.println("Top: " s.peek());
s.push("Fourth");
while(!(s.isEmpty()))
System.out.println(s.pop());
}
}

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

   Like         Discuss         Correct / Improve     Linkedlist  data structures  algorithm     Asked in 2 Companies      basic


 Q48. write program to do matrix multiplicationCore Java
 This question was recently asked at 'Kony Labs'.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 1 Companies


 Q49. Can we override abstract methods ?Core Java
Ans. Abstract methods are the methods that need to be overridden in the derived class ( either as implementing method or again abstract method ) so it's not only allowed but its required to override abstract method in the derived class.

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

   Like         Discuss         Correct / Improve     overriding  abstract methods  overriding abstract methods


 Q50. Can we override an abstract method with abstract method in the derived class ?Core Java
Ans. Yes, but in that case the derived class itself should be abstract. We cannot have an object of a class without definition for the method which has been declared abstract in the parent.

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

   Like         Discuss         Correct / Improve     overriding  overriding abstract methods  abstract methods


 Q51. Difference between log4j and slf4j ?Logging
 This question was recently asked at 'Y Media Labs'.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     log4j vs slf4j     Asked in 1 Companies


 Q52. What was the need of creating an abstract class in Java when we cannot instantiate an object of it ?Core Java
Ans. The objective of an abstract class is to provide an interface as well as code reuse. Though we cannot instantiate an instance of abstract class but we can reuse the code by extending such a class. Moreover abstract class provides interfacing to outside components just like interfaces.

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

   Like         Discuss         Correct / Improve     abstract class


 Q53. Why can't we create an instance of abstract class ? Why is it restricted by compiler ?Core Java
Ans. Because Abstract class is incomplete i.e there are abstract methods that needs to be defined by extending classes.

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

   Like         Discuss         Correct / Improve     abstract class


 Q54. What is synchronization ?Core Java
 This question was recently asked at 'ABS'.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 1 Companies


 Q55. What is JVM ?Core Java
Ans. JVM (Java Virtual Machine) is an abstract machine. It is a specification that provides runtime environment in which java bytecode can be executed.JVMs are available for many hardware and software platforms (i.e. JVM is platform dependent).Runtime Instance Whenever you write java command on the command prompt to run the java class, an instance of JVM is createdThe JVM performs following operation:Loads codeVerifies codeExecutes codeProvides runtime environment

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

   Like         Discuss         Correct / Improve     memory management  jvm     Asked in 3 Companies      basic        frequent


 Q56. What is the importance of Abstract Class ?Core Java
Ans. Abstract classes provide a mechanism of interfacing ( using abstract method ) as well as code reuse through inheritance ( extending abstract class )

Comparing to concrete class they have an advantage of providing interface which a concrete class doesn't provide.

Comparing to interfaces they have an advantage of providing code reuse through inheritance which interfaces dont provide.

  Sample Code for abstract class

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

   Like         Discuss         Correct / Improve     abstract class  importance of abstract class      Basic        frequent


 Q57. Write a Program for insertion sort.Core Java
 This question was recently asked at 'Ola Cabs'.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     program  code  coding  insertion sort   sort     Asked in 1 Companies


 Q58. What are the uses of Abstraction ?Core Java
Ans. Loose Coupling
Facilitates designing complex applications by making them modular.

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

   Like         Discuss         Correct / Improve     oops concepts  abstraction     Asked in 1 Companies


 Q59. What are the advantage of Abstract classes over interfaces with respect to Java 7 ? and What changed in Java 8 to help facilitate that in Java 8 ?Core Java
Ans. Abstract Classes provide default implementations of methods that are inherited by the classes that extend them, which was not the case for Interfaces. This changed in Java 8, where default implementations are provided for methods.

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

   Like         Discuss         Correct / Improve     abstract classes  interfaces  default method     Asked in 1 Companies      expert


 Q60. how does abstraction help your application ?Core Java
 This question was recently asked at 'Intel'.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     abstraction  oops concepts     Asked in 1 Companies      basic


  Q61. What is collection framework in Java ?Core Java
Ans. The Java collections framework (JCF) is a set of classes and interfaces that implement commonly reusable collection data structures. Although referred to as a framework, it works in a manner of a library. The JCF provides both interfaces that define various collections and classes that implement them.

  Sample Code for Map

  Sample Code for HashMap

  Sample Code for Treemap

  Sample Code for set

  Sample Code for hashset

  Sample Code for treeset

  Sample Code for list

  Sample Code for arraylist

  Sample Code for linkedlist

  Sample Code for queue

  Sample Code for priorityqueue

  Sample Code for concurrenthashmap

  Sample Code for vector

  Sample Code for stack

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

   Like         Discuss         Correct / Improve     collections     Asked in 9 Companies      basic        frequent


 Q62. Can we declare an Interface with abstract keyword ? Core Java
Ans. Yes

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

   Like         Discuss         Correct / Improve     abstract keyword


 Q63. Which jar files need to be included for using Hibernate ?Hibernate
Ans. hibernate-orm
hibernate-validator
hibernate-ogm
hibernate-search

or you can download hibernate core with all dependencies.

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

   Like         Discuss         Correct / Improve     hibernate jar files   hibernate     Asked in 1 Companies


 Q64. What is the relationship between Base Class and Abstract Class ?Core Java
Ans. Abstract Class is a class that's only allowed to be a Base class for it's usage. It can never be instantiated on it's own.

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

   Like         Discuss         Correct / Improve     base class  abstract class      basic


 Q65. Can an abstract class be a derived class ?Core Java
Ans. Yes, an abstract class can extend another class.

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

   Like         Discuss         Correct / Improve     abstract class


 Q66. Does abstract class have public constructor? Core Java
Ans. Yes, an abstract class can have a constructor in Java.

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

   Like         Discuss         Correct / Improve     abstract class  public constructor     Asked in 1 Companies


 Q67. What is SNMP ?Networking
Ans. SNMP or Simple Network Management protocol is an application layer protocol for exchanging management information between network devices.


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

   Like         Discuss         Correct / Improve          Asked in 15 Companies


 Q68. Interface vs AbstractionCore Java
 This question was recently asked at 'Oracle financial services'.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     interface vs abstraction  interfacing vs abstraction  relation between interface and abstraction  How interface provide abstraction     Asked in 1 Companies


 Q69. Which of the following is not true for abstract classes ?Core Java
a. Abstract Class is only meant to be sub classed and not supposed to be instantiated.
b. Abstract class handlers can be used to handle derived class objects.
c. We can't have an abstract class without abstract methods.
d. Abstract class has member elements.

Ans.c. We can't have an abstract class without abstract methods.

 Q70. Which of the following can be declared abstract ?Core Java
a. static methods
b. instance methods
c. static variable
d. instance variables

Ans.b. instance methods

previous 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: