Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
char* ptr;
6.
unsigned long int a = (size_t(0) / 3);
7.
cout
Options:
A .  0
B .  2
C .  bad_alloc
D .  depends on compiler
Answer: Option A

As we are dividing the zero by three, it is returning 0.
Output:
$ g++ std2.cpp
$ a.out
0



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers