main()

{

int x=5;

for(;x!=0;x--) {

printf("x=%d\n", x--);

}

}

a. 5, 4, 3, 2,1

b. 4, 3, 2, 1, 0

c. 5, 3, 1

d. none of the above

Answers were Sorted based on User's Feedback



main() { int x=5; for(;x!=0;x--) { printf("x=%d\n", x--); } } ..

Answer / guest

d) Infinite loop as x is decremented twice, it never be 0

and loop is going on & on

Is This Answer Correct ?    13 Yes 0 No

main() { int x=5; for(;x!=0;x--) { printf("x=%d\n", x--); } } ..

Answer / ajit

first error in 4 step as syntax error
this is so that for(x!=0;x--) answer is d becoze here
not defined x=?

Is This Answer Correct ?    0 Yes 10 No

Post New Answer

More C Code Interview Questions

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,


Set up procedure for generating a wire frame display of a polyhedron with the hidden edges of the object drawn with dashed lines

0 Answers   IBM,


main() { int i = 100; clrscr(); printf("%d", sizeof(sizeof(i))); } a. 2 b. 100 c. 4 d. none of the above

5 Answers   HCL,


main(int argc, char *argv[]) { (main && argc) ? main(argc-1, NULL) : return 0; } a. Runtime error. b. Compile error. Illegal syntax c. Gets into Infinite loop d. None of the above

4 Answers   HCL, LG,


union u { struct st { int i : 4; int j : 4; int k : 4; int l; }st; int i; }u; main() { u.i = 100; printf("%d, %d, %d",u.i, u.st.i, u.st.l); } a. 4, 4, 0 b. 0, 0, 0 c. 100, 4, 0 d. 40, 4, 0

1 Answers   HCL,






#include"math.h" void main() { printf("Hi everybody"); } if <stdio.h> will be included then this program will must compile, but as we know that when we include a header file in "" then any system defined function find its defination from all the directrives. So is this code of segment will compile? If no then why?

2 Answers  


main() { register int a=2; printf("Address of a = %d",&a); printf("Value of a = %d",a); }

3 Answers  


write a function to give demostrate the functionality of 3d in 1d. function prototye: change(int value,int indexX,int indexY,int indexZ, int [] 1dArray); value=what is the date; indexX=x-asix indexY=y-axis indexZ=z-axis and 1dArray=in which and where the value is stored??

0 Answers   Nagarro,


Ramesh’s basic salary is input through the keyboard. His dearness allowance is 40% of basic salary, and house rent allowance is 20% of basic salary. Write a program to calculate his gross salary.

1 Answers  


Write a procedure to implement highlight as a blinking operation

2 Answers  


Derive expression for converting RGB color parameters to HSV values

1 Answers  


print a semicolon using Cprogram without using a semicolon any where in the C code in ur program!!

35 Answers   Tata Elxsi, TCS, VI eTrans,


Categories