In the ___________ design pattern, a chain of processing objects is created where each object contains logic to determine if it can process the request.

  • Factory Pattern
  • Chain of Responsibility Pattern
  • Strategy Pattern
  • Decorator Pattern
The correct option is the Chain of Responsibility Pattern. This pattern creates a chain of objects, each capable of processing a request or passing it to the next object in the chain.

You're developing a web application where users need to upload images. How would you validate the file type and size using JavaScript?

  • Use File API to check file size
  • Use FileReader API to read file metadata
  • Use accept attribute in tag
  • Use typeof operator to check file type
Using the accept attribute in the tag allows specifying the allowed file types (MIME types) that users can upload. This provides client-side validation to ensure that only files of specified types are accepted. The File API, on the other hand, allows accessing file metadata, including size. Using typeof is not suitable for file type validation. The FileReader API is used to read file content, not metadata.

Docker uses ________ files to define the configuration of a containerized application.

  • .yaml
  • .json
  • .cfg
  • .dockerfile
The correct option is ".dockerfile." Docker uses Dockerfiles, which are plain text configuration files with a specific syntax, to define the steps needed to create a container image. These files specify the base image, environment variables, dependencies, and commands to run when the container starts. Dockerfiles are essential for building reproducible and version-controlled containerized applications, making it easier to manage and scale container deployments.

When is it preferable to use merge sort over quicksort?

  • Input size
  • Memory usage
  • Stability of sorting
  • Time complexity
Merge sort is preferable over quicksort when dealing with large input sizes due to its guaranteed O(n log n) time complexity, which is advantageous over quicksort's worst-case O(n^2) time complexity.

Which type of linked list is best suited for implementing a stack?

  • Array-based list
  • Circular linked list
  • Doubly linked list
  • Singly linked list
A singly linked list is best suited for implementing a stack because it only requires a pointer to the top element, allowing for efficient insertion and removal operations at the top of the stack.

Query _______ involves rearranging the execution plan of a query to improve its performance.

  • Analysis
  • Compilation
  • Debugging
  • Optimization
Query optimization is the process of rearranging the execution plan of a query to enhance its performance. This optimization can involve various techniques such as selecting appropriate indexes, restructuring the query, or using hints to guide the database optimizer in choosing the most efficient execution path. By optimizing queries, database administrators and developers aim to reduce query execution time and resource consumption.

How does NAT (Network Address Translation) work in the context of the TCP/IP model?

  • Encrypts data packets for secure transmission
  • Provides Quality of Service (QoS) for network traffic
  • Routes packets between different networks
  • Translates private IP addresses to public IP addresses for internet communication
NAT operates at the network layer of the TCP/IP model. It allows a network to use private IP addresses internally while communicating with the internet using a single public IP address. NAT modifies the source IP address in outgoing packets to the public IP address and maintains a translation table to route incoming responses back to the correct internal device.

You're working on a project where SEO is critical. How would you implement server-side rendering (SSR) with React or Angular to ensure better search engine visibility?

  • Implement custom server-side rendering logic for both React and Angular
  • Use client-side rendering and optimize meta tags for SEO
  • Use frameworks like Next.js or Gatsby for React SSR, and Angular Universal for Angular SSR
  • Utilize static site generation with React and Angular
Leveraging frameworks like Next.js or Angular Universal for SSR ensures that search engines receive fully rendered pages, enhancing SEO. Custom SSR logic can be complex, and static site generation may not be as dynamic for SEO purposes.

The Banker's algorithm operates by simulating the allocation of _______ to processes and checks if granting the requests leads to a safe state.

  • CPU
  • Memory
  • Resources
  • Threads
The Banker's algorithm is used in operating systems to manage resources such as CPU cycles, memory, and input/output devices. It simulates the allocation of resources to processes and ensures a safe state to avoid deadlock.

In merge sort, the merge operation combines two ___________ arrays into a single sorted array.

  • Equal-sized
  • Sorted
  • Subarray
  • Unsorted
In merge sort, the merge operation combines two sorted arrays into a single sorted array. This is a crucial step in the merge sort algorithm, where the sorted subarrays from the divide step are merged back together to create a larger sorted array. The merging process compares elements from both arrays and arranges them in ascending or descending order, depending on the sorting order specified.