TCS
10+ Campus shoes Interview Questions and Answers
Q1. Java 8 features and stream api example of distinct element in a list
Example of using Java 8 features and stream api to get distinct elements in a list.
Use the distinct() method of the Stream interface to get distinct elements in a list.
The distinct() method returns a stream consisting of the distinct elements of the original stream.
Example: List
list = Arrays.asList("apple", "banana", "apple", "orange"); list.stream().distinct().forEach(System.out::println); Output: apple banana orange
Q2. What is index in DB? What is spring security? What is cloning ? Deep cloning , swallow cloning What is SOLID principles.
Index in DB is a data structure that improves the speed of data retrieval operations on a database table.
Index in DB is used to quickly locate and access the rows in a table based on the values in specific columns.
It helps in optimizing query performance by reducing the number of rows that need to be scanned.
Examples of indexes include primary keys, unique keys, and composite indexes.
Creating indexes on frequently queried columns can significantly improve database performance...read more
Q3. Design patterns used in Microservices
Design patterns used in Microservices
Service Registry Pattern
API Gateway Pattern
Circuit Breaker Pattern
Event Sourcing Pattern
Saga Pattern
Q4. Rest Api Using Spring Boot
Answering the question about Rest Api using Spring Boot
Spring Boot is a popular framework for building RESTful APIs
It provides easy configuration and setup for REST endpoints
Annotations like @RestController and @RequestMapping are used to define endpoints
Spring Boot also includes features like security, caching, and database integration
Example: @GetMapping("/users") public List
getUsers() { return userService.getAllUsers(); }
Q5. How do Microservies talk to eachother
Microservices communicate with each other through APIs and messaging protocols.
Microservices communicate via RESTful APIs, using HTTP requests and responses.
Message brokers like Kafka or RabbitMQ are used for asynchronous communication between microservices.
Service discovery tools like Eureka or Consul help microservices locate and communicate with each other.
Microservices can also communicate through gRPC, a high-performance RPC framework.
Q6. Example of one rest api coding
An example of a REST API coding
Define endpoints and HTTP methods
Implement CRUD operations
Use JSON for data exchange
Handle errors and exceptions
Secure API with authentication and authorization
Q7. Mysql Join difference
MySQL join types and their differences
INNER JOIN returns only matching rows from both tables
LEFT JOIN returns all rows from left table and matching rows from right table
RIGHT JOIN returns all rows from right table and matching rows from left table
FULL OUTER JOIN returns all rows from both tables
CROSS JOIN returns all possible combinations of rows from both tables
Q8. Who is devloper of java?
James Gosling is the developer of Java.
James Gosling developed Java while working at Sun Microsystems in the early 1990s.
Java was originally called Oak and was designed for use in consumer electronics.
Java's popularity grew with the rise of the internet and its ability to run on multiple platforms.
Oracle Corporation acquired Sun Microsystems in 2010 and now owns Java.
Q9. Logging framework used in current project
We are using Log4j2 for logging in the current project.
Log4j2 is a popular logging framework in Java.
It provides support for logging at different levels like DEBUG, INFO, WARN, ERROR, etc.
Configuration can be done through XML, JSON, or properties file.
Example:
org.apache.logging.log4j log4j-api 2.14.1
Q10. How many packages in Java?
There are many packages in Java.
Java has a vast collection of packages for various purposes.
Some commonly used packages are java.lang, java.util, java.io, java.net, etc.
Packages provide a way to organize and reuse code.
Developers can also create their own packages for their projects.
Q11. what is java and new features of java
Java is a popular programming language known for its platform independence and object-oriented approach. New features include modules, var keyword, and more.
Java is a high-level, class-based, object-oriented programming language.
New features in Java include modules for better code organization, the var keyword for type inference, and enhancements in the Java Platform Module System (JPMS).
Java 14 introduced switch expressions, records, and text blocks as new features.
Java 15 a...read more
Q12. What is java?
Java is a high-level, object-oriented programming language used to develop applications for various platforms.
Java is platform-independent and can run on any device with a Java Virtual Machine (JVM)
It is known for its security features and is commonly used for developing web and mobile applications
Java is also used for developing enterprise-level applications and software tools
Examples of popular Java-based frameworks include Spring, Hibernate, and Struts
Q13. What is operater?
An operator is a symbol or keyword used to perform operations on one or more operands in a programming language.
Operators are used to perform mathematical, logical, and comparison operations.
Examples of operators in Java include +, -, *, /, %, ==, !=, <, >, &&, ||, etc.
Unary operators operate on a single operand, while binary operators operate on two operands.
Ternary operator ?: is a conditional operator that takes three operands.
Bitwise operators are used to perform operatio...read more
Q14. 100 of packages in Java.
Java has around 100 packages that provide various functionalities.
Java packages are used to organize related classes and interfaces.
Some commonly used packages are java.lang, java.util, java.io, java.net, etc.
Packages can be imported using the import keyword.
Packages can also be created by the user to organize their own classes and interfaces.
Q15. What is Exceptions?
Exceptions are unexpected events that occur during the execution of a program, disrupting the normal flow of the program.
Exceptions are objects that represent an abnormal condition or error in a program.
They can be caught and handled using try-catch blocks.
Unchecked exceptions do not need to be declared in a method's throws clause, while checked exceptions do.
Examples include NullPointerException, ArrayIndexOutOfBoundsException, and IOException.
Q16. What is Flat Map
FlatMap is a method in Java that transforms each element of a stream into a new stream and then concatenates all the streams into a single stream.
FlatMap is used to flatten nested collections or maps in Java streams.
It is particularly useful when dealing with streams of collections or arrays.
Example: List
- > nestedList = Arrays.asList(Arrays.asList(1, 2), Arrays.asList(3, 4)); nestedList.stream().flatMap(List::stream).forEach(System.out::println);
More about working at TCS
Interview Process at Campus shoes
Top Senior Java Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month