Computer Science Pertanyaan dan Jawaban Wawancara
Ques 31. What is the purpose of the 'Singleton' design pattern?
The Singleton design pattern ensures that a class has only one instance and provides a global point of access to that instance.
Example:
Creating a single instance for a database connection manager in a web application.
Ques 32. Explain the concept of a cache and its importance in computing.
A cache is a hardware or software component that stores data temporarily to reduce access time and provide faster data retrieval.
Example:
Using a cache to store frequently accessed database query results for improved performance.
Ques 33. What is the difference between a static method and an instance method?
A static method belongs to the class and can be called without creating an instance, while an instance method operates on an instance of the class and requires an object to be created.
Example:
Static method: Math.abs() in Java. Instance method: String.length() in Java.
Ques 34. Explain the concept of multithreading and its advantages.
Multithreading is the concurrent execution of two or more threads to perform multiple tasks simultaneously. It improves program responsiveness and overall system performance.
Example:
Running background tasks while the main thread handles user input in a graphical user interface.
Ques 35. What is the purpose of the 'Dijkstra's algorithm' in computer science?
Dijkstra's algorithm is used to find the shortest path between two nodes in a graph, particularly in applications like network routing and GPS navigation.
Example:
Finding the shortest path between two cities on a road network.
Most helpful rated by users:
- What is the difference between a stack and a queue?
- What is the purpose of an index in a database?
- What is the purpose of the 'git' version control system?