2. Determine the output of each of the following program when it is executed. (a)
#include using namespace std; int main()
{
bool a = true; bool b = true; int c = a-b;
cout <>
} return 0;
(b)
#include using namespace std; int main()
{
bool a = true; bool b = true; int c = a+b;
cout <>
} return 0;
(c)
#include using namespace std; int main()
{
bool a = true; bool b = false; int c = a*b;
cout <>
} return 0;
(d)
#include using namespace std;
int main()
{
bool a = 20; bool b = 210; int c = a+b;
cout <>
} return 0;
(e)
#include using namespace std; int main()
{
bool a = 0; bool b = -1; int c = a+b;
cout <><><><><>
cout <><>
} return 0;
(f)
#include using namespace std; int main()
{
bool a = -200; bool b = -100; int c = a+b;
cout <><><><><>
cout <><>
} return 0;
(g)
#include using namespace std; int main()
{
bool a = -200; bool b = -200; bool c = a+b;
cout <><><><><>
cout <><>
} return 0;
(h)
#include using namespace std; int main()
{
bool a = 0; bool b = 20; bool c = a+b;
cout <><><><><>
cout <><>
} return 0;
(i)
#include using namespace std; int main()
{
}
(j)
bool a = 10; bool b = false; int x = a-b;
cout <><><><><>
cout <><><>
#include using namespace std; int main()
{
}
(k)
wchar_t ch1 = L‘A’; wchar_t ch2 = L‘B’; wchar_t ch3 = L‘C’; wcout
wcout <><>
#include using namespace std; int main()
{
}
(l)
wchar_t ch1 = L‘A’; wchar_t ch2 = L‘B’; wchar_t ch3 = L‘C’; wcout <><><><><><>
#include using namespace std; int main()
{
wchar_t s1[] = L“Hello”; wchar_t s2[] = L“C++”; wchar_t s3[] = L“program”; wcout <>
wcout <><><><>
}