Q 16.)#includeusing namespace std;class Base {public:Base(){foo();}virtual void f(){cout << "\nBase::f is being called\n";}void foo(){f();}};class Derive : public Base {public:virtual void f(){cout << "\nDerive::f is being called\n";}};int main(){Derive d; //Base::f is being called.. f being virtual.. Why derived f() is not being called..}why output is not expected..Q.17)int main(){int i=10, j=2;int *ip= &i, *jp = &j;int k = *ip/*jp;printf("%d",k);return...
Thursday, February 25, 2010
Wednesday, February 24, 2010
Q 11.)
Is there a way to multiply two matrix in less than O(n^3) time complexity..
For this Q algorithm was asked, if you guys don't know the answer then make a comment below and I will tell the answer or just take some efforts to search it.
Q 12.)
#include
using namespace std;
int main()
{
int a,c,foo;
char *p;
cin>>a>>c;// give two numbers..
p=(char *)a;
foo= (int)&p[c];
cout<foo; return 0;
}
what this code snippet does...
even...
Q 6.)#include int main(){int a=3, b = 5;printf(&"Ya!Hello! how is this? %s\n"[a], &b["junk/super"]);printf(&"WHAT%c%c%c %c%c %c !\n"[a], 1["this"],2["beauty"],0["tool"],0["is"],3["sensitive"],4["CCCCCC"]);return 0;}is this a valid c program....Q 7.)The following C program segfaults of IA-64, but works fine on IA-32.int main(){ int* p;p = (int*)malloc(sizeof(int));*p = 10;return 0; }Why does it happen so?Q 8.)#include #define f(a,b) a##b#define...
Q1.)#include#define TOTAL_ELEMENTS (sizeof(array) / sizeof(array[0]))int array[] = {23,34,12,17,204,99,16};int main(){signed int d;printf("Total Elements in the array are => %d\n",TOTAL_ELEMENTS);for(d=-1;d <= (TOTAL_ELEMENTS-2);d++)printf("%d\n",array[d+1]);printf("Did u see the output..");return 0;} Q 2.) File1.c 1 int arr[80]; File2.c extern int *arr;int main(){arr[1] = 100;return 0;}what should be the output.. Q 3.) #includeint main(){int...
Subscribe to:
Posts (Atom)