15 real Memory and RAII questions from the C++ bank, as asked in Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd — free to start.
1. What is new expression?
Junior
A.a reference-counted smart pointer that deletes its managed object only when the last owner sharing the count is destroyed
B.allocates an object on the free store and runs its constructor, returning a pointer that must later be released to avoid a leak
C.a non-owning observer of a shared resource that does not affect the reference count and is used to break ownership cycles
D.a technique that ties resource acquisition to object construction and release to destruction, guaranteeing cleanup when scope exits even on exceptions
2. Which term means: "allocates an object on the free store and runs its constructor, returning a pointer that must later be released to avoid a leak"?
A.new expression — allocates an object on the free store and runs its constructor, returning a pointer that must later be released to avoid a leak
B.new expression — a non-owning observer of a shared resource that does not affect the reference count and is used to break ownership cycles
C.new expression — a technique that ties resource acquisition to object construction and release to destruction, guaranteeing cleanup when scope exits even on exceptions
D.new expression — a reference-counted smart pointer that deletes its managed object only when the last owner sharing the count is destroyed
A.allocates an object on the free store and runs its constructor, returning a pointer that must later be released to avoid a leak
B.a non-owning observer of a shared resource that does not affect the reference count and is used to break ownership cycles
C.a reference-counted smart pointer that deletes its managed object only when the last owner sharing the count is destroyed
D.a technique that ties resource acquisition to object construction and release to destruction, guaranteeing cleanup when scope exits even on exceptions
5. Which term means: "a technique that ties resource acquisition to object construction and release to destruction, guaranteeing cleanup when scope exits even on exceptions"?
A.RAII — a non-owning observer of a shared resource that does not affect the reference count and is used to break ownership cycles
B.RAII — a technique that ties resource acquisition to object construction and release to destruction, guaranteeing cleanup when scope exits even on exceptions
C.RAII — a move-only smart pointer expressing exclusive ownership that automatically deletes its managed object and cannot be copied
D.RAII — allocates an object on the free store and runs its constructor, returning a pointer that must later be released to avoid a leak
A.a move-only smart pointer expressing exclusive ownership that automatically deletes its managed object and cannot be copied
B.allocates an object on the free store and runs its constructor, returning a pointer that must later be released to avoid a leak
C.a reference-counted smart pointer that deletes its managed object only when the last owner sharing the count is destroyed
D.a technique that ties resource acquisition to object construction and release to destruction, guaranteeing cleanup when scope exits even on exceptions
A.a non-owning observer of a shared resource that does not affect the reference count and is used to break ownership cycles
B.a technique that ties resource acquisition to object construction and release to destruction, guaranteeing cleanup when scope exits even on exceptions
C.a reference-counted smart pointer that deletes its managed object only when the last owner sharing the count is destroyed
D.allocates an object on the free store and runs its constructor, returning a pointer that must later be released to avoid a leak
A.std::shared_ptr — a non-owning observer of a shared resource that does not affect the reference count and is used to break ownership cycles
B.std::shared_ptr — a reference-counted smart pointer that deletes its managed object only when the last owner sharing the count is destroyed
C.std::shared_ptr — a technique that ties resource acquisition to object construction and release to destruction, guaranteeing cleanup when scope exits even on exceptions
D.std::shared_ptr — a move-only smart pointer expressing exclusive ownership that automatically deletes its managed object and cannot be copied
A.a move-only smart pointer expressing exclusive ownership that automatically deletes its managed object and cannot be copied
B.a technique that ties resource acquisition to object construction and release to destruction, guaranteeing cleanup when scope exits even on exceptions
C.allocates an object on the free store and runs its constructor, returning a pointer that must later be released to avoid a leak
D.a non-owning observer of a shared resource that does not affect the reference count and is used to break ownership cycles
A.std::weak_ptr — a move-only smart pointer expressing exclusive ownership that automatically deletes its managed object and cannot be copied
B.std::weak_ptr — allocates an object on the free store and runs its constructor, returning a pointer that must later be released to avoid a leak
C.std::weak_ptr — a technique that ties resource acquisition to object construction and release to destruction, guaranteeing cleanup when scope exits even on exceptions
D.std::weak_ptr — a non-owning observer of a shared resource that does not affect the reference count and is used to break ownership cycles
Answers, AI explanations, and a scored voice mock interview
Sign up free to check your answers with explanations, ask the AI tutor anything on any question, and take one full AI mock interview — scored like a real panel.