#include &lt;new&gt;    #include&lt;cstdlib&gt;    #include &lt;iostream&gt;    using namespace std;    class X;    struct Node     &#123;        X* data;        bool filled;        Node&#40;&#41; : filled&#40;false&#41; &#123; &#125;    &#125;;    class X     &#123;        static Node buffer&#91;&#93;;        public:        int number;        enum &#123; size = 3&#125;;        void* operator new&#40;size_t sz&#41; throw &#40;const char*&#41;        &#123;            void* p = malloc&#40;sz&#41;;            if &#40;sz == 0&#41;                throw &quot;Error: malloc() failed&quot;;            cout &lt;&lt; &quot;X :: operator new(size_t)&quot; &lt;&lt; endl;            return p;        &#125;        void *operator new&#40;size_t sz, int location&#41; throw &#40;const char*&#41;         &#123;            cout &lt;&lt; &quot;X :: operator new(size_t, &quot; &lt;&lt; location &lt;&lt; &quot;)&quot; &lt;&lt; endl;            void* p = 0;            if &#40;location &lt; 0 || location &gt;= size || buffer&#91;location&#93;.filled == true&#41;            &#123;                throw &quot;Error: buffer location occupied&quot;;            &#125;            else             &#123;                p = malloc&#40;sizeof&#40;X&#41;&#41;;                if &#40;p == 0&#41;                     throw &quot;Error: Creating X object failed&quot;;                buffer&#91;location&#93;.filled = true;                buffer&#91;location&#93;.data = &#40;X*&#41; p;            &#125;            return p;        &#125;        static void printbuffer&#40;&#41;         &#123;            for &#40;int i = 0; i &lt; size; i++&#41;             &#123;                cout &lt;&lt; buffer&#91;i&#93;.data-&gt;number &lt;&lt; endl;            &#125;        &#125;     &#125;;    Node X::buffer&#91;size&#93;;    int main&#40;&#41;    &#123;        try         &#123;            X* ptr1 = new X;            X* ptr2 = new&#40;0&#41; X;            X* ptr3 = new&#40;1&#41; X;            X* ptr4 = new&#40;2&#41; X;            ptr2-&gt;number = 10000;            ptr3-&gt;number = 10001;            ptr4-&gt;number = 10002;            X :: printbuffer&#40;&#41;;            X* ptr5 = new&#40;0&#41; X;        &#125;        catch &#40;const char* message&#41;         &#123;            cout &lt;&lt; message &lt;&lt; endl;        &#125;    &#125;
A. X::operator new(size_t)
B. Error
C. Runtime error
D. None of the mentioned
Answer:A
#include &lt;new&gt;    #include&lt;cstdlib&gt;    #include &lt;iostream&gt;    using namespace std;    class X;    struct Node     &#123;        X* data;        bool filled;        Node&#40;&#41; : filled&#40;false&#41; &#123; &#125;    &#125;;    class X     &#123;        static Node buffer&#91;&#93;;        public:        int number;        enum &#123; size = 3&#125;;        void* operator new&#40;size_t sz&#41; throw &#40;const char*&#41;        &#123;            void* p = malloc&#40;sz&#41;;            if &#40;sz == 0&#41;                throw &quot;Error: malloc() failed&quot;;            cout &lt;&lt; &quot;X :: operator new(size_t)&quot; &lt;&lt; endl;            return p;        &#125;        void *operator new&#40;size_t sz, int location&#41; throw &#40;const char*&#41;         &#123;            cout &lt;&lt; &quot;X :: operator new(size_t, &quot; &lt;&lt; location &lt;&lt; &quot;)&quot; &lt;&lt; endl;            void* p = 0;            if &#40;location &lt; 0 || location &gt;= size || buffer&#91;location&#93;.filled == true&#41;            &#123;                throw &quot;Error: buffer location occupied&quot;;            &#125;            else             &#123;                p = malloc&#40;sizeof&#40;X&#41;&#41;;                if &#40;p == 0&#41;                     throw &quot;Error: Creating X object failed&quot;;                buffer&#91;location&#93;.filled = true;                buffer&#91;location&#93;.data = &#40;X*&#41; p;            &#125;            return p;        &#125;        static void printbuffer&#40;&#41;         &#123;            for &#40;int i = 0; i &lt; size; i++&#41;             &#123;                cout &lt;&lt; buffer&#91;i&#93;.data-&gt;number &lt;&lt; endl;            &#125;        &#125;     &#125;;    Node X::buffer&#91;size&#93;;    int main&#40;&#41;    &#123;        try         &#123;            X* ptr1 = new X;            X* ptr2 = new&#40;0&#41; X;            X* ptr3 = new&#40;1&#41; X;            X* ptr4 = new&#40;2&#41; X;            ptr2-&gt;number = 10000;            ptr3-&gt;number = 10001;            ptr4-&gt;number = 10002;            X :: printbuffer&#40;&#41;;            X* ptr5 = new&#40;0&#41; X;        &#125;        catch &#40;const char* message&#41;         &#123;            cout &lt;&lt; message &lt;&lt; endl;        &#125;    &#125;
A. X::operator new(size_t) B. Error C. Runtime error D. None of the mentioned
Explanation:In this program, We are giving a location to two variables in the program, So it is arising an exception.