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
please give me answer with details
#include<stdio.h>
main()
{
int i=1;
i=(++i)*(++i)*(++i);
printf("%d",i);
getch();
}
 Question Submitted By :: Sv.mallesh
I also faced this Question!!     Rank Answer Posted By  
 
  Re: please give me answer with details #include<stdio.h> main() { int i=1; i=(++i)*(++i)*(++i); printf("%d",i); getch(); }
Answer
# 1
Answer is :64
 
Is This Answer Correct ?    3 Yes 4 No
Gita
 
  Re: please give me answer with details #include<stdio.h> main() { int i=1; i=(++i)*(++i)*(++i); printf("%d",i); getch(); }
Answer
# 2
++i * ++i * **i
->
2       3     4
now started this way
<-
4   *   4  *   4
=64
 
Is This Answer Correct ?    1 Yes 4 No
Vaseem
 
 
 
  Re: please give me answer with details #include<stdio.h> main() { int i=1; i=(++i)*(++i)*(++i); printf("%d",i); getch(); }
Answer
# 3
The precedence of the operations, should be (reading from
left to right in the equation)

++i   <first ++i i=2>
++i   <second ++i i=3>
*     <first product yields 3*3=9>
++i   <third ++i i=4>
*     <giving the second product 3*4=36>

Thus, the first product (*) is computed before the third ++i
is computed.  Once the first product is completed, i is
incremented to i=4 and the second product can occur now.


Now, if you add some parentheses to the expression giving

++i * (++i * ++i)

then you will get 64, as the other replies suggest.  Tracing
through the order of operations in this one

++i <first ++i i=2> 
++i <second ++I i=3>
++i <third ++I i=4>
*   <the product in the parentheses now yields 4*4=16>
*   <the first * yields 4*16=64>

Here, the first product (*) cannot occur until it knows the
result of the product in the parenthesis.  Thus, all three
increments must occur before the multiplications take place.
 
Is This Answer Correct ?    5 Yes 0 No
Joe
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
post new interiew question and aptitude test papers  1
how to create c progarm without void main()?  1
Is reference used in C?  1
what is a static function Satyam10
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
what are the various memory handling mechanisms in C ? HP3
Give the output for the following program. #define STYLE1 char main() { typedef char STYLE2; STYLE1 x; STYLE2 y; clrscr(); x=255; y=255; printf("%d %d\n",x,y); } ADITI1
C program to perform stack operation using singly linked list  1
what is the differance between pass by reference and pass by value. Infosys4
There are 3 baskets of fruits with worng lables,one basket has apple,another basket has orange,another has combination of apple and orange,what is the least way of interchange the lables. Google10
if a five digit number is input through the keyboard, write a program to calculate the sum of its digits. (hint:-use the modulus operator.'%')  9
why you will give me a job in TCS. TCS5
6. Which of the Following is not defined in string.h? A)strspn() B)strerror() C)memchr() D)strod() Accenture1
what is array? HCL22
There is a 100-story building and you are given two eggs. The eggs (and the building) have an interesting property that if you throw the egg from a floor number less than X, it will not break. And it will always brake if the floor number is equal or greater than X. Assuming that you can reuse the eggs which didn't broke; you got to find X in a minimal number of throws. Give an algorithm to find X in minimal number of throws.  2
for(i=1;i>0;i++); printf("i=%d",i); what will be the answer????  6
write a string copy function routine?  1
how to impliment 2 or more stacks in a single dimensional array ? iFlex1
#define min((a),(b)) ((a)<(b))?(a):(b) main() { int i=0,a[20],*ptr; ptr=a; while(min(ptr++,&a[9])<&a[8]) i=i+1; printf("i=%d\n",i);}  3
What is RAM memory? and What is ROM?Who designed one is temparary and another is permanent?why they designed like that?By using far pointer which type data(whether hexadecimal)we can access? Excel1
 
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