4. What is the output of the following C++ program?

#include <iostream>
#include <stdexcept>

class A
{
public:
    A(int n)
    {
        if (0 == n) {
            throw std::logic_error("0");
        }
    }
};

int main()
{
    A *p0 = nullptr, *p1 = nullptr, *p2 = nullptr;
    try {
        p1 = new A(1);
        p0 = new A(0);
        p2 = new A(2);
    }
    catch (const std::exception &) {
        std::cout << 3;
    }

    std::cout << ((0 != p1) ? 1 : 0);
    std::cout << ((0 != p0) ? 1 : 0);
    std::cout << ((0 != p2) ? 1 : 0) << std::endl;

    delete p1;
    delete p0;
    delete p2;

    return 0;
}