Prepare
Practice
Interview
Aptitude
Reasoning
English
GD
Placement papers
HR
Current affairs
Engineering
MCA
MBA
Online test
Login
C output type question
Home
>>
Category
>>
Programming Language (MCQ) questions
>>
C programming
Q. C programming : Trace the output.
void main()
{
int i=2,j=2;
while(i+1?--i:j++)
printf("%d",i);
}
- Published on 19 Oct 15
a.
1
b.
2
c.
ERROR
d.
None of the above.
ANSWER: 1
Related Content
Networking (
207
)
Database (
97
)
C programming (
58
)
Software Engineering (
28
)
SQL (
5
)
HTML (
74
)
Web Technologies (
11
)
Data Structure (
140
)
Operating System (
96
)
Java (
25
)
Oracle (
5
)
C++ (
50
)
Algorithms (
7
)
PL/SQL (
13
)
JavaScript (
7
)
XML (
0
)
CSS (
1
)
Discussion
Vishwesh
-Posted on 11 Oct 16
read parenthesis as"if i+1 is true then --i else j++"
here i+1 =3 which is non zero and anything non zero in C is referred as true so condition becomes and thus --i is executed giving i=1
later printf prints the new value of i which is 1.
I hope this helps.
dolly yadav
-Posted on 30 Apr 16
sir
i request for you .can you explanation this question and dry run
➨
Post your comment / Share knowledge
Required!
Required!
Invalid Email Id!
Required!
Enter the code shown above:
Please enter the code shown above
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)
MCQs
English
Tutorials
Download
▲