What does REST stand for in RESTful APIs?
- Reliable State Transfer
- Remote State Transfer
- Representational State Transfer
- Resource State Transfer
Representational State Transfer (REST) is an architectural style for distributed hypermedia systems. It emphasizes scalability, reliability, and the uniform interface between components. RESTful APIs use HTTP methods like GET, POST, PUT, DELETE to manipulate resources.
In a banking application, you need to implement a SQL query to calculate the total balance for each customer across multiple accounts. How would you approach this problem using SQL?
- Use INSERT INTO to calculate balances
- Use UNION ALL to combine balances
- Use a JOIN statement with GROUP BY and SUM functions
- Use subqueries with WHERE clause
To calculate the total balance for each customer across multiple accounts in a banking application using SQL, you would typically use a JOIN statement with GROUP BY and SUM functions. This approach involves joining the tables that contain customer information and account balances, grouping the results by customer ID, and then summing up the balances to get the total balance for each customer. For example, if you have separate tables for customers and accounts, you would join these tables on the customer ID, group by customer ID, and use the SUM function to calculate the total balance. This method provides an efficient way to aggregate data across multiple accounts for each customer.
What are Git hooks, and how can they be used in a development workflow?
- A branch in Git repository
- A command to create a new repository
- A tool for merging branches
- Scripts triggered by Git events
Git hooks are scripts that can be triggered by various Git events such as pre-commit, post-commit, pre-push, etc. These scripts allow developers to automate tasks or enforce certain rules and policies in the development workflow. For example, a pre-commit hook can be used to run code linting checks before allowing a commit, ensuring code quality standards are met. Similarly, a pre-push hook can be used to trigger unit tests before pushing changes to a remote repository, ensuring that only passing code is pushed. Git hooks provide a powerful way to customize and streamline the development process.
What is the difference between a singly linked list and a doubly linked list?
- Both can traverse forward
- Doubly linked lists allow traversal in both directions
- Singly linked lists allow traversal in both directions
- Singly linked lists have less memory overhead
Singly linked lists only allow traversal in one direction, from head to tail, while doubly linked lists allow traversal in both directions, which enhances flexibility but comes with higher memory overhead.
Which layer of the OSI Model is responsible for routing and forwarding packets?
- Network Layer
- Data Link Layer
- Transport Layer
- Presentation Layer
The Network Layer (Layer 3) of the OSI Model is responsible for routing and forwarding packets. This layer handles logical addressing, routing, and traffic management within a network. It ensures that data packets are properly routed from the source to the destination across different networks, making decisions based on logical addressing information (such as IP addresses). Option 1 is correct because the Network Layer specifically deals with routing functions in the OSI Model.
What is the purpose of the Singleton design pattern?
- Encapsulate data
- Ensure a class has only one instance
- Facilitate communication between objects
- Provide a global point of access
The purpose of the Singleton design pattern is to ensure that a class has only one instance and provide a global point of access to it. This is particularly useful in scenarios where you want to control access to resources or manage shared resources efficiently. The pattern also helps in maintaining a single instance throughout the application's lifecycle, preventing unnecessary duplication and ensuring consistency in data and behavior.
What is the role of a firewall in web application security?
- Enhancing UI/UX design
- Filtering network traffic
- Managing user authentication
- Optimizing database queries
Firewalls play a crucial role in web application security by filtering network traffic to identify and block malicious or unauthorized requests. They act as a barrier between the internet and the web server, inspecting incoming and outgoing data packets based on predefined rulesets. By analyzing factors such as IP addresses, port numbers, and packet contents, firewalls can detect and thwart various cyber threats, including DDoS attacks, SQL injection attempts, and unauthorized access attempts. This proactive defense mechanism helps prevent malicious entities from compromising the web application's integrity, ensuring continuous availability and data confidentiality for users.
To implement a stack using arrays, we use a ___________ pointer.
- Front
- Rear
- Top
- Bottom
The correct option is 'Top.' To implement a stack using arrays, we use a 'Top' pointer to keep track of the topmost element in the stack, allowing us to perform push and pop operations efficiently.
In SQL, the ___________ function returns the average value of a numeric column.
- AVG()
- SUM()
- COUNT()
- MAX()
The correct option is "AVG()." The AVG() function in SQL is used to calculate the average value of a numeric column in a table. It excludes NULL values while calculating the average.
___________ is a memory management scheme where physical memory is divided into fixed-sized blocks, and each process is assigned contiguous blocks.
- Fragmentation
- Paging
- Segmentation
- Swapping
Paging is a memory management scheme where physical memory is divided into fixed-sized blocks called frames, and logical memory is divided into fixed-sized blocks called pages. Each process is then assigned contiguous blocks of frames for its pages. Paging helps in efficient memory utilization and reduces external fragmentation.