Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
#include
3.
using namespace std;
4.
int main ()
5.
{
6.
int i, n;
7.
int * p;
8.
i = 2;
9.
p= new (nothrow) int[i];
10.
if (p == 0)
11.
cout
Options:
A .  5
B .  55
C .  555
D .  Error: memory could not be allocated
Answer: Option B

As we had given i value as 2, It will print the 5 for two times.
Output:
$ g++ res.cpp
$ a.out
55



Was this answer helpful ?

Submit Solution

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

Latest Videos

Latest Test Papers