How does hoisting work in JavaScript?
- Assignments are moved to the top of the scope during compilation
- Declarations are moved to the top of the scope during compilation
- Functions are moved to the top of the scope during compilation
- Variables are moved to the top of the scope during runtime
Hoisting in JavaScript refers to the behavior where function declarations are moved to the top of the scope during compilation, allowing them to be used before they are declared.
What is the time complexity of accessing an element in an array?
- O(1)
- O(log n)
- O(n)
- O(n^2)
The time complexity of accessing an element in an array is O(1) or constant time. This is because arrays provide direct access to any element using its index, and the access time remains constant regardless of the array size.
In Cassandra, a _______ determines the placement of data on nodes in the cluster.
- Consistency Level
- Partition Key
- Replication Factor
- Super Column
In Cassandra, the placement of data on nodes is determined by the Partition Key. It is crucial for distributing data across the cluster efficiently.
Which SQL clause is used to filter results based on a specified condition?
- FROM
- GROUP BY
- SELECT
- WHERE
The WHERE clause in SQL is used to filter results based on a specified condition. It allows you to specify conditions that the data must meet to be included in the result set.
Which type of attack involves an attacker stealing a user's session token and using it to impersonate the user?
- Cross-Site Request Forgery (CSRF)
- Cross-Site Scripting (XSS)
- SQL Injection
- Session Hijacking
Session Hijacking involves an attacker stealing a user's session token and using it to impersonate the user. This attack allows unauthorized access to sensitive data.
_______ profiling helps identify areas of code that consume excessive resources or cause bottlenecks.
- Code
- Memory
- Performance
- Time
Performance profiling involves analyzing a program's runtime behavior to identify bottlenecks and resource-heavy sections. It helps optimize code for better efficiency and speed.
In a Node.js application, JavaScript is primarily used for _______ scripting.
- Client-side
- Database
- Front-end
- Server-side
In a Node.js application, JavaScript is primarily used for server-side scripting. This is a distinctive feature of Node.js, enabling server-side development using JavaScript.
What are the key components of a comprehensive logging strategy in a microservices architecture?
- Centralized log storage, structured log formats, correlation IDs, and log aggregation
- Client-side logging, lightweight log formats, and real-time alerts
- Only server-side logging, comprehensive alerting, and distributed log storage
- Unstructured logs, decentralized storage, and real-time log analysis
A comprehensive logging strategy in microservices includes centralizing logs, using structured formats for easy analysis, implementing correlation IDs for request tracking, and aggregating logs to simplify troubleshooting and analysis.
In NoSQL databases, what does "CAP theorem" stand for, and what does it imply?
- CAP stands for Capacity, Availability, Performance
- CAP stands for Concurrency, Atomicity, Persistence
- CAP stands for Configuration, Authentication, Portability
- CAP stands for Consistency, Availability, Partition Tolerance
The CAP theorem in NoSQL databases stands for Consistency, Availability, and Partition Tolerance. It implies that in the presence of a network partition, a distributed system must choose between consistency and availability.
TDD encourages developers to write _______ tests to cover different aspects of the software.
- Acceptance
- Integration
- System
- Unit
TDD encourages developers to write Integration tests to cover different aspects of the software. Integration tests ensure that different components or modules work together as expected when integrated into a complete system.