admin

What is the total area of Punjab Province?

What is the result of the given code? #include #include class A{ public: A(int n): m_n(n) {if(0==n) {throw std::logic_error(“0”); } } ~A(){std::printf(“%d”,m_n);} public: const int m_n; }; int main() { try{ A a(1); A b(0); A c(2); } catch (const std::exception &) { std::cout<<3;} std::cout<





Answer Detail

#include #include class A{ public: A(int n): m_n(n) {if(0==n) {throw std::logic_error("0"); } } ~A(){std::printf("%d",m_n);} public: const int m_n; }; int main() { try{ A a(1); A b(0); A c(2); } catch (const std::exception &) { std::cout<<3;} std::cout<<std::endl; return 0; }

comments (0)

#include int main() { int array1[]={1200,200,2300,1230,1543}; int array2[]={12,14,16,18,20}; int temp, result=0; for(temp=0; temp<5; temp++) {result+=array1[temp];} for(temp=0; temp<4; temp++) { result+=array2[temp]; } printf("%d",result); return 0; }





Answer Detail

#include <stdio.h> int main() { int array1[]={1200,200,2300,1230,1543}; int array2[]={12,14,16,18,20}; int temp, result=0; for(temp=0; temp<5; temp++) {result+=array1[temp];} for(temp=0; temp<4; temp++) { result+=array2[temp]; } printf("%d",result); return 0; }

comments (0)

What is the result of the given code fragment? #include class A{ public: A(){f(); } virtual~A(){} public: virtual void f() const {std::cout<<1;} class B : public A{ public: B(){f();} private: virtual void f() const{std::cout<<2;} } int main() { const A *a=new B; delete a; std::cout<





Answer Detail

What is the result of the given code fragment? #include <stdio.h> class A{ public: A(){f(); } virtual~A(){} public: virtual void f() const {std::cout<<1;} class B: public A{ public: B(){f();} private: virtual void f() const{std::cout<<2;} } int main() { const A *a=new B; delete a; std::cout<<std::endl; return 0; }

comments (0)

A transparent DBMS?





Answer Detail

This question is asked in the Riphah Faculty test for the post of lecturer of computer science.

comments (0)