SQL / DBMS

Question Solution
1. Write a query for update. sql UPDATE table_name SET column1 = value1, column2 = value2, ... WHERE condition;
2. SQL joins. Write a query for inner join. sql SELECT columns FROM table1 INNER JOIN table2 ON table1.common_column = table2.common_column;
3. What are joins and types? Joins combine rows from two or more tables. Types: INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL OUTER JOIN.
4. Outer joins. Combines rows from two or more tables and includes unmatched rows: LEFT JOIN, RIGHT JOIN, FULL OUTER JOIN.
5. What is union? Combines the results of two or more SELECT queries: sql SELECT column1, column2 FROM table1 UNION SELECT column1, column2 FROM table2;
6. What is SQL? SQL (Structured Query Language) is used for managing and manipulating databases.
7. Why we use database? Databases store, retrieve, and manage data efficiently and securely.
8. How to communicate with database? Through SQL commands, APIs, or database management tools.
9. Inner join. Returns records with matching values in both tables: sql SELECT columns FROM table1 INNER JOIN table2 ON table1.common_column = table2.common_column;
10. Self join. Joins a table with itself: sql SELECT a.column_name, b.column_name FROM table1 a, table1 b WHERE condition;
11. @JoinColumn, CascadeTypes. @JoinColumn specifies the column for joining; CascadeTypes define cascade operations (e.g., ALL, PERSIST, MERGE).
12. Joins and Types of joins. Types: INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL OUTER JOIN, SELF JOIN.
13. MySQL query: (FindById, FindAll, Where Condition) sql SELECT * FROM table_name WHERE id = value; SELECT * FROM table_name; SELECT * FROM table_name WHERE condition;
14. Difference between delete and truncate. DELETE: removes rows based on condition, can be rolled back. TRUNCATE: removes all rows, cannot be rolled back.
15. CRUD operations. CRUD: Create (INSERT), Read (SELECT), Update (UPDATE), Delete (DELETE).

Java / OOPS

Question Solution
1. OOPS - four types and explain in detail. Types: Encapsulation, Inheritance, Polymorphism, Abstraction.
2. ArrayList. Dynamic array that can grow as needed. java ArrayList<String> list = new ArrayList<>();
3. OOPS implementation in your project. Example: using classes, objects, inheritance, and polymorphism.
4. HashMap. Key-value pair collection. java HashMap<Integer, String> map = new HashMap<>();
5. Sets. Collection that does not allow duplicate elements. java Set<String> set = new HashSet<>();
6. Java 8 and 11 features. Java 8: Lambda expressions, Stream API. Java 11: Local-variable syntax for lambda parameters, HTTP Client API.
7. Exceptions: checked and unchecked exceptions, and asked to write a sample logic for it. Checked: IOException. Unchecked: NullPointerException. java try { // code } catch (Exception e) { // handler }
8. Try and CatchException: explain and example. try block contains code that might throw an exception. catch block handles the exception. java try { // code } catch (Exception e) { // handler }
9. Write one simple exception handling code in notepad. java try { int num = Integer.parseInt("abc"); } catch (NumberFormatException e) { System.out.println("Number format exception"); }
10. Difference between Class and Interface. Class: blueprint of objects. Interface: abstract type that is implemented by classes.
11. Method Overloading vs Method Overriding. Overloading: multiple methods with same name, different parameters. Overriding: subclass method with same name and parameters as superclass.
12. What is exception handling and how to handle exceptions and errors? Mechanism to handle runtime errors using try, catch, finally, and throw.
13. Lambda functions. Anonymous functions for simplifying code. java (a, b) -> a + b;
14. What is polymorphism and example? Ability of an object to take many forms. Example: method overriding.
15. What is inheritance? Mechanism where one class inherits properties and behavior from another.
16. How do we achieve polymorphism? Through method overriding and interfaces.
17. Use of exception handling in real-time scenario. Handling user input errors, file I/O operations.
18. How do we achieve interface? By implementing it in a class. java class MyClass implements MyInterface { // code }
19. Access specifier. Keywords that define access level: private, protected, public, default.
20. Method overriding and overloading. Overriding: same method signature in subclass. Overloading: same method name, different parameters.
21. In Java which class is final (String class)? String class is final, cannot be extended.
22. Stream API, Lambda function. Stream API: for processing sequences of elements. Lambda function: anonymous function.
23. Collections. Framework for data structure manipulation: List, Set, Map.
24. Difference between ArrayList and HashSet. ArrayList: allows duplicates, ordered. HashSet: no duplicates, unordered.
25. List vs ArrayList vs HashSet. List: ordered collection. ArrayList: resizable array implementation of List. HashSet: no duplicates, unordered.
26. HashSet vs Set. HashSet: implementation of Set, no duplicates, unordered. Set: interface.
27. Which collection is used to remove duplicates and how? HashSet removes duplicates by nature. java Set<String> set = new HashSet<>(list);
28. Array vs ArrayList. Array: fixed size, static. ArrayList: dynamic size.
29. How to compare two objects. Using equals() method. java obj1.equals(obj2);
30. Definition of Class and Object. Class: blueprint. Object: instance of a class.

Software Engineering

Question Solution
1. About SDLC. Software Development Life Cycle: stages of software creation from planning to maintenance.
2. SDLC life cycle - waterfall model, agile model. Waterfall: sequential, each phase completed before next. Agile: iterative, incremental development.
3. Your project following which model (Agile model). Agile: flexible, iterative process.

Spring

Angular

Column 1 Column 2
1. What is .ts file? A .ts file is a TypeScript file. TypeScript is a superset of JavaScript that adds static types, making it easier to write and maintain code. Angular applications are typically written in TypeScript.
2. Explain Angular workflow. The Angular workflow involves creating components, services, and modules, then connecting them through templates and routing. Data flows through the application using dependency injection and observables, with Angular's change detection handling updates to the DOM.
3. What is ngOnInit? ngOnInit is a lifecycle hook in Angular. It is called after Angular has initialized all data-bound properties of a directive. It's a good place to put initialization logic for the component.
4. What is @Component? @Component is a decorator in Angular that marks a class as an Angular component and provides metadata about the component, such as its selector, template, and styles.
5. How to install Angular? Angular can be installed using the Angular CLI. First, install Node.js and npm, then run npm install -g @angular/cli to install the Angular CLI globally.
6. How you have created Angular project in workspace? An Angular project can be created in a workspace by using the Angular CLI command: ng new project-name. This sets up a new Angular project with the necessary configuration and dependencies.
7. What is Observable and why is it used? An Observable is a data type that represents a stream of data that can be observed over time. It is used in Angular for handling asynchronous data, such as HTTP requests, event handling, and more.
8. Add the data using frontend and show me the data in database tables. To add data using the frontend, create a form in an Angular component and bind it to a model. Use Angular services to send HTTP POST requests to the backend API. The backend will handle storing the data in the database tables.
9. What is a Subscribe()? Why are you using this? subscribe() is a method used with Observables to receive the emitted values. It is used to handle the asynchronous data stream and execute logic when new data is available.
10. Why we are using injectable in service? @Injectable decorator is used in Angular services to make the service available for dependency injection. It allows Angular to inject the service into components or other services.
11. Difference between TS and JS. TypeScript (TS) is a superset of JavaScript (JS) that includes static types, interfaces, and other features that help catch errors at compile-time. JavaScript is a dynamically-typed scripting language used for web development.
12. Observable vs Subscribe. Observable represents the data stream, while subscribe() is the method used to listen to the data emitted by the Observable. Observables are lazy and only produce data when there is a subscriber.
13. Explain how component is created in Angular. A component in Angular is created using the @Component decorator. The class is defined, and metadata such as the template, selector, and styles are provided using the @Component decorator.
14. What are files created in component? Common files created in a component include: component.ts (TypeScript logic), component.html (template), component.css/scss (styles), and component.spec.ts (unit tests).
15. What is CSS, HTML, TS? CSS (Cascading Style Sheets) is used for styling web pages. HTML (Hypertext Markup Language) is used for structuring web content. TS (TypeScript) is a superset of JavaScript that adds static typing and other features.
16. Why we use validators? Validators are used in Angular forms to ensure that user input meets certain criteria, such as required fields, minimum or maximum lengths, and patterns. They help maintain data integrity and provide user feedback.
17. Perform delete operations in Angular. To perform delete operations, create a method in the Angular service that sends an HTTP DELETE request to the backend API. Call this method from the component, passing the ID of the item to be deleted. Update the frontend to reflect the deletion.