Add office photos
Engaged Employer

Wissen Technology

3.9
based on 471 Reviews
Filter interviews by

100+ Noorain Engineering systems. Santhapuram Village, chinnaelasagiri. Hosur. Interview Questions and Answers

Updated 21 Jan 2025
Popular Designations

Q1. Parent class has run() and walk() . Parent run() - calls walk() Child Class overrides Parent class Inside run() - calls super.run() Walk() - calls super.walk In main class Parent p = new child() p.run() What wi...

read more
Ans.

The order of execution will be: parent's run() -> child's run() -> parent's walk()

  • When p.run() is called, it will first execute the run() method of the parent class

  • Inside the parent's run() method, it will call the walk() method of the parent class

  • Since the child class overrides the parent class, the child's run() method will be executed next

  • Inside the child's run() method, it will call the run() method of the parent class using super.run()

  • Finally, the walk() method of the pa...read more

View 4 more answers

Q2. 2. What will happen if hashcode only returns a constant? How will it affect the internal working of the HashMap?

Ans.

If hashcode returns a constant, all elements will be stored in the same bucket, resulting in poor performance.

  • All elements will be stored in the same bucket of the HashMap.

  • This will lead to poor performance as the HashMap will essentially become a linked list.

  • Retrieving elements will take longer as the HashMap will have to iterate through the linked list to find the desired element.

View 2 more answers

Q3. How to sort a list of students on the basis of their First name?

Ans.

To sort a list of students on the basis of their First name, use the Collections.sort() method with a custom Comparator.

  • Create a custom Comparator that compares the first names of the students.

  • Implement the compare() method in the Comparator to compare the first names.

  • Use the Collections.sort() method to sort the list of students using the custom Comparator.

View 5 more answers

Q4. Write a program to return the length of the longest word from a string whose length is even?

Ans.

This program returns the length of the longest word from a string whose length is even.

  • Split the string into an array of words using a space as the delimiter.

  • Iterate through the array and check if the length of each word is even.

  • Keep track of the length of the longest even word encountered.

  • Return the length of the longest even word.

View 3 more answers
Discover Noorain Engineering systems. Santhapuram Village, chinnaelasagiri. Hosur. interview dos and don'ts from real experiences

Q5. 5. If we have a mutable object inside immutable class then how will you handle it?

Ans.

To handle a mutable object inside an immutable class, make the object private and provide only read-only access methods.

  • Make the mutable object private to encapsulate it within the immutable class.

  • Provide read-only access methods to retrieve the state of the mutable object.

  • Ensure that the mutable object cannot be modified from outside the class.

  • If necessary, create defensive copies of the mutable object to prevent unintended modifications.

View 2 more answers

Q6. 1. Can we keep an object of a Class as key in HashMap?

Ans.

Yes, we can keep an object of a Class as a key in HashMap.

  • The key in a HashMap can be any non-null object.

  • The key's class must override the hashCode() and equals() methods for proper functioning.

  • If two objects have the same hashCode(), they will be stored in the same bucket and compared using equals().

  • If the key is mutable, its state should not be modified after it is used as a key in the HashMap.

View 2 more answers
Are these interview questions helpful?

Q7. Write a query to find name of authors who have written more than 10 books. Table - Bookauthhor Column - Book Column - Author

Ans.

Query to find authors who have written more than 10 books

  • Use the GROUP BY clause to group the records by author

  • Use the HAVING clause to filter the groups with a count greater than 10

  • Join the Bookauthor table with the Author table to get the author names

View 3 more answers

Q8. 3. What if we do not override Equals method ? What is we do not override Hashcode method?

Ans.

Not overriding equals method can lead to incorrect comparison of objects. Not overriding hashCode method can lead to incorrect behavior in hash-based data structures.

  • If equals method is not overridden, the default implementation from Object class will be used which compares object references.

  • This can lead to incorrect comparison of objects where two different objects with same content are considered unequal.

  • If hashCode method is not overridden, the default implementation from...read more

View 1 answer
Share interview questions and help millions of jobseekers 🌟

Q9. Using Java 8 find the sum of squares of all the odd numbers in the arraylist.

Ans.

Using Java 8, find the sum of squares of all the odd numbers in the arraylist.

  • Use the stream() method to convert the ArrayList to a stream

  • Use the filter() method to filter out the even numbers

  • Use the mapToInt() method to square each odd number

  • Use the sum() method to find the sum of the squared odd numbers

View 1 answer

Q10. 6. Advantages and Disadvantages of immutable class?

Ans.

Immutable classes have advantages like thread safety, security, and simplicity, but also have disadvantages like memory usage and performance overhead.

  • Advantages of immutable classes:

  • - Thread safety: Immutable objects can be safely shared among multiple threads without the need for synchronization.

  • - Security: Immutable objects cannot be modified, which can prevent unauthorized changes to sensitive data.

  • - Simplicity: Immutable objects are easier to reason about and debug since...read more

View 1 answer

Q11. 4. How to make a class immutable?

Ans.

To make a class immutable, we need to ensure that its state cannot be modified after creation.

  • Make all fields private and final

  • Do not provide any setters

  • Ensure that mutable objects are not returned from methods

  • Make the class final or use a private constructor

  • Consider using defensive copying

Add your answer

Q12. How to create Thread in Java and What are the ways?

Ans.

Threads in Java allow concurrent execution of multiple tasks. They can be created in multiple ways.

  • Using the Thread class

  • Implementing the Runnable interface

  • Using the Executor framework

  • Using the Callable interface with ExecutorService

Add your answer

Q13. Write a Java program using multithreading to print below output: n=10 Thread-1 : 1 Thread-2 : 2 Thread-3 : 3 Thread-1 : 4 Thread-2 : 6 . . Thread-1 : 10

Ans.

A Java program using multithreading to print numbers from 1 to 10 in a specific pattern.

  • Create three threads and assign them to print numbers in a specific pattern

  • Use synchronization to ensure the correct order of printing

  • Use a loop to iterate from 1 to 10 and assign the numbers to the threads

  • Print the thread name and the assigned number in the desired format

Add your answer

Q14. Object level Lock vs Class level lock?

Ans.

Object level lock is used to synchronize access to an instance method or block, while class level lock is used to synchronize access to a static method or block.

  • Object level lock is acquired on a per-object basis, while class level lock is acquired on a per-class basis.

  • Object level lock is useful when multiple threads are accessing the same instance method or block, while class level lock is useful when multiple threads are accessing the same static method or block.

  • Object lev...read more

Add your answer

Q15. Do you have location constraints?

Ans.

No location constraints.

  • I am open to working in any location.

  • I am willing to relocate if required.

  • I do not have any personal or family commitments that tie me to a specific location.

Add your answer

Q16. How can one create an immutable class named Employee with fields for name and hobbies defined as List?

Ans.

To create an immutable class named Employee with fields for name and hobbies defined as List<String>, use private final fields and return new instances in getters.

  • Use private final fields for name and hobbies in the Employee class

  • Provide a constructor to initialize the fields

  • Return new instances or unmodifiable lists in the getters to ensure immutability

Add your answer

Q17. What is Serialization?

Ans.

Serialization is the process of converting an object into a stream of bytes to store or transmit it over a network.

  • Serialization is used to save the state of an object and recreate it later.

  • It is also used to send objects over a network as a byte stream.

  • Java provides Serializable interface to implement serialization.

  • Serialization can be used for deep cloning of objects.

  • Example: Saving an object to a file or sending it over a network.

Add your answer

Q18. Synchronized Map vs Concurrent hashmap

Ans.

Synchronized Map is thread-safe but slower, while Concurrent HashMap is faster but not entirely thread-safe.

  • Synchronized Map locks the entire map during write operations, causing other threads to wait.

  • Concurrent HashMap allows multiple threads to read and write simultaneously, using a lock-free approach.

  • Synchronized Map is useful for small maps or low-concurrency scenarios.

  • Concurrent HashMap is better suited for large maps or high-concurrency scenarios.

  • Example: Synchronized M...read more

View 1 answer

Q19. What is a HashMap in Java, and how does it function internally?

Ans.

HashMap in Java is a data structure that stores key-value pairs and uses hashing to efficiently retrieve values.

  • HashMap is part of the Java Collections framework.

  • It allows null keys and values.

  • Internally, it uses an array of linked lists to handle collisions.

  • The key's hash code is used to determine the index in the array where the key-value pair is stored.

  • Example: HashMap<String, Integer> map = new HashMap<>(); map.put("key", 123); int value = map.get("key");

Add your answer

Q20. What changes are required in the Employee class to use it as a key for a HashMap?

Ans.

Add hashCode() and equals() methods to Employee class.

  • Override hashCode() method to generate a unique hash code for each Employee object.

  • Override equals() method to compare Employee objects based on their attributes.

  • Ensure that the attributes used in hashCode() and equals() methods are immutable.

  • Example: Add id, name, and department attributes to Employee class and override hashCode() and equals() methods based on these attributes.

Add your answer

Q21. What are the SOLID principles in software design, and can you provide examples for each?

Ans.

SOLID principles are a set of five design principles in object-oriented programming to make software more maintainable, flexible, and scalable.

  • Single Responsibility Principle (SRP) - A class should have only one reason to change. Example: A class that handles user authentication should not also handle database operations.

  • Open/Closed Principle (OCP) - Software entities should be open for extension but closed for modification. Example: Using interfaces to allow for adding new f...read more

Add your answer

Q22. What is the concept of Object-Oriented Programming (OOP) and can you provide an example?

Ans.

OOP is a programming paradigm based on the concept of objects, which can contain data in the form of fields and code in the form of procedures.

  • OOP focuses on creating objects that interact with each other to solve a problem.

  • Encapsulation is a key concept in OOP, where data is kept within an object and only accessible through its methods.

  • Inheritance allows objects to inherit attributes and methods from parent classes.

  • Polymorphism enables objects to be treated as instances of t...read more

Add your answer

Q23. What is the difference between string literals and the string pool?

Ans.

String literals are constant strings defined in code, while the string pool is a memory area where unique string objects are stored.

  • String literals are created using double quotes, while string pool objects are created using the 'new' keyword.

  • String literals are stored in the string pool to conserve memory and improve performance.

  • String literals are automatically interned by the JVM, while string pool objects need to be explicitly interned to be added to the pool.

Add your answer

Q24. What is the program to print the 90-degree rotated view of a 2D array?

Ans.

Program to print the 90-degree rotated view of a 2D array.

  • Iterate through each column in reverse order and print the corresponding row elements.

  • Repeat this process for all columns to get the rotated view of the 2D array.

Add your answer

Q25. How to detect a loop into LinkedList?

Ans.

To detect a loop in a LinkedList, we can use the Floyd's cycle-finding algorithm.

  • Initialize two pointers, slow and fast, both pointing to the head of the LinkedList.

  • Move slow pointer by one step and fast pointer by two steps at a time.

  • If there is a loop, the slow and fast pointers will eventually meet.

  • If either of the pointers reaches the end of the LinkedList, there is no loop.

Add your answer

Q26. What will happen if you start a thread which is already running

Ans.

The thread will continue running as it is already active

  • The thread will not be started again if it is already running

  • Attempting to start a thread that is already running will not have any effect

  • The thread will continue its execution without any interruption

View 1 answer

Q27. Difference between Callable and Runnable Class?

Ans.

Callable and Runnable are interfaces in Java used for concurrent programming. Callable returns a result and can throw an exception, while Runnable does not return a result or throw an exception.

  • Callable is a generic interface with a method called 'call()', while Runnable is a functional interface with a method called 'run()'.

  • Callable can return a result using the 'Future' interface, while Runnable cannot.

  • Callable can throw checked exceptions, while Runnable cannot.

  • Callable is...read more

Add your answer

Q28. What is the implementation of the singleton design pattern?

Ans.

Singleton design pattern ensures a class has only one instance and provides a global point of access to it.

  • Create a private static instance of the class within the class itself.

  • Provide a public static method to access the instance, creating it if necessary.

  • Ensure the constructor of the class is private to prevent instantiation from outside the class.

  • Use lazy initialization to create the instance only when needed.

  • Thread safety should be considered when implementing the singlet...read more

Add your answer

Q29. How do threads communicate with each other in Java?

Ans.

Threads communicate in Java through shared memory or message passing.

  • Threads can communicate through shared variables in memory.

  • Threads can communicate through synchronized methods or blocks.

  • Threads can communicate through wait(), notify(), and notifyAll() methods.

  • Threads can communicate through message passing using classes like BlockingQueue or ExecutorService.

Add your answer

Q30. What is the contract between hashCode and equals method?

Ans.

The contract between hashCode and equals method is that if two objects are equal according to the equals method, then their hash codes must also be equal.

  • hashCode and equals method must be consistent - if two objects are equal according to equals method, their hash codes must be equal

  • If two objects have the same hash code, they may or may not be equal according to equals method

  • Overriding equals method in a class requires overriding hashCode method as well to maintain the cont...read more

View 1 answer

Q31. One sql query to find the highest salary from each department from Employee database.

Ans.

Use SQL query to find highest salary from each department in Employee database.

  • Use GROUP BY clause to group results by department.

  • Use MAX() function to find highest salary in each group.

  • Join Employee table with Department table to get department information.

Add your answer

Q32. Write a javascript function which returns maximum and minimum occurrence of letter from string

Ans.

A javascript function to find the maximum and minimum occurrence of a letter in a string.

  • Create an object to store the count of each letter in the string

  • Loop through the string and update the count in the object

  • Find the maximum and minimum count in the object and return the corresponding letters

Add your answer

Q33. Implement a custom stack that allows fetching the minimum element in constant time, O(1).

Ans.

Custom stack with constant time access to minimum element

  • Use two stacks - one to store elements and another to store minimum values

  • When pushing an element, compare with top of min stack and push the smaller value

  • When popping an element, pop from both stacks

  • Access minimum element in O(1) time by peeking at top of min stack

Add your answer

Q34. Convert String camel case to snake case.

Ans.

Converts a camel case string to snake case.

  • Split the string by uppercase letters

  • Convert each word to lowercase

  • Join the words with underscores

Add your answer

Q35. What is immutable class how can we create it?

Ans.

An immutable class is a class whose objects cannot be modified after they are created.

  • To create an immutable class, make the class final so that it cannot be extended.

  • Make all the fields private and final, so they cannot be modified.

  • Do not provide any setter methods, only provide getter methods.

  • If the class contains mutable objects, make sure to return a copy of the object instead of the original.

  • Ensure that the class does not have any methods that can modify its state.

Add your answer

Q36. Reverse the list node with head node having multiple values.

Ans.

Reverse a list node with multiple values in Java.

  • Create a new linked list to store the reversed nodes.

  • Traverse the original list and add each node to the front of the new list.

  • Update the head node of the original list to point to the new list.

Add your answer

Q37. Find highest salaried emp from each dept

Ans.

Use SQL query to group by department and find employee with highest salary in each department

  • Write a SQL query to group by department and select max salary for each department

  • Join the result with employee table to get employee details

  • Example: SELECT dept, emp_name, MAX(salary) FROM employees GROUP BY dept

Add your answer

Q38. what are the ways to create the threads and all

Ans.

There are two ways to create threads in Java: by extending the Thread class or by implementing the Runnable interface.

  • Extending the Thread class: Create a new class that extends the Thread class and override the run() method.

  • Implementing the Runnable interface: Create a new class that implements the Runnable interface and implement the run() method.

  • Example using Thread class: MyThread extends Thread { public void run() { // thread logic } }

  • Example using Runnable interface: My...read more

Add your answer

Q39. What are the ways to start a thread

Ans.

Ways to start a thread in Java

  • Extending the Thread class and overriding the run() method

  • Implementing the Runnable interface and passing it to a Thread object

  • Using a thread pool from the Executors class

Add your answer

Q40. Write a program to reverse a linked list.

Ans.

Program to reverse a linked list

  • Create a new linked list to store the reversed elements

  • Traverse the original linked list and insert each node at the beginning of the new list

  • Update the head of the new list as the last node of the original list

Add your answer

Q41. Locking mechanism in multithreading

Ans.

Locking mechanism in multithreading is used to control access to shared resources by multiple threads.

  • Locks are used to prevent multiple threads from accessing shared resources simultaneously

  • Types of locks include synchronized blocks, ReentrantLock, and ReadWriteLock

  • Locks help prevent race conditions and ensure data consistency in multithreaded applications

Add your answer

Q42. Give a list of cards, sort on the basis of their rank and suit.

Ans.

Sort a list of cards based on their rank and suit.

  • Create a custom sorting function that first sorts by rank and then by suit

  • Use a comparison function to compare ranks and suits of each card

  • Example: ['2H', '3D', '10S', 'AH', '4C'] should be sorted as ['2H', '3D', '4C', '10S', 'AH']

Add your answer

Q43. sorting in the string

Ans.

Sorting strings in an array

  • Use Arrays.sort() method to sort the array of strings

  • You can also use a custom Comparator to define the sorting criteria

  • Remember that sorting is case-sensitive by default

Add your answer

Q44. priority queue in the array

Ans.

Priority queue can be implemented using an array by maintaining the order of elements based on their priority.

  • Maintain the order of elements in the array based on their priority level.

  • When adding elements, insert them in the correct position to maintain the priority order.

  • When removing elements, remove the element with the highest priority first.

  • Example: ["High Priority", "Low Priority", "Medium Priority"]

Add your answer

Q45. Different ways to create a thread

Ans.

Ways to create a thread in Java include extending the Thread class, implementing the Runnable interface, and using Java 8's lambda expressions.

  • Extend the Thread class and override the run() method

  • Implement the Runnable interface and pass it to a Thread object

  • Use Java 8's lambda expressions with the Executor framework

Add your answer

Q46. Nested array objects to single array.

Ans.

Convert nested array objects to single array of strings.

  • Iterate through the nested arrays and flatten them into a single array.

  • Use recursion to handle multiple levels of nesting.

  • Example: [["a", "b"], ["c", "d"]] -> ["a", "b", "c", "d"]

Add your answer

Q47. Postmortem of Hashmap

Ans.

Hashmap postmortem involves analyzing performance, memory usage, collisions, and resizing.

  • Analyze performance: Check for time complexity of operations like get, put, and remove.

  • Memory usage: Evaluate memory footprint and potential memory leaks.

  • Collisions: Investigate collision resolution strategies like separate chaining or open addressing.

  • Resizing: Examine load factor and rehashing process for efficient resizing.

  • Example: Identify bottlenecks in a large-scale application usin...read more

Add your answer

Q48. write a program to merge 2 sorted list with n+m complexity

Ans.

Merge two sorted lists with n+m complexity

  • Create a new list to store the merged result

  • Iterate through both lists simultaneously and compare elements

  • Add the smaller element to the new list and move to the next element in that list

  • Continue until all elements from both lists are merged

Add your answer

Q49. Explain about the join and sleep method

Ans.

Join method is used to wait for a thread to finish its execution, while sleep method is used to pause the execution of a thread for a specified amount of time.

  • Join method is used to wait for a thread to finish its execution before moving on to the next task.

  • Sleep method is used to pause the execution of a thread for a specified amount of time, allowing other threads to run.

  • Example: thread1.join() will wait for thread1 to finish before continuing with the execution.

  • Example: Th...read more

Add your answer

Q50. 1. Write a program to split array on given split size.

Ans.

A program to split an array of strings into smaller arrays based on a given split size.

  • Iterate through the array and create a new subarray every split size elements

  • Use array slicing or a loop to extract the subarrays

  • Handle cases where the split size is larger than the array length

Add your answer

Q51. 2. Write a program to flatten multi dimension Object[] array to Integer[]

Ans.

Program to flatten multi dimension Object[] array to Integer[]

  • Use recursion to iterate through the array and flatten each element

  • Check if each element is an array or an integer

  • If it's an array, recursively flatten it

  • If it's an integer, add it to the result array

Add your answer

Q52. design a deck of card and tell who is the higher bidder

Ans.

Design a deck of cards and determine the higher bidder

  • Design a deck of 52 cards with 4 suits (hearts, diamonds, clubs, spades) and 13 ranks (2-10, J, Q, K, A)

  • Assign a value to each rank (e.g. 2 = 2, 3 = 3, ..., J = 11, Q = 12, K = 13, A = 14)

  • Determine the higher bidder based on the rules of the game being played (e.g. highest card wins, poker hand rankings, etc.)

Add your answer

Q53. Merger two sorted array,

Ans.

Merge two sorted arrays into a single sorted array.

  • Create a new array with the combined length of the two input arrays

  • Use two pointers to iterate through the two input arrays and compare elements

  • Add the smaller element to the new array and move the pointer for that array forward

  • Repeat until all elements from both arrays are added to the new array

Add your answer

Q54. What are JOINS in MySql

Ans.

JOINS in MySql are used to combine rows from two or more tables based on a related column between them.

  • JOINS are used to retrieve data from multiple tables based on a related column

  • Types of JOINS include INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN

  • Example: SELECT * FROM table1 INNER JOIN table2 ON table1.column = table2.column

Add your answer

Q55. Internal implementation of hashmap.

Ans.

HashMap is internally implemented using an array of linked lists.

  • HashMap uses an array to store key-value pairs

  • Each array index is called a bucket

  • Each bucket can store multiple key-value pairs using a linked list

  • Hashing is used to determine the index of the array for a given key

  • If multiple keys hash to the same index, they are stored in the same bucket

Add your answer

Q56. How to use custom object as a key in HashMap?

Ans.

To use a custom object as a key in HashMap, override hashCode() and equals() methods in the custom object class.

  • Override hashCode() method to generate a unique hash code for the custom object.

  • Override equals() method to compare two custom objects for equality.

  • Ensure immutability of the custom object to prevent unexpected behavior.

Add your answer

Q57. SQL query to find the highest salary from a specific department

Ans.

SQL query to find the highest salary from a specific department

  • Use the MAX() function to find the highest salary

  • Filter the results based on the specific department using WHERE clause

  • Join the employee table with the department table if necessary

Add your answer

Q58. Group by in java stream based on 2 fields

Ans.

Group by in Java stream based on 2 fields can be achieved using Collectors.groupingBy with a composite key

  • Use Collectors.groupingBy with a composite key to group by multiple fields

  • Create a class to represent the composite key if necessary

  • Example: Map>> groupedData = dataList.stream().collect(Collectors.groupingBy(obj -> obj.getField1() + obj.getField2()))

Add your answer

Q59. What is Kafka ?

Ans.

Kafka is a distributed streaming platform used for building real-time data pipelines and streaming applications.

  • Kafka is designed to handle high-throughput, fault-tolerant, and scalable real-time data streams.

  • It allows for the publishing and subscribing to streams of records, similar to a message queue.

  • Kafka is often used for log aggregation, stream processing, event sourcing, and real-time analytics.

  • It provides features like fault tolerance, replication, and partitioning to ...read more

Add your answer

Q60. Create a project to maintain shopping list

Ans.

A project to maintain shopping list

  • Create a class or data structure to store items in the shopping list

  • Implement functions to add, remove, and update items in the list

  • Include functionality to mark items as purchased

  • Allow users to view the entire list or filter by category

  • Consider adding a feature to set reminders for shopping trips

Add your answer

Q61. flatten an array

Ans.

Flatten an array of strings

  • Use a recursive function to iterate through the array and flatten it

  • Check if each element is an array, if so, recursively call the function

  • Concatenate the elements into a single array

Add your answer

Q62. Features introduced in Java 8

Ans.

Java 8 introduced several new features including lambda expressions, functional interfaces, streams, and default methods in interfaces.

  • Lambda expressions allow you to pass functions as arguments.

  • Functional interfaces have a single abstract method and can be used with lambda expressions.

  • Streams provide a way to work with sequences of elements.

  • Default methods allow interfaces to have method implementations.

Add your answer

Q63. Remove duplicates from an array

Ans.

Use a Set to remove duplicates from an array of strings.

  • Create a Set to store unique elements.

  • Iterate through the array and add each element to the Set.

  • Convert the Set back to an array to remove duplicates.

Add your answer

Q64. given 3 threads print a number from 1 to 10 in sequence

Ans.

Use synchronized blocks or locks to ensure threads print numbers in sequence.

  • Use synchronized blocks or locks to ensure only one thread can access the shared resource (number to be printed) at a time.

  • Use a shared variable to keep track of the current number to be printed and update it after each thread prints its number.

  • Use a loop to iterate from 1 to 10 and have each thread check if it is its turn to print the number.

Add your answer

Q65. Primary key, difference between primary key and super key

Ans.

Primary key uniquely identifies a record in a table, while super key is a set of attributes that can uniquely identify a record.

  • Primary key is a subset of super key

  • Primary key cannot have NULL values, while super key can

  • Example: In a table 'Employee', 'EmployeeID' can be a primary key as it uniquely identifies each employee record, while 'EmployeeID, DepartmentID' can be a super key

Add your answer

Q66. design pattern to track count of hashmap inserts

Ans.

Use Observer design pattern to track count of hashmap inserts

  • Implement an Observer interface with update method to track changes in the hashmap

  • Create a concrete observer class to keep track of the count of inserts

  • Register the observer with the hashmap to receive notifications on inserts

Add your answer

Q67. Internal working of the hash map with custom object

Ans.

A hash map is a data structure that stores key-value pairs, using a hash function to map keys to indexes in an array.

  • Hash map uses a hash function to determine the index of the key in the underlying array.

  • Collision resolution techniques like chaining or open addressing are used to handle cases where multiple keys hash to the same index.

  • Custom objects used as keys must override the hashCode() and equals() methods for proper functioning in a hash map.

Add your answer

Q68. Print prime numbers, implement linked list, perform binary search on array

Ans.

Implementing prime number printing, linked list, and binary search on array in software development interview question.

  • Implement a function to print prime numbers within a given range

  • Create a linked list class with basic operations like insertion, deletion, and traversal

  • Write a binary search function to find a target value in a sorted array

Add your answer

Q69. Static Constructor overloaded or not?

Ans.

Static constructor can be overloaded in C#.

  • Static constructor is used to initialize static fields of a class.

  • Overloading static constructor is useful when we want to initialize different static fields with different values.

  • Static constructor is called only once, before the first instance of the class is created.

  • Static constructor has no access modifier and no parameters.

Add your answer

Q70. Stream vs parallel stream of java

Ans.

Stream is sequential processing while parallel stream allows for concurrent processing in Java.

  • Stream is processed sequentially while parallel stream is processed concurrently.

  • Parallel stream can improve performance for large datasets by utilizing multiple threads.

  • Use parallel stream when order of processing is not important.

  • Example: List list = Arrays.asList("a", "b", "c"); list.stream().forEach(System.out::println);

  • Example: List list = Arrays.asList("a", "b", "c"); list.par...read more

Add your answer

Q71. Different between Thread and Task?

Ans.

Thread is a lightweight process that runs concurrently with other threads in a process. A task is a unit of work that can be executed asynchronously.

  • Threads are managed by the operating system, while tasks are managed by a task scheduler.

  • Threads are more low-level and require more manual management, while tasks are higher-level and can be managed more easily.

  • Threads are typically used for parallelism, while tasks are used for asynchronous programming.

  • Examples of threading lib...read more

Add your answer

Q72. Prime number optimisation and why ?

Ans.

Optimizing prime number algorithms is crucial for efficient computation in software development.

  • Optimizing prime number algorithms can improve the performance of applications that rely on prime numbers, such as cryptography or number theory.

  • Efficient algorithms like the Sieve of Eratosthenes can significantly reduce the time complexity of finding prime numbers.

  • Using techniques like memoization or dynamic programming can further optimize prime number generation.

  • Optimizing prim...read more

Add your answer

Q73. Create a React application based on the given requirements

Ans.

Create a React application based on given requirements

  • Start by setting up a new React project using create-react-app

  • Identify the components needed based on the requirements

  • Implement state management using React hooks or Redux

  • Fetch data from an API if required and display it in the application

  • Ensure responsive design and user-friendly interface

Add your answer

Q74. constructors and overridding of functions in hashmap

Ans.

Constructors are used to initialize objects, while overriding functions in HashMap allows custom behavior for key-value pairs.

  • Constructors in HashMap are used to initialize the HashMap object with a specified initial capacity and load factor.

  • Overriding functions in HashMap allows custom behavior for methods like put(), get(), and remove().

  • Example: Overriding the put() method in a custom HashMap implementation to perform additional validation before adding a key-value pair.

Add your answer

Q75. what is dependency injection

Ans.

Dependency injection is a design pattern where components are given their dependencies rather than creating them internally.

  • Dependency injection helps in achieving loose coupling between classes.

  • It allows for easier testing by providing a way to mock dependencies.

  • There are three types of dependency injection - constructor injection, setter injection, and interface injection.

Add your answer

Q76. working of the hash set with the employee object

Ans.

A hash set stores unique elements using a hash function for efficient retrieval.

  • Hash set stores unique elements based on their hash code

  • Employee object must have proper hashCode() and equals() methods implemented

  • Example: HashSet employeeSet = new HashSet<>();

Add your answer

Q77. string conversion camel case to snake case

Ans.

Convert a string from camel case to snake case.

  • Split the camel case string into words based on uppercase letters.

  • Convert each word to lowercase and separate them with underscores.

  • Join the words back together with underscores to form the snake case string.

Add your answer

Q78. Difference between call, apply and bind

Ans.

Call, apply, and bind are methods in JavaScript used to set the context of a function and pass arguments.

  • Call - invokes a function with a specified 'this' value and arguments provided individually.

  • Apply - invokes a function with a specified 'this' value and arguments provided as an array.

  • Bind - creates a new function that, when called, has its 'this' keyword set to the provided value.

Add your answer

Q79. What is abstraction and encapsulation

Ans.

Abstraction is the concept of hiding complex implementation details and showing only the necessary information. Encapsulation is bundling data and methods that operate on the data into a single unit.

  • Abstraction focuses on what an object does rather than how it does it

  • Encapsulation restricts access to some of an object's components, protecting the object's integrity

  • Abstraction allows for easier maintenance and modification of code

  • Encapsulation helps in achieving data hiding an...read more

Add your answer

Q80. Merge given sorted arrays into single sorted array

Ans.

Merge sorted arrays into single sorted array

  • Use a merge sort algorithm to combine the arrays

  • Iterate through both arrays and compare elements to merge them

  • Time complexity can be O(n log n) if using merge sort

Add your answer

Q81. Write a java program to count the number of vowels in a string

Ans.

Java program to count vowels in a string

  • Create a method that takes a string as input

  • Use a loop to iterate through each character in the string

  • Check if the character is a vowel (a, e, i, o, u) and increment a counter

  • Return the counter as the result

View 1 answer

Q82. Find k largest element in an array

Ans.

Use sorting or heap data structure to find k largest elements in an array of strings.

  • Sort the array in descending order and return the first k elements.

  • Use a max heap data structure to efficiently find the k largest elements.

  • Examples: ['apple', 'banana', 'orange', 'kiwi'], k=2 -> ['orange', 'kiwi']

Add your answer

Q83. Java8 features in details

Ans.

Java8 introduced several new features including lambda expressions, functional interfaces, streams, and default methods.

  • Lambda expressions allow for more concise code by enabling functional programming.

  • Functional interfaces are interfaces with a single abstract method, which can be implemented using lambda expressions.

  • Streams provide a way to work with collections of objects in a functional style, allowing for parallel processing and lazy evaluation.

  • Default methods allow inte...read more

Add your answer

Q84. Write a DB query for some scenario

Ans.

Query to retrieve all employees with a salary greater than $50,000

  • Use SELECT statement to retrieve data

  • Use WHERE clause to filter employees with salary greater than $50,000

Add your answer

Q85. split array into specified size

Ans.

Split an array of strings into specified size chunks

  • Use a loop to iterate through the array and slice it into chunks of specified size

  • Check if the array length is divisible by the specified size, if not handle the remaining elements separately

  • Example: ['apple', 'banana', 'cherry', 'date'] split into chunks of size 2 would result in [['apple', 'banana'], ['cherry', 'date']]

Add your answer

Q86. n+1 problem of hibernate

Ans.

The n+1 problem in Hibernate occurs when a query results in multiple individual queries being executed for each row fetched.

  • Occurs when a query fetches a collection and then for each element in the collection, another query is executed to fetch related data

  • Can be resolved by using fetch joins or batch fetching to reduce the number of queries

  • Improves performance by reducing the number of database round trips

Add your answer

Q87. Difference between custom settings and custom metadata

Ans.

Custom settings are org-wide while custom metadata is record-specific.

  • Custom settings are used to store data that is org-wide and can be accessed by all users.

  • Custom metadata is used to store data that is specific to a record or a set of records.

  • Custom settings can be accessed using the hierarchy custom setting or the list custom setting.

  • Custom metadata can be accessed using the Metadata API or the Apex Metadata API.

  • Custom settings can be used to store application settings, u...read more

Add your answer

Q88. What are OOPs concepts?

Ans.

OOPs concepts refer to Object-Oriented Programming principles such as inheritance, encapsulation, polymorphism, and abstraction.

  • Inheritance: Allows a class to inherit properties and behavior from another class.

  • Encapsulation: Bundling data and methods that operate on the data into a single unit.

  • Polymorphism: Ability to present the same interface for different data types.

  • Abstraction: Hiding the complex implementation details and showing only the necessary features.

Add your answer

Q89. design immutable class

Ans.

Immutable class is a class whose state cannot be modified after creation.

  • Make all fields private and final

  • Do not provide setter methods

  • Ensure deep copy of mutable objects in constructor and getter methods

Add your answer

Q90. Write a component to display a table

Ans.

A component to display a table in a software application

  • Use HTML and CSS to create the structure and styling of the table

  • Use JavaScript to populate the table with data dynamically

  • Consider adding features like sorting, filtering, and pagination for better user experience

Add your answer

Q91. What is method overloading?

Ans.

Method overloading is when multiple methods in a class have the same name but different parameters.

  • Allows multiple methods with the same name but different parameters to be defined in a class

  • Parameters can differ in number, type, or order

  • Example: void print(int num) and void print(String text) are overloaded methods

Add your answer

Q92. what is Closures

Ans.

Closures are functions that have access to variables from their containing scope even after the function has finished executing.

  • Closures allow functions to maintain access to variables from their parent scope

  • They are commonly used in event handlers and callbacks

  • Closures can be used to create private variables in JavaScript

Add your answer

Q93. Core java and dsa algorithm

Ans.

Core Java is a fundamental programming language used for developing software applications. DSA algorithms are essential for efficient problem-solving.

  • Core Java is used for developing software applications and is based on the Java programming language.

  • DSA algorithms are data structures and algorithms used for efficient problem-solving.

  • Examples of DSA algorithms include sorting algorithms like Bubble Sort and searching algorithms like Binary Search.

Add your answer

Q94. Dsa problems and system design

Ans.

DSA problems involve solving algorithmic challenges, while system design involves designing scalable and efficient software systems.

  • Practice solving DSA problems on platforms like LeetCode, HackerRank, or CodeSignal.

  • Study common data structures and algorithms like arrays, linked lists, trees, sorting algorithms, and searching algorithms.

  • For system design, focus on scalability, reliability, performance, and maintainability of software systems.

  • Learn about designing distributed ...read more

Add your answer

Q95. Advantages of React Js

Ans.

React Js offers fast rendering, reusable components, virtual DOM, and easy integration with other libraries.

  • Fast rendering due to virtual DOM

  • Reusable components for efficient development

  • Easy integration with other libraries like Redux

  • Support for server-side rendering for improved SEO

  • One-way data binding for predictable data flow

Add your answer

Q96. 1. Anagrams in a given word

Ans.

Anagrams in a given word

  • Create a function to find all possible anagrams of a given word

  • Use a hash table to store the frequency of each character in the word

  • Generate all possible permutations of the characters and check if they exist in the hash table

Add your answer

Q97. Explain component lifecycle in React

Ans.

Component lifecycle in React refers to the series of methods that are invoked at different stages of a component's existence.

  • Mounting phase: constructor, render, componentDidMount

  • Updating phase: render, componentDidUpdate

  • Unmounting phase: componentWillUnmount

Add your answer

Q98. What design pattern you used in your microservice&gt;

Ans.

I used the Service Registry design pattern in my microservice.

  • Service Registry pattern is used to dynamically register and discover services in a distributed system.

  • It helps in decoupling service consumers from service providers.

  • Examples of Service Registry tools include Netflix Eureka and Consul.

Add your answer

Q99. internal of hashmap

Ans.

Internal implementation of hashmap involves an array of linked lists to handle collisions.

  • HashMap internally uses an array of linked lists to store key-value pairs.

  • When a key is inserted, its hash code is used to determine the index in the array where it should be stored.

  • If two keys have the same hash code, they are stored in the same linked list to handle collisions.

  • HashMap uses the key's hash code and equals method to find and retrieve values efficiently.

Add your answer

Q100. What is thread?

Ans.

A thread is a lightweight process that can run concurrently with other threads within the same process.

  • Threads allow for parallel execution of tasks within a single process

  • Threads share the same memory space and resources within a process

  • Examples include a web server handling multiple client requests concurrently

Add your answer
1
2
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos

Interview Process at Noorain Engineering systems. Santhapuram Village, chinnaelasagiri. Hosur.

based on 143 interviews
Interview experience
3.7
Good
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Interview Questions from Similar Companies

4.4
 • 430 Interview Questions
4.2
 • 218 Interview Questions
3.9
 • 176 Interview Questions
4.2
 • 167 Interview Questions
4.2
 • 160 Interview Questions
4.2
 • 142 Interview Questions
View all
Top Wissen Technology Interview Questions And Answers
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
70 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter