Infosys questions
What is the purpose of the @Component annotation
@Component registers a class as a Spring bean, allowing Spring to manage its lifecycle and inject it where needed
What does the @Entity annotation do?
@Entity maps a Java class to a database table, allowing it to be managed by JPA
What is a promise object
A Promise represents an asynchronous operation's eventual completion or failure, allowing you to handle the result with .then and .catch methods
What is a branch
A branch is a separate line of development in a repository, allowing for isolated work on features, fixes, or experiments without affecting the main codebase
Relationship between class and object
A class is a blueprint defining the properties and behaviors, while an object is an instance created from that class
What is the role of a constructor
A constructor initializes a new object, setting initial values for fields or performing setup tasks
What is a retrospective in Agile
A retrospective is a meeting held at the end of a sprint where the team discusses what went well, what could improve, and actionable steps to enhance future sprints
What is a singleton
A singleton is a class pattern that allows only one instance of a class to exist
What is a view in SQL?
A view is a virtual table created by a SELECT query, which provides a way to simplify complex queries, enhance security, and organize data
Are you willing to learn different programming languages
Absolutely, I enjoy learning new languages and tools, and I see adapting to different languages as essential for continuous improvement in software development
Abstract classes vs. interfaces
Abstract classes can have method implementations and cannot be instantiated, while interfaces define only abstract methods (Java 8+ allows default methods) and can be implemented by any class
Tell me about access and non-access modifiers
Access modifiers control visibility (public, private, protected), while non-access modifiers define additional behavior like static, final, and abstract
What is an API?
An API (Application Programming Interface) allows different software applications to communicate, providing a set of rules for accessing services and data
Array vs ArrayList? How to get the length of each
An array has a fixed size accessed by .length; an ArrayList is resizable, accessed by .size()
What is Autowiring?
Autowiring is Spring's mechanism to automatically inject dependencies, using @Autowired to resolve and inject required beans
What is axios? What have you used it for?
Axios is a library for making HTTP requests, used in React to interact with APIs for data retrieval and posting.
What is CI/CD
CI/CD (Continuous Integration and Continuous Deployment) automates building, testing, and deploying code changes, improving code quality and delivery speed
Tell me about the 2 different kinds of exceptions
Checked exceptions are checked at compile-time (e.g., IOException), and unchecked exceptions occur at runtime (e.g., NullPointerException)
What are some examples of checked and unchecked exceptions
Checked: IOException, SQLException; Unchecked: NullPointerException, ArithmeticException
Class Component (old) vs Function Component (modern)
Class components use lifecycle methods and state, while function components rely on hooks for state and side effects, offering simpler, more readable code
Have knowledge of the Collections API (List, Set, Queue, good idea to have an example of a concrete Class for each of these)
Collections API offers structures for data management, with ArrayList (List), HashSet (Set), and LinkedList (Queue)
What Agile processes have you used?
Common Agile processes I've used include Scrum with sprints, daily stand-ups, sprint planning, and retrospectives to ensure continuous improvement
What are some annotations you've used
Common annotations include @Controller, @Service, @Repository (stereotype annotations), @SpringBootApplication (main method annotation), @RestController, @RequestMapping (MVC), @Entity, @Table (JPA)
Describe the function component hooks you've used
Common hooks include useState for managing state, useEffect for side effects, and useContext for accessing context values across components
What Bean Scopes are you aware of
Common scopes include singleton (one instance per Spring container) and prototype (new instance each time requested).
What are components in React
Components are reusable, isolated pieces of UI logic and structure that can be rendered and composed to build an application
How can I remove duplicate elements from a List
Convert the List to a Set to automatically remove duplicates
How do you create a component in React
Define a JavaScript or TypeScript function or class that returns JSX, then export it for use in other parts of the application
How do you handle exceptions
Exceptions are handled using try-catch blocks, where the try block contains code that may throw an exception, and the catch block defines what happens if it does
How do exceptions and errors differ
Exceptions are typically recoverable issues in code, while errors indicate serious problems often beyond the program's control, like OutOfMemoryError
What does GROUP BY do in SQL
GROUP BY groups rows with the same values in specified columns, allowing aggregate functions to operate on each group
Explain what you know about HTML and CSS.
HTML structures web content with tags, while CSS styles and positions the content, allowing for responsive, visually appealing designs
What is HTTP?
HTTP (HyperText Transfer Protocol) is a protocol for data communication on the web, defining how requests and responses are formatted and transmitted
What are HTTP status codes? Example of different types of HTTP status codes
HTTP status codes indicate the result of a request: 200 (Success), 404 (Not Found), 500 (Server Error), with categories like informational (1xx), success (2xx), redirection (3xx), client errors (4xx), and server errors (5xx)
What are HTTP verbs? Example of different types of HTTP verbs
HTTP verbs define the request action: GET (retrieve data), POST (create data), PUT (update data), DELETE (remove data).
HashTable vs HashMap
HashTable is synchronized (thread-safe) and doesn't allow null keys or values, while HashMap is unsynchronized and permits one null key and multiple null values
What does HTML stand for?
HyperText Markup Language
How do you handle team conflict
I approach team conflicts by actively listening to each person's perspective, aiming for solutions that balance team needs and project goals, and focusing on collaboration over personal views
What AWS services have you used?
I've used AWS services like EC2 for virtual servers, S3 for storage, RDS for managed databases, and Lambda for serverless computing
What is your experience with GitHub
I've used GitHub for version control, collaborating on projects, managing code changes, and implementing CI/CD workflows
Briefly describe IaaS, PaaS, SaaS and describe one of them more in-depth
IaaS (Infrastructure as a Service) provides virtualized computing resources, PaaS (Platform as a Service) offers development platforms, and SaaS (Software as a Service) delivers software over the internet; for example, in IaaS, AWS EC2 allows scalable server management with on-demand resources
What is the difference between JDK, JVM, & JRE?
JDK is the development kit for Java, JVM is the virtual machine that runs Java bytecode, and JRE is the runtime environment that provides libraries and the JVM for running Java programs
Java access modifiers
Java has four access modifiers: public, protected, default, and private, which control visibility and access to classes, methods, and variables
What is Java Memory? Describe Stack and Heap
Java memory is divided into Stack (for method calls and local variables) and Heap (for dynamic memory allocation and object storage)
Lambdas/Functional Interfaces
Lambdas provide concise syntax for implementing single-method interfaces, known as functional interfaces
What is method reference syntax
Method references use :: to refer to methods by name, simplifying lambda expressions for single-method calls
Can you send props from child to parent
No, but you can pass a function from parent to child as a prop, allowing the child to send data back to the parent by calling the function
Can we change the order of public static void main
No, the order is fixed for the JVM to recognize it as the main method
What is OOP? Elaborate on the four pillars
OOP (Object-Oriented Programming) is a paradigm based on objects, with four pillars: encapsulation, abstraction, inheritance, and polymorphism
What is an Optional
Optional is a container that may or may not hold a value, used to prevent NullPointerExceptions
Overloading vs Overriding
Overloading is creating methods with the same name but different parameters; overriding redefines a superclass method in a subclass
What is Postman used for?
Postman is a tool for testing APIs, allowing users to create, send, and inspect HTTP requests and responses easily
How do you host projects on AWS?
Projects can be hosted on AWS by deploying code on EC2 instances, setting up S3 for static websites, or using Elastic Beanstalk for application deployment
What is props and state
Props are read-only inputs passed to components from a parent, while state is data managed within a component and can change over time
What is the advantage of using React as opposed to using plain JavaScript frontends
React simplifies complex UI management, improves performance with a virtual DOM, and promotes component-based design for reusable, maintainable code
What is RestTemplate? What does it let us do
RestTemplate is a Spring class for making HTTP requests, allowing us to send and receive data between microservices
How does Routing work in React? How did you create routes
Routing in React is handled by libraries like React Router, where <Route> components define paths and render corresponding components for each route
Know the SOLID design principles
SOLID principles are guidelines for object-oriented design: Single Responsibility, Open-Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion, all promoting scalable and maintainable code
What SQL functions are you aware of? Two different types?
SQL functions include aggregate functions (e.g., SUM, AVG, COUNT) for summarizing data and scalar functions (e.g., UPPER, LOWER, ROUND) for single value operations
Tell me about the different SQL sublanguages. Can you name some operations/statements per each sublanguage?
SQL has five sublanguages: DDL (Data Definition Language) for CREATE, ALTER, DROP; DML (Data Manipulation Language) for INSERT, UPDATE, DELETE; DQL (Data Query Language) for SELECT; DCL (Data Control Language) for GRANT, REVOKE; and TCL (Transaction Control Language) for COMMIT, ROLLBACK
Name and describe some SQL joins
SQL joins include INNER JOIN (matches rows with common keys in both tables), LEFT JOIN (all rows from the left table and matching rows from the right), RIGHT JOIN (all rows from the right table and matching rows from the left), and FULL JOIN (all rows when there's a match in either table)
What are the different scopes in Java
Scopes in Java include class scope (variables in a class), method scope (local variables), block scope (within loops or conditionals), and instance scope (instance variables)
What are Spring Bean Validators?
Spring Bean Validators provide annotations like @NotNull, @Size, etc., for validating bean properties according to constraints
What are Spring Beans
Spring Beans are objects managed by the Spring IoC container, created and wired together by Spring based on configuration
What is Spring Data? What are the JPA annotations
Spring Data simplifies database interactions, with JPA annotations like @Entity (maps a class to a database table) and @Id (marks primary key).
What is Spring Initializr?
Spring Initializr is a tool for creating pre-configured Spring Boot projects, allowing users to specify dependencies and project settings
Describe Spring MVC Controllers
Spring MVC Controllers handle web requests, process them, and return responses, often annotated with @Controller or @RestController
What is Spring? Spring Boot?
Spring is a Java framework for building applications, providing dependency injection, and various services; Spring Boot simplifies Spring by offering auto-configuration and embedded servers
What are streams? Intermediate vs Terminal operations?
Streams process collections with intermediate (filter, map) and terminal operations (forEach, collect), allowing complex data transformations
What is TSX
TSX (TypeScript XML) is a syntax extension for TypeScript in React, similar to JSX but with TypeScript support for type-checking
What is the JIT compiler?
The JIT (Just-In-Time) compiler optimizes Java bytecode at runtime, converting it to native machine code for faster execution
What is the Reflection API
The Reflection API allows inspection and manipulation of classes, methods, and fields at runtime
What is the garbage collector? Can you force garbage collection
The garbage collector automatically frees memory by clearing unused objects; you can suggest collection with System.gc(), but it's not guaranteed
What happens if I don't make the main method static
The program won't run, as the JVM can't call a non-static main method without creating an instance of the class
What does the static keyword do
The static keyword makes a method or variable belong to the class rather than instances of it.
Tell me about the virtual DOM
The virtual DOM is a lightweight, in-memory representation of the real DOM that React uses to efficiently update only necessary parts of the UI
Threads/Runnable
Threads enable parallel processing; Runnable is an interface for classes whose instances are executed by a thread
What is unit testing? How do we do it in Java
Unit testing verifies individual code units, commonly done with frameworks like JUnit in Java
How can I render a list of elements in React
Use .map on an array to create an element for each item, including a key prop for each to help React track items
How would you handle HTTP calls/mappings using Spring
Use @RequestMapping or specific mappings like @GetMapping, @PostMapping, etc., to map HTTP requests to controller methods
How do you create a table in PostgreSQL?
Use CREATE TABLE table_name (column1 data_type, column2 data_type, ...); specifying each column's name and data type
How can I conditionally render content in React
Use JavaScript conditional expressions (if, ternary operators) to determine if certain elements or components should render
How to filter the results of a select? (WHERE clause)
Use SELECT * FROM table_name WHERE condition; where the WHERE clause defines the filtering condition
How to select all from a DB?
Use SELECT * FROM table_name; to retrieve all columns from a table
How do you handle database interactions with Spring Data?
Use Spring Data repositories like CrudRepository or JpaRepository for CRUD operations, with methods autogenerated based on naming conventions
How would you set up a Spring Boot project
Use Spring Initializr to create a project with desired dependencies, or configure it manually with pom.xml (Maven) or build.gradle (Gradle)
How to merge a branch
Use git merge branch_name from the target branch (usually main or master) to integrate changes from another branch, or open a pull request on GitHub
How to compare (equate) 2 objects in Java
Use the .equals() method to compare object contents, and == for reference equality
How can you change a table's columns without dropping and recreating it?
Use the ALTER TABLE statement with options like ADD COLUMN, DROP COLUMN, or MODIFY COLUMN
How do you define foreign keys in PostgreSQL
Use the FOREIGN KEY constraint in CREATE TABLE or ALTER TABLE to link a column to another table, e.g., FOREIGN KEY (column_name) REFERENCES other_table (other_column).
What are Wrapper classes
Wrapper classes in Java convert primitive types into objects (e.g., Integer for int), allowing them to be used in collections and other object-based contexts
Can you implement multiple interfaces in Java? Can you extend multiple classes
You can implement multiple interfaces but can only extend one class due to Java's single inheritance model
What does default do in an interface method
default provides a method implementation within an interface, allowing classes to inherit it directly
What is "export" in React
export allows a component or variable to be accessible from other files by importing it
Difference between final and finally
final is a keyword that prevents modification, while finally is a block that executes after try-catch, regardless of exceptions
Basic Git commands
git push uploads local changes to a remote repository; git pull fetches and merges changes from a remote repository to your local branch
Explain each part of public static void main(String[] args){}
public: accessible anywhere; static: runs without an object; void: returns nothing; main: program entry point; String[] args: command-line arguments