Add office photos
Engaged Employer

NICE

3.6
based on 498 Reviews
Filter interviews by

10+ Cognizant Interview Questions and Answers

Updated 21 May 2024
Popular Designations

Q1. What is diff between ActiveMQ and RabbitMQ

Ans.

ActiveMQ is Java-based messaging broker while RabbitMQ is a message broker that implements the Advanced Message Queuing Protocol (AMQP).

  • ActiveMQ is written in Java and supports multiple messaging protocols like OpenWire, STOMP, MQTT, and AMQP.

  • RabbitMQ is written in Erlang and specifically implements the AMQP protocol.

  • ActiveMQ is more feature-rich and has a larger user base, while RabbitMQ is known for its reliability and performance.

  • ActiveMQ has a more complex setup and confi...read more

Add your answer

Q2. What are databases are present in Azure DB

Ans.

Azure DB offers various databases including SQL Database, Cosmos DB, MySQL, PostgreSQL, and MariaDB.

  • SQL Database

  • Cosmos DB

  • MySQL

  • PostgreSQL

  • MariaDB

Add your answer

Q3. What is default scope of bean in spring ?

Ans.

Singleton

  • Default scope of a bean in Spring is singleton

  • Singleton scope means that only one instance of the bean will be created for each Spring container

  • This is the default scope in Spring, meaning if no scope is specified, the bean will be treated as a singleton

Add your answer

Q4. Why HashSet has default size 16

Ans.

HashSet default size 16 for performance balance between memory usage and lookup time.

  • Default size 16 provides a good balance between memory usage and lookup time.

  • Choosing a power of 2 size helps in distributing elements evenly across buckets.

  • Resizing the HashSet is expensive, so starting with a larger size reduces the need for resizing.

  • Example: If the default size was too small, it would lead to more collisions and degrade performance.

Add your answer
Discover Cognizant interview dos and don'ts from real experiences

Q5. What is map and flat map in Java 8 ?

Ans.

Map and flatMap are methods in Java 8 Stream API used for transforming elements in a stream.

  • Map applies a function to each element in the stream and returns a new stream with the transformed elements.

  • FlatMap applies a function that returns a stream for each element in the original stream, then flattens the result into a single stream.

  • Example: List words = Arrays.asList("hello", "world"); words.stream().map(String::toUpperCase).forEach(System.out::println);

  • Example: List> numbe...read more

Add your answer

Q6. What is microservices architecture

Ans.

Microservices architecture is an architectural style that structures an application as a collection of loosely coupled services.

  • Each service is self-contained and can be developed, deployed, and scaled independently.

  • Services communicate with each other over lightweight protocols like HTTP or messaging queues.

  • Microservices allow for flexibility, scalability, and easier maintenance compared to monolithic architectures.

  • Examples of companies using microservices architecture inclu...read more

Add your answer
Are these interview questions helpful?

Q7. What is JUnit and Mockito

Ans.

JUnit is a unit testing framework for Java, while Mockito is a mocking framework used for creating mock objects in unit tests.

  • JUnit is used for writing and running repeatable automated tests to ensure code behaves as expected.

  • Mockito is used to create mock objects to simulate the behavior of real objects in unit tests.

  • Both JUnit and Mockito are commonly used in test-driven development (TDD) to ensure code quality and reliability.

Add your answer

Q8. Diff between HashSet and HashMap

Ans.

HashSet is a collection of unique elements, while HashMap is a key-value pair collection.

  • HashSet does not allow duplicate elements, HashMap allows duplicate keys but not duplicate values.

  • HashSet uses Set interface, HashMap uses Map interface.

  • Example: HashSet set = new HashSet<>(); HashMap map = new HashMap<>();

Add your answer
Share interview questions and help millions of jobseekers 🌟

Q9. what is BDD and TDD

Ans.

BDD stands for Behavior Driven Development and TDD stands for Test Driven Development.

  • BDD focuses on the behavior of the system from the user's perspective.

  • TDD focuses on writing tests before writing the actual code.

  • BDD uses natural language to describe the behavior of the system.

  • TDD helps in ensuring that the code meets the requirements and is well-tested.

  • Both BDD and TDD help in improving the quality of the software and reducing bugs.

Add your answer

Q10. Internal working of HashMap

Ans.

HashMap is a data structure that stores key-value pairs and uses hashing to quickly retrieve values based on keys.

  • HashMap internally uses an array of linked lists to store key-value pairs.

  • When a key-value pair is added, the key is hashed to determine the index in the array where it will be stored.

  • If multiple keys hash to the same index, a linked list is used to handle collisions.

  • HashMap allows null keys and values, and can have one null key and multiple null values.

  • The load f...read more

Add your answer

Q11. design of some machine

Ans.

Designing a machine involves creating a detailed plan for its structure, functionality, and operation.

  • Consider the purpose of the machine and its intended use

  • Identify the key components and their interactions

  • Create a schematic or blueprint detailing the layout and connections

  • Select appropriate materials and technologies for construction

  • Test the machine for functionality and efficiency

Add your answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos

Interview Process at Cognizant

based on 5 interviews
1 Interview rounds
Technical Round
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Senior Software Engineer Interview Questions from Similar Companies

3.8
 • 30 Interview Questions
3.8
 • 20 Interview Questions
4.0
 • 15 Interview Questions
4.6
 • 14 Interview Questions
3.3
 • 10 Interview Questions
4.8
 • 10 Interview Questions
View all
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
70 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter