Computer Science اسئلة واجوبة المقابلات
سؤال 11. What is the difference between a shallow copy and a deep copy?
A shallow copy creates a new object, but does not copy the nested objects, while a deep copy creates a new object and recursively copies all nested objects.
Example:
Shallow copy: Object.assign() in JavaScript. Deep copy: Using libraries like deepcopy in Python.
سؤال 12. Explain the concept of normalization in databases.
Normalization is the process of organizing data in a database to reduce redundancy and dependency, leading to better data integrity.
Example:
Breaking a table into smaller tables to avoid repeating data (1NF, 2NF, 3NF, etc.).
سؤال 13. What is a binary search algorithm, and how does it work?
Binary search is a divide-and-conquer algorithm used to efficiently locate a target value within a sorted array by repeatedly dividing the search interval in half.
Example:
Searching for a specific element in a sorted array by repeatedly halving the search range.
سؤال 14. Explain the concept of thread synchronization.
Thread synchronization is the coordination of threads to ensure proper execution and avoid conflicts when accessing shared resources.
Example:
Using locks or synchronization primitives to control access to shared data in a multithreaded environment.
سؤال 15. What is the purpose of the 'this' keyword in object-oriented programming?
The 'this' keyword refers to the current instance of a class and is used to access instance variables and methods.
Example:
In Java: 'this.name = name;' in a constructor to differentiate between instance and local variables.
الاكثر فائدة حسب تقييم المستخدمين:
- 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?