What is the primary purpose of Memory Management in OOP?
A Optimize execution
B Manage memory leaks
C Allocate memory
D Handle objects
Memory management in OOP involves allocating memory to objects during their creation, deallocating memory when objects are no longer needed, and ensuring efficient memory usage to avoid issues like memory leaks.
Which method is primarily used for Memory Allocation in OOP?
A New operator
B Clone method
C Constructor
D Destructor
The new operator is used in OOP languages like C++ and Java to allocate memory for objects dynamically. It creates an instance of a class and allocates memory for it during runtime.
Which of the following is NOT a type of File Handling operation in OOP?
A Read
B Append
C Write
D Compile
File handling in OOP includes operations like reading, writing, and appending data to files. “Compile” is a process of converting source code into executable code, not related to file handling.
What is the primary function of File Input/Output (I/O) in OOP?
A Optimize performance
B Store data
C Retrieve data
D Handle exceptions
File Input/Output (I/O) operations in OOP are used to retrieve data from files (input) or store data to files (output). This allows for persistent storage and retrieval of data beyond the runtime of the program.
What does GUI Development primarily deal with in OOP?
A User interfaces
B Object creation
C File handling
D Memory management
GUI (Graphical User Interface) development in OOP is focused on designing interactive user interfaces. It involves creating windows, buttons, input fields, and other components that allow users to interact with the program.
Which of the following is an important feature of GUI development in OOP?
A Memory allocation
B File encryption
C Static data handling
D User interaction
GUI development focuses on creating interactive interfaces that allow users to interact with the software visually. It includes handling events like clicks, typing, and mouse movements, which are essential for effective user interaction.
Which of the following is NOT a core principle of Memory Management in OOP?
A Dynamic Memory Allocation
B Data Encapsulation
C Automatic Garbage Collection
D Explicit Memory Deallocation
Data encapsulation refers to bundling data and methods together. Memory management principles focus on efficient memory allocation, deallocation, and garbage collection, but encapsulation is about protecting and organizing data.
What does Garbage Collection do in OOP languages like Java?
A Frees unused memory
B Optimizes code execution
C Handles file operations
D Allocates memory
Garbage collection is a form of automatic memory management. In languages like Java, the garbage collector reclaims memory from objects that are no longer in use, helping to prevent memory leaks and ensuring efficient memory usage.
What is the main purpose of Memory Leaks in OOP?
A Reallocate memory
B Optimize memory
C Prevent memory waste
D Monitor memory usage
Memory leaks occur when dynamically allocated memory is not properly deallocated, causing a gradual increase in memory usage. Efficient memory management practices are needed to prevent memory leaks and avoid resource wastage.
Which of the following OOP principles is NOT directly related to File Handling?
A Abstraction
B Inheritance
C Polymorphism
D Encapsulation
While inheritance is an essential OOP principle, it is not directly related to file handling. File handling deals with operations such as reading, writing, and appending data, while inheritance pertains to class hierarchies.
Which of these methods is used for File Reading in OOP?
A WriteFile()
B ReadFile()
C Open()
D FileRead()
ReadFile() is typically used to read the contents of a file in OOP languages. This method helps retrieve data from a file and load it into the program for processing.
What is the role of Access Modifiers in GUI Development?
A Control method visibility
B Hide data in objects
C Handle user events
D Control memory usage
Access modifiers (like public, private, and protected) are used in OOP to control the visibility and accessibility of methods and attributes. In GUI development, this is useful for controlling interaction between components and classes.
Which of the following is NOT part of Exception Handling in OOP?
A Try block
B Finally block
C Catch block
D Write block
Exception handling includes try, catch, and finally blocks. Write is not part of exception handling; it pertains to file operations, not managing runtime errors within the program.
Which design principle is crucial for Effective Memory Management in OOP?
A Code Reusability
B Interface Implementation
C Proper Object Destruction
D Method Overloading
Proper object destruction ensures that memory allocated for objects is released when no longer needed. This is key in preventing memory leaks and ensuring optimal memory management within an OOP-based application.
What does the File Handling process in OOP help to achieve?
A Optimize system performance
B Create new objects
C Read and write data
D Secure data transfer
File handling in OOP involves operations like reading data from files, writing data to files, and managing file streams. It ensures that data persists beyond program execution and is stored or retrieved from external sources.