Amdocs
10+ Surin Automotive Interview Questions and Answers
Q1. Remove the Kth Node from the End of a Linked List
You are given a singly Linked List with 'N' nodes containing integer data and an integer 'K'. Your task is to delete the Kth node from the end of this Linked Li...read more
Remove the Kth node from the end of a singly linked list.
Traverse the linked list to find the length 'N'.
Calculate the position to delete from the beginning as 'N - K + 1'.
Delete the node at the calculated position.
Handle edge cases like deleting the head or tail node.
Q2. Intersection of Linked List Problem
You are provided with two singly linked lists containing integers, where both lists converge at some node belonging to a third linked list.
Your task is to determine the data...read more
Find the node where two linked lists merge
Traverse both lists to find their lengths and the difference in lengths
Move the pointer of the longer list by the difference in lengths
Traverse both lists simultaneously until they meet at the merging node
Q3. Merge Two Sorted Linked Lists Problem Statement
You are provided with two sorted linked lists. Your task is to merge them into a single sorted linked list and return the head of the combined linked list.
Input:...read more
Merge two sorted linked lists into a single sorted linked list with linear time complexity and constant space usage.
Create a dummy node to start the merged list
Compare the values of the two linked lists and add the smaller value to the merged list
Move the pointer of the merged list and the pointer of the smaller value list forward
Continue this process until one of the lists is fully traversed
Append the remaining elements of the other list to the merged list
Return the head of ...read more
Q4. LRU Cache Design Question
Design a data structure for a Least Recently Used (LRU) cache that supports the following operations:
1. get(key)
- Return the value of the key if it exists in the cache; otherwise, re...read more
Design a Least Recently Used (LRU) cache data structure that supports get and put operations with capacity constraint.
Implement a doubly linked list to keep track of the order of keys based on their recent usage.
Use a hashmap to store key-value pairs for quick access and update.
When capacity is reached, evict the least recently used item before inserting a new item.
Java is platform-independent because the code is compiled into bytecode which can run on any platform with a JVM, making the JVM platform-dependent.
Java code is compiled into bytecode, which is a platform-independent intermediate code
The JVM interprets and executes the bytecode on different platforms
The JVM acts as a layer of abstraction between the Java code and the underlying platform
The JVM is platform-dependent because it needs to be implemented specifically for each plat...read more
The life cycle of a thread in Java involves creation, running, waiting, and termination.
A thread is created using the 'new' keyword or by implementing the Runnable interface.
The thread starts running when the start() method is called.
During execution, a thread can enter a waiting state using methods like sleep() or wait().
A thread terminates when its run() method completes or when the stop() method is called.
DELETE removes specific rows from a table, while TRUNCATE removes all rows and resets auto-increment values.
DELETE is a DML command, while TRUNCATE is a DDL command.
DELETE can be rolled back, while TRUNCATE cannot be rolled back.
DELETE triggers delete triggers, while TRUNCATE does not trigger them.
DELETE is slower as it logs individual row deletions, while TRUNCATE is faster as it logs the deallocation of the data pages.
Example: DELETE FROM table_name WHERE condition; TRUNCAT...read more
Garbage collector in Java is a built-in mechanism that automatically manages memory by reclaiming unused objects.
Garbage collector runs in the background to reclaim memory from objects that are no longer in use.
It helps prevent memory leaks and optimize memory usage.
Examples of garbage collectors in Java include Serial, Parallel, CMS, G1, and Z Garbage Collectors.
Railway Reservation System for booking train tickets
Create a database to store train schedules, seat availability, and passenger information
Develop a user interface for customers to search for trains, select seats, and make payments
Implement a booking system to reserve seats and generate tickets
Include features like seat selection, cancellation, and ticket printing
Ensure security measures for payment processing and data protection
Q10. For insertion and deletion which list u use?why?
I use LinkedList for insertion and deletion as it provides constant time complexity.
LinkedList provides constant time complexity for insertion and deletion operations.
ArrayList provides linear time complexity for these operations.
LinkedList is preferred when frequent insertion and deletion operations are required.
ArrayList is preferred when frequent access to elements is required.
Q11. FindNon duplicate element in string prog?
Finding non-duplicate element in a string program.
Iterate through the string and count the occurrence of each character.
Return the first character with count 1.
If no such character found, return null or -1.
Q12. Association means what?
Association refers to a relationship between two or more objects where they are connected or linked in some way.
Association is a fundamental concept in object-oriented programming.
It is used to represent a relationship between two or more objects.
The relationship can be one-to-one, one-to-many, or many-to-many.
For example, a car has an association with its engine, as it cannot function without it.
Another example is a student having an association with a school, as they attend...read more
Q13. Diff between truncate and delete
Truncate removes all data from a table while delete removes specific rows.
Truncate is faster than delete as it doesn't log individual row deletions.
Truncate cannot be rolled back while delete can be.
Truncate resets the identity of the table while delete doesn't.
Truncate doesn't fire triggers while delete does.
Q14. Write query to delete record
Query to delete record in SQL
Use DELETE statement with WHERE clause to specify the record to be deleted
Make sure to backup data before deleting
Example: DELETE FROM table_name WHERE column_name = value;
Q15. Prog merge two list
Merging two lists in Java
Create a new list to hold the merged result
Iterate through both lists and compare elements
Add the smaller element to the new list and move to the next element in that list
Repeat until all elements have been added to the new list
Return the new merged list
Top Senior Java Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month