Can we declare functions inside structures in C programming?
Which operator is used to access items within a namespace?
What is the output of the following C program?
int main()
{
int a[10];
printf("%d %d", a[-1], a[12]);
}
What is the output of the following code?
int main()
{
int i=1;
if(i<7)
{
i++;
continue;
}
printf("%d",i);
return 0;
}
What is the behavior when a pointer is deleted twice in a C++ program?
Find output of below C program
#include <stdio.h>
int main()
{
char *_ptr;
*_ptr = malloc(10);
*_ptr = 999;
printf("%d",*_ptr);
return 0;
}
What is the output of the following C program?
main()
{
char str[] = "ctest";
printf("%s", str);
printf("%c", str[3]);
printf("%s", &str[3]);
}
#include <stdio.h>
int main()
{
int arr[5];
// Assume base address of arr is 2000 and size of integer is 32 bit
printf("%u %u", arr + 1, &arr + 1);
return 0;
}
Identify the incorrect statement about C++ standard headers.
What will be the output of the following C++ code?
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
int main()
{
vector<int> v(10, 2);
if (all_of(v.cbegin(), v.cend(), [](int i){ return i % 2 == 0; }))
{
cout << "All numbers are even" << endl;
}
else
{
cout << "All numbers are not even" << endl;
}
return 0;
}