A Place for Latest Exam wise Questions, Videos, Previous Year Papers, Study Stuff for MCA Examinations - NIMCET
Previous Year Question (PYQs)
3
What will be values for $a$ and $c$ after execution of the following code if $a$ is $10$, $b$ is $5$, and $c$ is $10$?
if ((a > b) && (a <= c))
a = a + 1;
else
c = c + 1;
Solution
$a>b$ is $10>5$ (true) and $a\le c$ is $10\le10$ (true).
Condition is true $\Rightarrow$ execute $a=a+1 \Rightarrow a=11$, $c$ unchanged $=10$.
Online Test Series, Information About Examination, Syllabus, Notification and More.