how many max number of arguments can a c99 compiler take?
What will be the output of the following C++ code?
What is the output of the following C code?
int main()
{
char i = 128;
while (i)
{
printf("%d", i);
i++;
}
}
What will be the output of the following C++ code?
#include <stdio.h>
#include <math.h>
int main()
{
printf("%.6f", fabs(-10.6));
return 0;
}
Consider the following function implemented in C:
void printxy(int x, int y) { int *ptr; x = 0; ptr = &x; y = *ptr; *ptr = 1; printf("%d,%d", x, y); }
The output of the printxy(1,1) is
Consider the following C program:
#include<stdio.h> int main(){ int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 5}, *ip = arr + 4; printf("%dn", ip[1]); return 0; }
The number that will be displayed on execution of the program is
What will be the output of the following C++ code?
#include <iostream>
#include <vector>
#include <iterator>
using namespace std;
int main()
{
vector<int> myvector;
for (int i = 1; i <= 10; i++)
myvector.push_back(i);
myvector.erase(myvector.begin() + 5);
myvector.erase(myvector.begin(), myvector.begin() + 4);
for (unsigned i = 0; i < myvector.size(); ++i)
cout << ' ' << myvector[i];
return 0;
}
What happens if we run the following code in both C and C++?
#include<stdio.h>
struct STRUCT
{
int a;
int func()
{
printf("HELLO THIS IS STRUCTURE\n");
}
};
int main()
{
struct STRUCT s;
s.func();
return 0;
}
What will be the output of the following C++ code?
#include <iostream>
#include <iterator>
#include <list>
using namespace std;
int main() {
list<int> firstlist, secondlist;
for (int i = 1; i <= 2; i++) {
firstlist.push_back(i);
secondlist.push_back(i * 10);
}
list<int>::iterator it;
it = firstlist.begin();
advance(it, 1);
copy(secondlist.begin(), secondlist.end(), inserter(firstlist, it));
for (it = firstlist.begin(); it != firstlist.end(); ++it)
cout << *it << " ";
return 0;
}
What is the space complexity of the following dynamic programming algorithm used to find the maximum sub-array sum?
#include<stdio.h>
int max_num(int a,int b)
{
if(a> b)
return a;
return b;
}
int maximum_subarray_sum(int *arr, int len)
{
int sum[len], idx;
sum[0] = arr[0];
for(idx = 1; idx < len; idx++)
sum[idx] = max_num(sum[idx - 1] + arr[idx], arr[idx]);
int mx = sum[0];
for(idx = 0; idx < len; idx++)
if(sum[idx] > mx)
mx =sum[idx];
return mx;
}
int main()
{
int arr[] = {-2, -5, 6, -2, 3, -1, 0,-5, 6}, len = 9;
int ans = maximum_subarray_sum(arr, len);
printf("%d",ans);
return 0;
}
OnSite
1 Openings
FullTime
Posted 17 days ago