Independent Preparation Bank for Pakistani Computing Graduates • 100% Free • No Signup
NSCTPrep.
Programming (C++ / Java / Python)Topic #5 of 550 MCQs Available

Memory Management Concepts

Comprehensive question bank, step-by-step rationales, and dedicated timed quiz for Memory Management Concepts.

Launch Quiz Mode ↗

Memory Management Concepts Question Bank

Showing 50 questions of 50 with verified answers

3Multiple Choice

(Scenario-Based) You are using a modern Web Framework that automatically creates a database table based on your class name and variable names. Which advanced concept is the framework using to "read" your code?

4Multiple Choice

(Code-Tracing) Trace the result of this Higher-Order logic: list = [1, 2, 3, 4] result = list.filter(x -> x > 2).map(x -> x * 2) print(result)

5Multiple Choice

(Conceptual) What is a Closure in programming?

6Multiple Choice

(Debugging) Why is Reflection often discouraged in performance-critical sections of an application (like the inner loop of a game engine)?

7Multiple Choice

(Comparison) What is the difference between C++ Templates and Java Generics?

8Multiple Choice

(Scenario-Based) A developer adds @Deprecated to a method in Java or [Obsolete] in C#. What is the purpose of this metadata?

9Multiple Choice

(Code-Tracing) Look at this C++ Template snippet: template <typename T> T add(T a, T b) { return a + b; } print(add(5, 10)); print(add(2.5, 1.5)); What is the output?

10Multiple Choice

(Conceptual) In functional programming, what does the Reduce (or Fold) operation do?

11Multiple Choice

(Scenario-Based) You want to write a function that can accept any List, but you want to ensure the items in the list are at least a type of Animal (e.g., Dog or Cat). Which concept should you use?

12Multiple Choice

(Conceptual) What is Introspection in the context of advanced programming?

13Multiple Choice

(Code-Tracing) Trace the value of result: def multiplier(factor): return lambda x : x * factor triple = multiplier(3) result = triple(10)

14Multiple Choice

(Conceptual) What is the main purpose of Fluent Interfaces (Method Chaining), often seen in advanced libraries?

15Multiple Choice

(Debugging) Why might a Closure cause a memory leak in a language with Garbage Collection?

1Multiple Choice

(Conceptual) Which of the following best describes the difference between a Process and a Thread?

2Multiple Choice

(Scenario-Based) Two threads both execute count = count + 1 at the exact same time. The initial value is 0. After both finish, the value is 1 instead of 2. This is a classic example of:

3Multiple Choice

(Code-Tracing / Logic) Trace the result of using a Mutex (Lock) in this pseudocode: Thread A: Lock(m); x = x + 1; Unlock(m); Thread B: Lock(m); x = x + 1; Unlock(m); • If x starts at 0, what is the guaranteed result?

4Multiple Choice

(Conceptual) What are the four necessary conditions for a Deadlock to occur (Coffman conditions)?

5Multiple Choice

(Comparison) What is the difference between a Mutex and a Semaphore?

6Multiple Choice

(Scenario-Based) An application is designed to use 100 threads on a 4-core CPU. The developer notices the app is actually slower than the single-threaded version. What is the most likely cause?

7Multiple Choice

(Conceptual) What does it mean for a function or class to be "Thread-Safe"?

8Multiple Choice

(Code-Tracing) In Java/C#, what is the effect of calling thread.join()?

9Multiple Choice

(Conceptual) What is Amdahl's Law used to predict?

10Multiple Choice

(Debugging) You have two threads that are constantly changing their state in response to each other, but neither is making any progress toward finishing. This is called:

1Multiple Choice

(Conceptual) In the "Red-Green-Refactor" cycle of Test-Driven Development (TDD), what does the "Red" stage represent? • • • •

2Multiple Choice

(Scenario-Based) A developer makes a small change to the "Login" logic. Suddenly, the "Checkout" page stops working. Which type of testing would have caught this?

3Multiple Choice

(Comparison) What is the primary difference between a Breakpoint and a Watchpoint during debugging?

4Multiple Choice

(Conceptual) In software testing, what is Boundary Value Analysis?

5Multiple Choice

(Scenario-Based) You are optimizing a function that calculates prime numbers. You decide to store previously calculated results in a Hash Map to avoid recalculating them. This optimization is known as:

6Multiple Choice

(Conceptual) What does Cyclomatic Complexity measure in a piece of code?

7Multiple Choice

(Debugging) What is a "Heisenbug"?

8Multiple Choice

(Scenario-Based) An application works perfectly for 1 user, but the response time becomes 30 seconds when 1,000 users log in. Which tool should the developer use to find the cause?

9Multiple Choice

(Conceptual) What is the purpose of an Assertion (e.g., assert x > 0) in programming?

10Multiple Choice

(Comparison) What is the difference between Alpha Testing and Beta Testing?

11Multiple Choice

(Conceptual) Which optimization technique involves replacing a function call with the actual body of the function during compilation?

12Multiple Choice

(Scenario-Based) A developer uses a "Mock Object" during a Unit Test. Why?

13Multiple Choice

(Conceptual) What is Fuzz Testing (Fuzzing)?

14Multiple Choice

(Debugging) You see a "Core Dump" file after a C++ program crashes. What does this file contain?

15Multiple Choice

(Scenario-Based) A linter flags a "Dead Code" warning. What does this mean?

1Multiple Choice

(Conceptual) In Git, what is the state of a newly created file that has not yet been added to the staging area?

2Multiple Choice

(Scenario-Based) Two developers edit the exact same line of the same file and try to merge their changes. Git stops the process and asks for help. This situation is called a:

3Multiple Choice

(Conceptual) What is the primary goal of Continuous Integration (CI)?

4Multiple Choice

(Scenario-Based) In a Scrum team, the developers meet for 15 minutes every morning to discuss: 1) What they did yesterday, 2) What they will do today, and 3) Any blockers. This is called:

5Multiple Choice

(Comparison) What is a major advantage of Distributed Version Control (like Git) over Centralized Version Control (like SVN)?

6Multiple Choice

(Conceptual) What is a "Pull Request" (or Merge Request)?

7Multiple Choice

(Scenario-Based) You accidentally committed a sensitive API key to a public GitHub repository. What is the safest way to fix this?

8Multiple Choice

(Conceptual) In software maintenance, what is **"Perfective Maintenance"**?

9Multiple Choice

(Comparison) What is the difference between Git Revert and Git Reset --hard?

10Multiple Choice

(Conceptual) What does the term "Definition of Done" (Do

26Multiple Choice

In C++, what happens when an object allocated with 'new[]' is deallocated using 'delete' instead of 'delete[]'?

29Multiple Choice

Which type of C++ smart pointer maintains a reference count and deletes the managed object only when the last pointer ceases to exist?