int i,j;

for(i=0;i<=10;i++)

{

j+=5;

assert(i<5);

}

Answers were Sorted based on User's Feedback



int i,j; for(i=0;i<=10;i++) { j+=5; assert(i<5); }..

Answer / susie

Answer :

Runtime error: Abnormal program termination.

assert failed (i<5), <file name>,<line number>

Explanation:

asserts are used during debugging to make sure that certain
conditions are satisfied. If assertion fails, the program
will terminate reporting the same. After debugging use,

#undef NDEBUG

and this will disable all the assertions from the
source code. Assertion

is a good debugging tool to make use of.

Is This Answer Correct ?    13 Yes 2 No

int i,j; for(i=0;i<=10;i++) { j+=5; assert(i<5); }..

Answer / cmonkey

j has not been initialized, so j could hold any garbage.
Depending upon what was in j, assertion could pass or fail.

Is This Answer Correct ?    3 Yes 0 No

int i,j; for(i=0;i<=10;i++) { j+=5; assert(i<5); }..

Answer / guest

error

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More C Code Interview Questions

int aaa() {printf(“Hi”);} int bbb(){printf(“hello”);} iny ccc(){printf(“bye”);} main() { int ( * ptr[3]) (); ptr[0] = aaa; ptr[1] = bbb; ptr[2] =ccc; ptr[2](); }

1 Answers  


main( ) { static int a[ ] = {0,1,2,3,4}; int *p[ ] = {a,a+1,a+2,a+3,a+4}; int **ptr = p; ptr++; printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr); *ptr++; printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr); *++ptr; printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr); ++*ptr; printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr); }

2 Answers   Persistent,


main() { int i, n; char *x = “girl”; n = strlen(x); *x = x[n]; for(i=0; i<n; ++i) { printf(“%s\n”,x); x++; } }

2 Answers  


#if something == 0 int some=0; #endif main() { int thing = 0; printf("%d %d\n", some ,thing); }

1 Answers  


how to delete an element in an array

2 Answers   IBM,






Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.

9 Answers   Microsoft,


char *someFun() { char *temp = “string constant"; return temp; } int main() { puts(someFun()); }

1 Answers  


#define square(x) x*x main() { int i; i = 64/square(4); printf("%d",i); }

4 Answers   Google, HCL, Quick Heal, WTF,


int a = 10 + 10 .... ,... A = A * A What would be the value of A? The answer is 120!! Could anyone explain this to me.

2 Answers   Bosch, eInfochips, HCL, IHCL,


main() { char c; int i = 456; clrscr(); c = i; printf("%d", c); } a. 456 b. -456 c. random number d. none of the above

3 Answers   BrickRed, HCL,


main() { unsigned int i=65000; while(i++!=0); printf("%d",i); }

1 Answers  


plz send me all data structure related programs

2 Answers  


Categories