a=5
a=a++/++a

Answers were Sorted based on User's Feedback



a=5 a=a++/++a..

Answer / prasannanjaneyulu.kandimalla

a=5;
a=a++/++a;
in that numerator is 5 and denominator is 6(finally a value
is:6)
so a=6/6=1
finally a is postincremented so it is2(1+1)

Is This Answer Correct ?    17 Yes 4 No

a=5 a=a++/++a..

Answer / nirbhaykumar

a=2

Is This Answer Correct ?    16 Yes 10 No

a=5 a=a++/++a..

Answer / nikhil saraf

a=1

Is This Answer Correct ?    15 Yes 10 No

a=5 a=a++/++a..

Answer / harinath

as the above person said the answer is right but
at first the evaluation starts from denominator, according
to operator precedence pre-increment has more value than
other two(/ and post-increment)
so at first ++a=6 is assigned to a
now the value in a is 6 .so 6/6 gives the value 1.
then post-increment occurs to the value in a(ie.,1).
so the value of a is finally 2(1+1).

Is This Answer Correct ?    6 Yes 2 No

a=5 a=a++/++a..

Answer / svs

2
5=5++/++5
6=6++/6
6=6/6
6=1+increments one
answer is two

Is This Answer Correct ?    2 Yes 0 No

a=5 a=a++/++a..

Answer / ravi

a=5/7
a=0;

Is This Answer Correct ?    2 Yes 0 No

a=5 a=a++/++a..

Answer / rajesh kumar swain

here a++/++a=5/7

Is This Answer Correct ?    1 Yes 0 No

a=5 a=a++/++a..

Answer / kathir

undefined

Is This Answer Correct ?    1 Yes 2 No

a=5 a=a++/++a..

Answer / ajeet kumar

Ans a=2.

here a=a++/++a; //initial value of a=5.
1)firstly a=a++/++a <---it is pre-increment so firstly this
value will update.i.e a will be 6.
a=a++/6; //a=6
a=6/6; a=1;//after this line executions one increment will left of variable a.

Is This Answer Correct ?    0 Yes 1 No

a=5 a=a++/++a..

Answer / ss

answer can be 2 and 1 as well
actually it is compiler dependent

Is This Answer Correct ?    0 Yes 4 No

Post New Answer

More C Interview Questions

write a program to remove duplicate from an ordered char array? in c

2 Answers  


how to use enum datatype?Please explain me?

3 Answers   Excel,


please can some one guide me, to the answer Write a C program to enter 15 numbers as an input from the keyboard and program will find and print odd numbers and their average. i have studied while and do while loop for loop if and else if switch

2 Answers  


What are the restrictions of a modulus operator?

0 Answers  


What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?

0 Answers   Aspire, Infogain,






#include<stdio.h> #include<conio.h> struct stu { int i; char j; }; union uni { int i; char j; }; void main() { int j,k; clrscr(); struct stu s; j=sizeof(s); printf("%d",j); union uni u; k=sizeof(u); printf("%d",k); getch(); } what is value of j and k.

2 Answers   Facebook,


Who invented bcpl language?

0 Answers  


Why doesn't C support function overloading?

2 Answers  


Here is a neat trick for checking whether two strings are equal

0 Answers  


Can a file other than a .h file be included with #include?

0 Answers   Aspire, Infogain,


write a programme to enter some number and find which number is maximum and which number is minimum from enterd numbers.

3 Answers  


What is the output of below code? main() { static in a=5; printf("%3d",a--); if(a) main(); }

4 Answers   Infosys, TCS,


Categories