|
Question |
Rating |
View Answer |
|
main() { signed int bit=512, i=5; for(;i;i--) { printf("%dn", bit >> (i - (i -1))); } }
|
|
View Answer |
|
main() { if (!(1&&0)) { printf("OK I am done."); } else { printf("OK I am gone."); } }
|
|
View Answer |
|
main() { signed int bit=512, mBit; { mBit = ~bit; bit = bit & ~bit ; printf("%d %d", bit, mBit); } }
|
|
View Answer |
|
What would be the output of the following program? main() { int i=4; switch(i) { default: printf("n A mouse is an elephant built by the Japanese"); case 1: printf(" Breeding rabbits is a hair raising experience"); break; case 2: printf("n Friction is a drag"); break; case 3: printf("n If practice make perfect, then nobody's perfect"); } }
|
|
View Answer |
|
What is the output of the following program?
#define SQR(x) (x*x)
main()
{
int a,b=3;
a= SQR(b+2);
printf("%d",a);
}
|
|
View Answer |
|
In which line of the following, an error would be reported? 1. #define CIRCUM(R) (3.14*R*R); 2. main() 3. { 4. float r=1.0,c; 5. c= CIRCUM(r); 6. printf("n%f",c); 7. if(CIRCUM(r))==6.28) 8. printf("nGobbledygook"); 9. }
|
|
View Answer |
|
If the program (myprog) is run from the command line as myprog 1 2 3 , What would be the output?
main(int argc, char *argv[]) { int i; for(i=0;i<argc;i++) printf("%s",argv[i]); }
|
|
View Answer |
|
If the following program (myprog) is run from the command line as myprog 1 2 3, What would be the output?
main(int argc, char *argv[]) { int i,j=0; for(i=0;i<argc;i++) j=j+ atoi(argv[i]); printf("%d",j); }
|
|
View Answer |
|
If the following program (myprog) is run from the command line as myprog monday tuesday wednesday thursday What would be the output?
main(int argc, char *argv[]) { while(--argc >0) printf("%s",*++argv); }
|
|
View Answer |
|
What would be the output of the following program?
main() { int y=128; const int x=y; printf("%d",x); }
|
|
View Answer |
|
What would be the output of the following program?
main() { int y=128; const int x=y; printf("%d",x); }
|
|
View Answer |
|
What would be the output of the following program?
main() { char near * near *ptr1; char near * far *ptr2; char near * huge *ptr3; printf("%d %d %d",sizeof(ptr1),sizeof(ptr2),sizeof(ptr3)); }
|
|
View Answer |
|
If the following program (myprog) is run from the command line as myprog friday tuesday sunday, What would be the output?
main(int argc, char*argv[]) { printf("%c",**++argv); }
|
|
View Answer |
|
If the following program (myprog) is run from the command line as myprog friday tuesday sunday, What would be the output?
main(int argc, char *argv[]) { printf("%c",*++argv[1]); }
|
|
View Answer |
|
Would the following program compile?
main() { int a=10,*j; void *k; j=k=&a; j++; k++; printf("n%u%u",j,k); }
|
|
View Answer |
|
According to ANSI specifications which is the correct way of declaring main() when it receives command line arguments?
|
|
View Answer |
|
What would be the output of the following program? main() { const int x=5; int *ptrx; ptrx=&x; *ptrx=10; printf("%d",x); }
|
|
View Answer |
|
In the following code, in which order the functions would be called? x = f1(23,14)*f2(12/4)+f3();
a) f1, f2, f3 b) f3, f2, f1 c) The order may vary from compiler to compiler d) None of the above
|
|
View Answer |
|
What is the draw back in using friend function in c++
|
|
View Answer |
|
How can you get the number of elements in an array allocated dynamically at runtime? For example - int *p = (int *) malloc(sizeof(int) * n);
int numElems = ??????? /* n is not available here */
|
|
View Answer |