Interview Questions and Answers for 'Cognizant' | 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

   next 30
 Q61. How is static and dynamic polymorphism achieved in Java ?Core Java
Ans. Static polymorphism is the polymorphic resolution identified at compile time and is achieved through function overloading whereas dynamic polymorphism is the polymorphic resolution identified at runtime and is achieved through method overriding.

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

   Like         Discuss         Correct / Improve     static polymorphism  object oriented programming (oops)  oops concepts   dynamic polymorphism  object oriented programming (oops)  oops concepts   polymorphism  object oriented programming (oops)  oops concepts   overloading   overriding   broadridg     Asked in 1 Companies      basic        frequent


  Q62. What is a Destructor ? Do we have Destructors in Java ?Core Java
Ans. Destructor is used to de-allocate memory allocated by objects.

There are no destructors in Java. Alternatively, Java provides Automatic garbage collection i.e automatically releasing the un-referenced memory.

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

   Like         Discuss         Correct / Improve     destructor  garbage collection     Asked in 11 Companies      Basic        frequent

Try 1 Question(s) Test


 Q63. Write a java program to implement Quick sort ?Core Java
Ans. http://www.programcreek.com/2012/11/quicksort-array-in-java/

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

   Like         Discuss         Correct / Improve     quick sort  sort     Asked in 2 Companies        frequent


Frequently asked to Fresh graduates.
 Q64. 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


 Q65. Which data structure would you recommend for ordered and sorted data?Core Java
Ans. TreeSet and TreeMap are used for maintaining sorted elements.

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

   Like         Discuss         Correct / Improve     ordered collections  sorted collections     Asked in 1 Companies      basic        frequent


 Q66. Explain Exception Hierarchy in Java SE ?Core Java
Ans. <a href="http://www.programcreek.com/2009/02/diagram-for-hierarchy-of-exception-classes/" rel="nofollow">http://www.programcreek.com/2009/02/diagram-for-hierarchy-of-exception-classes/</a>

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

   Like         Discuss         Correct / Improve     exception hierarchy   exceptions     Asked in 3 Companies


 Q67. What is a Database Procedure ?Database
Ans. Stored procedures are a batch of SQL statements along with programming constructs ( if else, loops etc ) and stored as a single program that can be called by different clients and hence reused.


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

   Like         Discuss         Correct / Improve     database  stored procedure     Asked in 2 Companies      basic        frequent


 Q68. What is a Database sequence ?Database
Ans. Its a feature wherein database creates unique values incremental values to be stored as primary key for the table.

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

   Like         Discuss         Correct / Improve     database   sequence     Asked in 1 Companies


 Q69. What do you know about JQuery ?Java EE
Ans. jQuery is a cross platform JavaScript library designed to simplify the client-side scripting of HTML. JQuery is the most popular JavaScript library.

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

   Like         Discuss         Correct / Improve     jquery     Asked in 1 Companies


 Q70. Can we have try statement without catch? If try statement contains return will the finally block be executed? What happens if there is an exception inside finally block?Core Java
Ans. Yes, with finally.

Yes, finally block will be executed even if there is no exception in try block.

If finally throws an exception, the exception gets thrown to the calling module.

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

   Like         Discuss         Correct / Improve     exception handling     Asked in 1 Companies      intermediate


Very Frequently asked to fresh graduates and less experienced.
 Q71. What are the principle concepts of Object Oriented Programming ?Core Java
Ans. Abstraction Polymorphism Inheritance Encapsulation

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

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


All these acronyms JDK,JRE,JVM etc are very frequently asked.
 Q72. Difference between JDK and JRE ?Core Java
Ans. JRE or Java Runtime Environment is the Java Virtual Machine on which class files are executed. It includes borwser plugins that facilitates execution of class files in browsers.

JDK or Java Development Kit includes JRE , compiler and development tools.

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

   Like         Discuss         Correct / Improve     JDK  JRE  JDK vs JRE  Difference between     Asked in 4 Companies      basic        frequent


 Q73. What are the benefits of Enums ?Core Java
Ans. Enums in Java are used to declare predefined objects and then reuse them. they offer many benefits

1. Enum instance are type safe and thread safe.

2. Enum instances are singleton and hence reused.

3. If we use Enums with Switch , It makes sure that the passed argument is either of its instance and hence provides a safeguard.

4. If we use Enum with Sorted Collections we can sort the elements with a predefined priorities ( as per constant declaration in enum )

5. We can use Enum as a Factory by defining its constructor.

6. We can store related constant data within enum. For example - If we know the values for the map upfront, we can alternatively use an enum.

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

   Like         Discuss         Correct / Improve          Asked in 6 Companies


 Q74. What are the disadvantages of multithreading ?Core Java
Ans. 1. Switching Overheads - Even though multi threading aims at improving performance by reducing the wait time and hence improving overall throughput, there is a cost of switching resources between threads and sometime this cost can surpass the benefits if there isnt much wait for IO or external communication.

2. Debugging is hard with multi threaded code.

3. Deadlock - Execution of multi threaded code many a times lead to deadlock due to shared resources.

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

   Like         Discuss         Correct / Improve     multithreading  threads     Asked in 4 Companies


 Q75. What is Spring Boot ?Spring Boot
Ans. Spring Boot is Springs convention-over-configuration solution for creating stand-alone, production-grade Spring-based Applications.

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

   Like         Discuss         Correct / Improve     Spring Boot     Asked in 7 Companies


  Q76. What is an exception and exception handling in Java ?Core Java
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


 Q77. Explain Generics in Java ?Core Java
Ans. Generics are a facility of generic programming that were added to the Java programming language in 2004 within J2SE5.0. They allow "a type or method to operate on objects of various types while providing compile-time type safety.

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

   Like         Discuss         Correct / Improve     generics     Asked in 7 Companies


  Q78. Explain OOps concepts.Core Java
Ans. There are four main OOP concepts in Java. These are:

Abstraction. Abstraction means using simple things to represent complexity. We all know how to turn the TV on, but we don?t need to know how it works in order to enjoy it. In Java, abstraction means simple things like objects, classes, and variables represent more complex underlying code and data. This is important because it lets avoid repeating the same work multiple times.

Encapsulation. This is the practice of keeping fields within a class private, then providing access to them via public methods. It?s a protective barrier that keeps the data and code safe within the class itself. This way, we can re-use objects like code components or variables without allowing open access to the data system-wide.

Inheritance. This is a special feature of Object Oriented Programming in Java. It lets programmers create new classes that share some of the attributes of existing classes. This lets us build on previous work without reinventing the wheel.

Polymorphism. This Java OOP concept lets programmers use the same word to mean different things in different contexts. One form of polymorphism in Java is method overloading. That?s when different meanings are implied by the code itself. The other form is method overriding. That?s when the different meanings are implied by the values of the supplied variables. See more on this below.

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

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


 Q79. What is the use of second level cache in Hibernate ?Hibernate
Ans. Second level cache is shared between sessions. Hibernate by default uses first level cache. Second level cache need to be configurd to use.
There are several second level cache e.g eh cache,jboss cache etc.

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

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q80. When to use List, Set and Map in JavaCore Java
Ans. I. If we want a Collection that does not store duplicate values, then we use a Set based collection.

II. If we want to frequently access elements operations based on an index value then we use a List based collection. E.g. ArrayList

III. If we want to maintain the insertion order of elements in a collection then we use a List based collection.

IV. For fast search operation based on a key, value pair, we use a HashMap based collection.

V. If we want to maintain the elements in a sorted order, then we use a TreeSet based collection.

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

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q81. What does System.exit() do ?Core Java
Ans. Generally used to indicate termination

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

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q82. What are the benefits of Junits ?Junit
 This question was recently asked at 'Cognizant ( CTS )'.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


 Q83. How you can check Object is created or not in case of Singleton using Object class method ?Design
Ans. Reflections-- setAccesible--avoid using enumns

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

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q84. Explain different inheritance mapping strategies with JPA / Hibernate.Hibernate
Ans. table per hierarchy
table per concrete class
table per sub class

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

   Like         Discuss         Correct / Improve     hibernate mapping  hibernate associations     Asked in 4 Companies


 Q85. How would you securely migrate a database to RDS?Amazon Web Services (AWS)
 This question was recently asked at 'Cognizant (C?TS),Overstock'.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     aws rds  aws database  amazon cloud database     Asked in 2 Companies


 Q86. Describe AWS VPC and subnets.Amazon Web Services (AWS)
Ans. VPC stands for Virtual Private Cloud. You can define a VPC and subnets for a region in AWS and that can be used to access shared resources on the cloud. For eg: API gateway to access any file on S3.

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

   Like         Discuss         Correct / Improve     aws vpc  aws subnets     Asked in 3 Companies


 Q87. What is your experience with AWS EMR ?Amazon Web Services (AWS)
 This question was recently asked at 'Cognizant (CTS)'.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     aws emr     Asked in 1 Companies


 Q88. How many objects are created when we define a bean with two different name in spring?Spring
Ans. we wont create the objects because of each and every bean will be an object

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

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q89. What are different types of Polymorphism in Java ?Core Java
Ans. run time polymorphism
compile time polymorphism

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

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q90. Is String mutable or immutable in Java ?Core Java
Ans. String is Immutable because of String Constant Pool.

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

   Like         Discuss         Correct / Improve          Asked in 1 Companies


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