ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
main()
{
	int x=10,y=15;
	x=x++;
	y=++y;
	printf("%d %d\n",x,y);
}

output??
 Question Submitted By :: Naveed
I also faced this Question!!     Rank Answer Posted By  
 
  Re: main() { int x=10,y=15; x=x++; y=++y; printf("%d %d\n",x,y); } output??
Answer
# 1
35   39
 
Is This Answer Correct ?    0 Yes 11 No
Mannucse
[Kiona]
 
  Re: main() { int x=10,y=15; x=x++; y=++y; printf("%d %d\n",x,y); } output??
Answer
# 2
11 16
 
Is This Answer Correct ?    10 Yes 3 No
Mahendra Giri
 
 
 
  Re: main() { int x=10,y=15; x=x++; y=++y; printf("%d %d\n",x,y); } output??
Answer
# 3
Ans: 10,16
 
Is This Answer Correct ?    7 Yes 7 No
Sathya.r
 
  Re: main() { int x=10,y=15; x=x++; y=++y; printf("%d %d\n",x,y); } output??
Answer
# 4
in x=x++;
the above expression is postfix
first we assign 10 into x then increment it by one so value 
of x become 11
ic case of 
y=++y;
is prefix expression firstly we increment value of y
then assign it to y.
so y become
y=16
 
Is This Answer Correct ?    8 Yes 1 No
Mazrul
 
  Re: main() { int x=10,y=15; x=x++; y=++y; printf("%d %d\n",x,y); } output??
Answer
# 5
the answer is 10 and 16..
in the case of postfix,the value will be displayed first
[that is the difference between postfix and prefix]..
when the main function is again called and the value is 
displayed it will b'com..11 and 17..
 
Is This Answer Correct ?    2 Yes 5 No
Subha Raman
 
  Re: main() { int x=10,y=15; x=x++; y=++y; printf("%d %d\n",x,y); } output??
Answer
# 6
10,15
 
Is This Answer Correct ?    0 Yes 8 No
Kalai
 
  Re: main() { int x=10,y=15; x=x++; y=++y; printf("%d %d\n",x,y); } output??
Answer
# 7
11,15
 
Is This Answer Correct ?    1 Yes 7 No
Nirmala
 
  Re: main() { int x=10,y=15; x=x++; y=++y; printf("%d %d\n",x,y); } output??
Answer
# 8
hai Mannu how it will become 35, 39. the answer is only 11 
and 16 ok...


thanks
chandra
 
Is This Answer Correct ?    4 Yes 2 No
Chandrakala
 
  Re: main() { int x=10,y=15; x=x++; y=++y; printf("%d %d\n",x,y); } output??
Answer
# 9
the ans is 11 and 16..

y = ++y;

wont make any differance as a statement.

we will have to think about it only if we are using it in 
loops.. or conditional statements etc.. :-)

so dont get confused.
dont forget ur basics..

C is a procedural language.
hence

x = x++;
will be completely executed first
the value of x = 11.

and then

y = ++y;
will be executed and value will be changed to 16
 
Is This Answer Correct ?    6 Yes 2 No
Shruti
 
  Re: main() { int x=10,y=15; x=x++; y=++y; printf("%d %d\n",x,y); } output??
Answer
# 10
11 15
 
Is This Answer Correct ?    0 Yes 6 No
Rasel
 
  Re: main() { int x=10,y=15; x=x++; y=++y; printf("%d %d\n",x,y); } output??
Answer
# 11
11

15
 
Is This Answer Correct ?    1 Yes 5 No
Sheikh Rasel
 
  Re: main() { int x=10,y=15; x=x++; y=++y; printf("%d %d\n",x,y); } output??
Answer
# 12
hey how come 15 ....
ans is 11,16
 
Is This Answer Correct ?    4 Yes 2 No
Madhu
 
  Re: main() { int x=10,y=15; x=x++; y=++y; printf("%d %d\n",x,y); } output??
Answer
# 13
the answer is 10,16.
because x=x++;
means first assign after that that is incremented.
in case of y=++y;
first increment operation is performed. after that assigned.
 
Is This Answer Correct ?    0 Yes 0 No
Gita
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
int *a[5] refers to TCS8
I use turbo C which allocates 2 bytes for integers and 4 bytes for long. I tried to declare array of size 500000 of long type using the following code... long *arr; arr=(long *)(malloc)(500000 * sizeof(long)); It gives a warning that "Conversion may lose significant digits in function main"... And the resulting array size was very less around 8400 as compared to 500000. Any suggestions will be welcomed....  2
what is a far pointer TCS9
Reverse a string word by word??  6
WAP – represent a char in binary format Motorola4
#define MAX(x,y) (x) > (y) ? (x) : (y) main() { int i = 10, j = 5, k = 0; k = MAX(i++, ++j); printf("%d %d %d", i,j,k); } what will the values of i , j and k? } NDS9
What is an object?  3
What is an volatile variable? HP12
Write a program that accepts a string where multiple spaces are given in between the words. Print the string ignoring the multiple spaces. Example: Input: “ We.....Are....Student “ Note: one .=1 Space Output: "We Are Student" IBM4
write a program to sort the elements in a given array in c language  2
tell me the full form of c?  2
logic for generating all the combinations of the any number of given letters. ex::::::::: if a,b,c,d are given the o/p should be abcd,dcba,dbac,bcad,................ 4*3*2*1 combinations............ Infosys2
write a program to print the all 4digits numbers & whose squares must me even numbers? Virtusa2
What is C language Terminator? TCS12
What is the output of the following program #include<stdio.h> main() { int i=0; fork(); printf("%d",i++); fork(); printf("%d",i++); fork(); wait(); } ADITI5
When is an interface "good"?  1
Why the use of alloca() is discouraged? Oracle2
Would you rather wait for the results of a quicksort, a linear search, or a bubble sort on a 200000 element array? 1) Quicksort 2) Linear Search 3) Bubble Sort  2
DIFFERNCE BETWEEN THE C++ AND C LANGUAGE? Wipro2
9.how do you write a function that takes a variable number of arguments? What is the prototype of printf () function? 10.How do you access command-line arguments? 11.what does ‘#include<stdio.h>’ mean? 12.what is the difference between #include<> and #include”…”? 13.what are # pragma staments? 14.what is the most appropriate way to write a multi-statement macro?  1
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com