Which HTTP methods are commonly used in RESTful APIs for CRUD operations?

  • CREATE, READ, UPDATE, DELETE
  • FETCH, INSERT, MODIFY, REMOVE
  • GET, POST, PUT, DELETE
  • RECEIVE, ADD, CHANGE, DELETE
CRUD operations in RESTful APIs correspond to HTTP methods: GET for READ, POST for CREATE, PUT for UPDATE, and DELETE for DELETE. These methods provide a standardized way to interact with resources over the web.

What is the main difference between TCP and UDP in the TCP/IP protocol suite?

  • Connection-oriented
  • Datagram-based
  • Error checking
  • Reliable
The main difference between TCP and UDP in the TCP/IP protocol suite is that TCP is connection-oriented and ensures reliable data delivery with error checking, while UDP is datagram-based and lacks built-in error checking and reliability mechanisms.

Imagine you're designing a web application that requires real-time communication between the client and server. Which protocol(s) would be suitable for implementing this feature, and how would you ensure efficient data transfer?

  • HTTP Long Polling
  • MQTT (Message Queuing Telemetry Transport)
  • WebSocket
  • XMPP (Extensible Messaging and Presence Protocol)
WebSocket is suitable for real-time communication between the client and server because it establishes a persistent connection that allows bidirectional data flow with low latency. This eliminates the overhead of establishing new connections for each exchange, making it efficient for real-time applications such as chat, gaming, or collaborative editing. HTTP Long Polling involves repeated client-server requests, leading to higher latency and increased server load, making it less efficient for real-time scenarios. MQTT and XMPP are messaging protocols often used for IoT and instant messaging, respectively, but they are not optimized for real-time web applications like WebSocket.

Which mechanism is used to prevent multiple threads from accessing shared resources simultaneously?

  • Encapsulation
  • Inheritance
  • Mutex
  • Polymorphism
The mutex (mutual exclusion) mechanism is employed to prevent multiple threads from simultaneously accessing shared resources, ensuring that only one thread can access the resource at a time, thus avoiding conflicts and data corruption.

In a real-world scenario of a customer relationship management (CRM) system, discuss how normalization principles can be applied to handle customer data effectively while minimizing redundancy.

  • Break customer data into multiple tables based on entities like contacts, orders, and products
  • Create separate databases for different customer data
  • Store all customer data in a single table
  • Use non-relational databases
Normalization in a CRM system involves breaking down customer data into multiple tables such as contacts, orders, and products, linked by foreign keys. This reduces redundancy, ensures data consistency, and allows for efficient data retrieval and updates. Storing all customer data in one table would lead to redundancy and inefficiency, while separate databases or non-relational databases would not adhere to normalization principles.

A company's website is experiencing frequent SQL injection attacks. How would you advise the development team to mitigate this security risk?

  • Implement input validation and sanitization
  • Regularly update and patch the web server and database management system (DBMS)
  • Use parameterized queries
  • Utilize a web application firewall (WAF)
Input validation and sanitization ensure that user input is validated and sanitized to prevent SQL injection attacks. Parameterized queries separate SQL code from user input, reducing the risk of SQL injection. Regularly updating and patching the web server and DBMS closes known vulnerabilities that attackers exploit. A WAF can detect and block SQL injection attacks, but it's not as effective as input validation and sanitization.

You're designing a real-time system where multiple threads must execute tasks at precise intervals. How would you ensure proper thread scheduling to meet these timing requirements?

  • Implement custom thread synchronization mechanisms
  • Increase the number of threads for better concurrency
  • Use a real-time operating system (RTOS) with deterministic scheduling
  • Utilize priority-based scheduling algorithms
In real-time systems, ensuring precise thread scheduling is crucial. Utilizing a real-time operating system (RTOS) with deterministic scheduling ensures that threads are executed based on their priority levels and deadlines, meeting timing requirements effectively. RTOS provides guarantees on thread execution times, making it suitable for real-time applications where timing is critical. Priority-based scheduling algorithms can also be effective, but they may not offer the same level of determinism and predictability as an RTOS. Custom thread synchronization mechanisms and increasing thread count may improve concurrency but do not directly address precise thread scheduling for real-time requirements.

Which command is used to stage changes in Git before committing?

  • git add
  • git commit
  • git push
  • git pull
Option 1: The 'git add' command is used to stage changes in Git before committing. Staging changes means preparing them to be included in the next commit, allowing for selective commits and better organization of changes.

CSS ___________ allows you to define a set of styles to be applied to different devices or media types.

  • Media Queries
  • Pseudo-classes
  • Selectors
  • Transitions
CSS Media Queries allow you to define a set of styles to be applied based on different devices or media types. This is commonly used for creating responsive designs that adapt to various screen sizes and orientations.

In a process, each ___________ represents a separate execution environment.

  • Fiber
  • Queue
  • Task
  • Thread
Processes and threads are fundamental concepts in operating systems. While a process represents a complete execution environment, a thread is a lightweight process that shares resources with other threads within the same process. A task can refer to a broader concept, often including processes and threads. A queue is a data structure used for managing elements in various computer science contexts but isn't directly related to representing execution environments.

A _________ linked list is a type of linked list where each node's next pointer points to the previous node.

  • Binary
  • Circular
  • Doubly
  • Linear
A doubly linked list is one in which each node has two pointers, one pointing to the next node and one pointing to the previous node, forming a bidirectional sequence.

In a real-time system, you're required to meet strict deadlines for task completion. How would you design a scheduling strategy to guarantee timely execution of critical processes?

  • Use a First-Come, First-Served (FCFS) scheduling algorithm
  • Implement a Priority-Based scheduling algorithm
  • Utilize a Round-Robin scheduling algorithm
  • Employ a Deadline-Monotonic scheduling algorithm
Option 4: Employing a Deadline-Monotonic scheduling algorithm is essential in meeting strict deadlines for task completion in a real-time system. This algorithm assigns priorities based on task deadlines, ensuring that critical processes with closer deadlines are executed first. By prioritizing tasks according to their deadlines, the system can guarantee timely execution of critical processes, crucial for real-time applications such as control systems or multimedia streaming.