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                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
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 4 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 ?    3 Yes 1 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 ?    1 Yes 2 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 ?    3 Yes 0 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 ?    0 Yes 2 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 2 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 ?    0 Yes 2 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 ?    3 Yes 0 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 ?    5 Yes 0 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 2 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 ?    0 Yes 2 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 ?    1 Yes 0 No
Madhu
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
how to find the size of the data type like int,float without using the sizeof operator?  5
WRITE A PROGRAM TO FIND A REVERSE OF TWO NO  5
WAP to accept rollno,course name & marks of a student & display grade if total marks is above 200?  2
Which of the following sorts is quickest when sorting the following set: 1 2 3 5 4 1) Quick Sort 2) Bubble Sort 3) Merge Sort  3
write a Program to dispaly upto 100 prime numbers(without using Arrays,Pointer) Wipro5
How would you write qsort?  1
f1() { f(3);} f(int t) { switch(t); { case 2: c=3; case 3: c=4; case 4: c=5; case 5: c=6; default: c=0;} value of c? Geometric-Software5
Why doesn't C have nested functions?  1
Program to display given 3 integers in ascending order N-Tech1
helllo sir , what is the main use of the pointer ,array ,and the structure with the example of a programe  1
#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 are the preprocessors? HP3
Explain the differences between public, protected, private and internal.  1
Difference between fopen() and open()? Aricent2
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............ Infosys1
write an interactive program to generate the divisors of a given integer. TCS2
main() { int x=5; printf("%d %d %d\n",x,x<<2,x>>2); } what is the output? Ramco6
Which of the following are valid "include" formats? A)#include and #include[file.h] B)#include (file.h) and #include C)#include [file.h] and #include "file.h" D)#include <file.h> and #include "file.h" Accenture12
write a program to sort the elements in a given array in c language  2
what's the o/p int main(int n, char *argv[]) { char *s= *++argv; puts(s); exit(0); } Motorola1
 
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