Object Oriented Programming Concepts

DistinctivePlanet avatar
DistinctivePlanet
·
·
Download

Start Quiz

Study Flashcards

Questions and Answers

Which programming languages are known to use finalizers?

Java and C#

Why are finalizers not recommended for complex operations?

Because they are not under programmer control

What is the purpose of the dispose pattern?

To clean up resources

What is manual memory management?

<p>The use of explicit programming instructions to manage memory</p> Signup and view all the answers

Which languages still use manual memory management?

<p>C and C++</p> Signup and view all the answers

What is the IDisposable interface used for in C#?

<p>To support the dispose pattern</p> Signup and view all the answers

What is the primary function of an Inspector (selector, GETter) operation?

<p>To query the object's state</p> Signup and view all the answers

What are the placeholders in which the state is stored in a car object?

<p>Attributes</p> Signup and view all the answers

What is the main advantage of having everything as an object in a programming language?

<p>Elegance and purity</p> Signup and view all the answers

In the context of the given code, what is the purpose of the day(int day) function?

<p>To alter the day of the Date object</p> Signup and view all the answers

What is the primary difference between static type and dynamic type?

<p>Static type is determined at compile time, while dynamic type is determined at runtime</p> Signup and view all the answers

What is an example of an immutable object in Java?

<p>String</p> Signup and view all the answers

What is the approach to support efficiency in storage and lifetime of objects?

<p>Determine objects' lifetime when the program is written</p> Signup and view all the answers

What is the purpose of dynamic binding?

<p>To make sure that the right method is selected</p> Signup and view all the answers

What is the result of calling a method on an object of static type Employee * but dynamic type Manager *?

<p>The method of the <code>Manager</code> class will be called</p> Signup and view all the answers

What is the disadvantage of having a complete typing system with objects?

<p>Confusing type system</p> Signup and view all the answers

What is the primary advantage of static typing?

<p>It guarantees that a method exists</p> Signup and view all the answers

What is the primary challenge in manual memory management?

<p>Determining when an object is no longer needed</p> Signup and view all the answers

What is the term for the current value of all the object attributes?

<p>State</p> Signup and view all the answers

What is the consequence of deleting an object more than once?

<p>Catastrophic failure of the dynamic memory management system</p> Signup and view all the answers

What is a disadvantage of manual memory management?

<p>It can lead to memory leaks</p> Signup and view all the answers

What is the benefit of manual memory management when dealing with scarce system resources?

<p>It allows for more control over resource relinquishment</p> Signup and view all the answers

What is a characteristic of languages that exclusively use garbage collection?

<p>They are less prone to catastrophic failure of the dynamic memory management system</p> Signup and view all the answers

What happens to pointers to deleted objects if used post-deletion?

<p>They become wild pointers</p> Signup and view all the answers

What is a major consequence of garbage collection in terms of performance?

<p>Potentially decreased performance due to overhead</p> Signup and view all the answers

In what type of environments are unpredictable delays unacceptable?

<p>Real-time environments such as device drivers, or in transaction processing</p> Signup and view all the answers

What is a limitation of garbage collectors in terms of memory leaks?

<p>They can do nothing about logical memory leaks</p> Signup and view all the answers

What is the result of garbage collectors interacting badly with cache and virtual memory systems?

<p>The computer/operating system starts 'thrashing'</p> Signup and view all the answers

What is the consequence of recursive algorithms on automatic storage management?

<p>Delayed automatic release of stack objects</p> Signup and view all the answers

What is the penalty for the convenience of not annotating memory usage manually in the code?

<p>Overhead leading to potentially decreased performance</p> Signup and view all the answers

More Quizzes Like This

Use Quizgecko on...
Browser
Browser