Which normal form ensures that each attribute is dependent only on the primary key?
- First Normal Form (1NF)
- Fourth Normal Form (4NF)
- Second Normal Form (2NF)
- Third Normal Form (3NF)
Third Normal Form (3NF) ensures that each non-key attribute is dependent only on the primary key, which helps in eliminating transitive dependencies and achieving a more organized database structure.
What is the primary difference between a process and a thread?
- Concurrency
- Independence
- Memory usage
- Resource ownership
A process is an independent entity that has its own address space and resources, while a thread is a lightweight entity that exists within a process and shares the same address space and resources with other threads in that process. This difference in independence and resource sharing is crucial for understanding how processes and threads operate within an operating system.
You're working on a project where the input data is nearly sorted. Which sorting algorithm would you choose and why?
- Bubble Sort
- Insertion Sort
- Merge Sort
- Quick Sort
Insertion Sort is the most suitable choice for nearly sorted data. It has a time complexity of O(n) in the best-case scenario, making it efficient when data is already close to its final sorted position. Merge Sort, Quick Sort, and Bubble Sort, on the other hand, have higher time complexities for nearly sorted data, making them less efficient in this scenario.
What is the SOLID principle in OOP? Explain one of its principles.
- Dependency Inversion Principle
- Interface Segregation Principle
- Open/Closed Principle
- Single Responsibility Principle
The SOLID principle in Object-Oriented Programming (OOP) is a set of five principles aimed at making software designs more understandable, flexible, and maintainable. The Single Responsibility Principle (SRP) states that a class should have only one reason to change, meaning it should have only one job or responsibility.
You're tasked with optimizing a database query that is running slow. What steps would you take to identify and resolve the performance bottleneck?
- Analyze query execution plan
- Check server hardware
- Implement caching mechanisms
- Optimize database schema
Analyzing the query execution plan involves examining how the database engine executes the query, including the order of operations, use of indexes, and resource consumption. Checking server hardware involves ensuring that the server has sufficient resources like CPU, RAM, and disk I/O for optimal performance. Optimizing the database schema includes normalization, indexing, and proper data types. Implementing caching mechanisms can reduce the need for repeated querying by storing frequently accessed data temporarily. These steps collectively help identify and address the performance bottleneck in a database query.
Explain the Banker's algorithm for deadlock avoidance.
- Allocating resources based on available units
- Detecting circular wait situations and resolving them
- Initiating priority-based process scheduling
- Preventing processes from holding resources forever
The Banker's algorithm is a resource allocation and deadlock avoidance technique used in operating systems. It works by keeping track of the available resources and the maximum resources that each process may request. The algorithm then simulates resource allocation to avoid deadlock by only granting resource requests that can be satisfied without leading to a circular wait condition. By ensuring that the system remains in a safe state (i.e., no deadlock can occur), the Banker's algorithm helps in efficient resource utilization and preventing situations where processes hold resources indefinitely, leading to system deadlock.
In Multilevel Queue Scheduling, processes are assigned to _________ based on their characteristics.
- CPU Queues
- Input/Output Queues
- Priority Queues
- Ready Queues
Multilevel Queue Scheduling involves categorizing processes into different queues based on their characteristics, such as priority, CPU burst time, or I/O requirements. The "Ready Queue" is where processes are placed after being sorted into appropriate levels, ready for execution.
Which type of NoSQL database is best suited for handling highly interconnected data?
- Column-family stores
- Document databases
- Graph databases
- Key-Value stores
Graph databases are specifically designed to handle highly interconnected data. They excel in managing complex relationships between different entities by representing data as nodes, edges, and properties, making them ideal for applications like social networks, recommendation engines, and network analysis. Other NoSQL databases may struggle with efficiently querying and traversing interconnected data structures compared to graph databases.
What is the purpose of MAC filtering in wireless networks?
- Controlling device access
- Enhancing network security
- Extending wireless range
- Improving network speed
MAC filtering in wireless networks is primarily used for controlling device access. It works by allowing or denying network access based on the MAC addresses of devices trying to connect. This helps in enhancing security by only allowing authorized devices to join the network, preventing unauthorized access.
The _________ scheduling algorithm selects the process with the highest priority for execution.
- First Come First Serve
- Priority-based
- Round Robin
- Shortest Job Next
In Priority-based scheduling, processes are executed based on their priority levels, with higher-priority processes being selected over lower-priority ones. This ensures that critical tasks or processes with urgent needs are handled promptly.
Which protocol is used for sending emails over the Internet?
- SMTP
- FTP
- HTTP
- TCP
The correct option is "SMTP," which stands for Simple Mail Transfer Protocol. SMTP is a protocol used for sending and receiving emails over the Internet. It works in conjunction with other protocols like POP3 or IMAP for email retrieval and delivery. SMTP facilitates the transfer of emails between servers and enables communication between email clients and servers.
The process of breaking down a large table into smaller tables and defining relationships between them is known as ___________.
- Data aggregation
- Data fragmentation
- Data normalization
- Data partitioning
Data normalization includes breaking down large tables into smaller ones and establishing relationships between them. This practice enhances data organization, reduces redundancy, and facilitates efficient data management and retrieval.