Meesho Screening Test Study Material
Meesho Screening Test Study Material
Meesho Screening Test Study Material
Stored Procedure
Shared Libraries:
Dynamic Linking Process:
Advantages:
Memory Efficiency:
Flexibility and Updates:
smaller executable files.
memory efficient.
limits application executable file size
dynamic loading
Reduced Disk Space:
Data hiding in C++ is achieved through the use of access specifiers and
encapsulation. Encapsulation is one of the fundamental principles of object-
oriented programming that allows bundling data and methods that operate on the
data into a single unit, known as a class. Access specifiers control the visibility of
class members (data and functions) from outside the class. The primary access
specifiers in C++ are public, private, and protected.
Declare the data members as private within the class. This restricts direct
access to these members from outside the class.
cpp
class MyClass {
private:
int privateData;
public:
void setData(int value) {
privateData = value;
}
int getData() {
return privateData;
}
};
2. Public Member Functions:
cpp
int main() {
MyClass obj;
obj.setData(42);
std::cout << "Data: " << obj.getData() << std::endl;
return 0;
}
3. Encapsulation:
Encapsulation involves bundling the data (private members) and the
functions (public members) that operate on the data into a single unit
(class).
Users of the class interact with it through its public interface, unaware of
the internal implementation details.
By employing private access specifiers and encapsulation, you ensure that the
internal details of the class are hidden from external code. This promotes
information hiding, reduces dependencies, and allows for better maintenance and
modification of the class without affecting other parts of the program.
In summary, cache memory acts as a high-speed buffer between the CPU and
main memory, optimizing data retrieval and improving the overall performance of
the operating system by reducing latency, enhancing CPU utilization, and ensuring
faster access to frequently used data.
Memory management in C++ and C shares some similarities due to C++ being an
extension of C, but there are key differences, primarily related to features
introduced in C++ for better memory handling.
3. Operator Overloading:
4. Smart Pointers:
5. Memory Safety:
6. Memory Leaks:
Both C and C++ can suffer from memory leaks if not managed properly.
However, with features like smart pointers, C++ provides better tools for
managing resources and reducing the likelihood of memory leaks.
In summary, while C++ retains many memory management features from C, it
introduces additional features like constructors, destructors, operator overloading,
and smart pointers to provide a more convenient, type-safe, and robust approach
to memory management. These features aim to enhance code readability,
maintainability, and safety in comparison to C.
1. Atomicity:
Definition: Atomicity ensures that a transaction is treated as a single,
indivisible unit of work. Either all the changes made by the transaction are
committed to the database, or none of them are.
Example: If a transaction involves multiple SQL statements, and any one
of them fails, the entire transaction is rolled back to its original state, and
no changes are applied to the database.
2. Consistency:
Definition: Consistency ensures that a transaction brings the database
from one consistent state to another. It enforces integrity constraints,
preserving the overall correctness and validity of the data.
Example: If a transaction violates any integrity constraint (such as a
primary key or foreign key constraint), it is rolled back, and the database
remains in a consistent state.
3. Isolation:
Definition: Isolation ensures that the execution of transactions is
independent of each other. Even if multiple transactions are executed
concurrently, the result should be the same as if they were executed in
some sequential order.
Example: Transactions are isolated from each other to prevent
interference. Changes made by one transaction are not visible to other
transactions until the first transaction is committed.
4. Durability:
Definition: Durability guarantees that once a transaction is committed, its
changes are permanent and survive any subsequent failures (such as a
power outage or system crash). The changes are stored in non-volatile
storage (e.g., disk) and can be recovered in case of a system failure.
Example: Once a user receives a confirmation that their transaction is
committed, they can be assured that the changes made by the
transaction will persist, even in the event of a system failure.