What will be the output of the following C++ program? #include <iostream> using namespace std; class A{ public: A(){ cout<<"Constructor called\n"; } ~A(){ cout<<"Destructor called\n"; } }; int main(int argc, char const *argv[]) { A *a = new A[5]; delete[] a; return 0; } a) Segmentation fault b) “Constructor called” five times and then “Destructor called” five times c) “Constructor called” five times and then “Destructor called” once d) Error
What will be the output of the following C++ program? #include <iostream> using namespace std; class A{ public: A(){ cout<<"Constructor called\n"; } ~A(){ cout<<"Destructor called\n"; } }; int main(int argc, char const *argv[]) { A *a = new A[5]; delete[] a; return 0; } a) Segmentation fault b) “Constructor called” five times and then “Destructor called” five times c) “Constructor called” five times and then “Destructor called” once d) Error
Share
d) Error
Answer: a
Explanation: The equivalent cylindrical form is given by,
B = (10sin θ/r + rcos2θ)i + j + (10cos θ/r –r sin θ cos θ)k
At (5, π/2, -2), r = √(52+-22
) = √29
sin θ = 5/√29 and cos θ = -2/√29
Thus, B = 2.467i + j + 1.167k.
C. drive .