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   To Refer this Site to Your Friends   Click Here
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 3 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 3 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 ?    4 Yes 0 No
Joe
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
How many ways are there to swap two numbers without using temporary variable? Give the each logic.  6
Two's compliment of -5 Adobe3
for(i=1;i>0;i++); printf("i=%d",i); what will be the answer????  6
what is the advantage of using SEMAPHORES to ORDINARY VARIABLES??? NSN1
for(i=0;i=printf("Hello");i++); printf("Hello"); how many times how will be printed?????????  4
Which of the following data structures is on average the fastest for retrieving data: 1) Binary Tree 2) Hash Table 3) Stack  3
int a=2,b=3,c=4; printf("a=%d,b=%d\n",a,b,c); what is the o/p? Verifone6
main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); } what is the output? Ramco4
how many argument we can pas in in a function CTS20
post new interiew question and aptitude test papers  1
How to Clear last bit if it 1 using Macro TURN_OFF_BIT_LAST Adobe2
write a program to generate 1st n fibonacci prime number  5
write a program for even numbers?  8
what is the differnce between AF_INET and PF_INET? Wipro2
different between overloading and overriding  3
how can we use static and extern?and where can we use this? Excel3
How can we see the Expanded source code and compiled code for our source program in C?  1
create an SINGLE LINKED LISTS and reverse the data in the lists completely  3
What is the diffrent between while and do while statement ?  5
without a terminator how can we print a message in a printf () function. NIIT5
 
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