Capgemini
10+ Interview Questions and Answers
Q1. What is Hash map in java
Hash map is a data structure that stores key-value pairs and allows fast retrieval of values based on keys.
Hash map uses hashing to store and retrieve values based on keys
It allows null values and null keys
It is not synchronized and not thread-safe
Example: HashMap
map = new HashMap<>(); map.put("apple", 1); int value = map.get("apple");
Q2. List all languages in Sql and explain
List of SQL languages and their brief explanation
SQL (Structured Query Language) is a standard language for managing relational databases
T-SQL (Transact-SQL) is a proprietary extension of SQL used by Microsoft SQL Server
PL/SQL (Procedural Language/Structured Query Language) is Oracle Corporation's proprietary extension of SQL
MySQL is an open-source relational database management system that uses SQL
PostgreSQL is an open-source object-relational database management system that...read more
Q3. Super key and foreign key difference
Super key is a set of attributes that uniquely identifies a record, while foreign key is a reference to a primary key in another table.
Super key is a combination of one or more attributes that uniquely identifies a record in a table.
Foreign key is a field in a table that refers to the primary key of another table.
Super key can have additional attributes that are not necessary for uniqueness.
Foreign key establishes a relationship between two tables.
Example: In a database of st...read more
Q4. Memory management and hash map in java
Memory management and hash map are important concepts in Java programming.
Memory management is the process of allocating and deallocating memory in a program.
Java uses automatic memory management through garbage collection.
Hash map is a data structure that stores key-value pairs and uses hashing to retrieve values efficiently.
Java's HashMap class implements the Map interface and provides constant-time performance for basic operations.
It is important to properly manage memory ...read more
Q5. Primary key and candidate key difference
Primary key uniquely identifies a record while candidate key can also uniquely identify a record but may not be chosen as primary key.
Primary key is a column or set of columns that uniquely identifies each record in a table
Candidate key is a column or set of columns that can also uniquely identify each record in a table
A table can have multiple candidate keys but only one primary key
Primary key cannot have null values while candidate key can have null values
Example: In a tabl...read more
Q6. List all languages in sql
List of SQL languages
MySQL
Oracle
PostgreSQL
Microsoft SQL Server
SQLite
Q7. Exception handling in java
Exception handling in Java allows for the handling of errors and exceptions that may occur during program execution.
Java provides try-catch blocks to handle exceptions.
The try block contains the code that may throw an exception.
The catch block catches and handles the thrown exception.
Multiple catch blocks can be used to handle different types of exceptions.
The finally block is optional and is executed regardless of whether an exception occurs or not.
Exceptions can also be thr...read more
Q8. Memory management in java
Memory management in Java involves automatic garbage collection and manual memory allocation.
Java uses automatic garbage collection to free up memory
Developers can manually allocate memory using the 'new' keyword
Java also has a 'finalize' method to clean up resources before garbage collection
Memory leaks can occur if objects are not properly released
Q9. Exceptional handling in java
Exceptional handling in Java is a mechanism to handle runtime errors and prevent program crashes.
Java provides try-catch blocks to handle exceptions
Multiple catch blocks can be used to handle different types of exceptions
Finally block is used to execute code regardless of whether an exception is thrown or not
Q10. Oops concepts in java
Oops concepts are fundamental to Java programming and include inheritance, polymorphism, encapsulation, and abstraction.
Inheritance allows a class to inherit properties and methods from a parent class.
Polymorphism allows objects to take on multiple forms and behave differently based on their context.
Encapsulation hides the implementation details of a class and only exposes necessary information.
Abstraction focuses on the essential features of an object and hides unnecessary d...read more
More about working at Capgemini
Reviews
Interviews
Salaries
Users/Month