Which C++ library is commonly used for vector arithmetic?
int main()
{
int x,y, z;
x=y=z=5;
z= ++x || ++y && ++z;
cout<<x<<y<<z;
return 0;
}
What will be the output of the following C code?
#include<stdio.h>
int main()
{
int x=5;
if(x<1)
printf("hello");
if(x==5)
printf("hi");
else
printf("no");
return 0;
}
What operation does the following function "func" perform on the array?
What is the output of the following C code?
int main()
{
int m=10, *n, **o, ***p;
n=&m;
o=&n;
p=o;
printf("%d %d %d %d", m, *n, **o, ***p);
}
What is Spaghetti programming?
#include <stdio.h>
int *A, stkTop;
int stkFunc (int opcode, int val)
{
static int size=0, stkTop=0;
switch (opcode)
{
case -1:
size = val;
break;
case 0:
if (stkTop < size ) A[stkTop++]=val;
break;
default:
if (stkTop) return A[--stkTop];
}
return -1;
}
int main()
{
int B[20];
A=B;
stkTop = -1;
stkFunc (-1, 10);
stkFunc (0, 5);
stkFunc (0, 10);
printf ("%dn", stkFunc(1, 0)+ stkFunc(1, 0));
}
#include
What will be the output of the following C++ code?
#include <iostream>
#include <memory>
#include <algorithm>
using namespace std;
int main ()
{
int numbers[] = {1, 5, 4, 5};
pair <int*, ptrdiff_t> result = get_temporary_buffer<int>(4);
if (result.second > 0)
{
uninitialized_copy (numbers, numbers + result.second, result.first);
sort (result.first, result.first + result.second);
for (int i = 0; i < result.second; i++)
cout << result.first[i] << " ";
return_temporary_buffer (result.first);
}
return 0;
}