Data-Interpretation
October 20, 2023NTA-UGC-NET 2021 Dec & 2022 June Paper-1
October 21, 2023Programming
Question 311 |
What is the value of ‘b’ after the execution of the following code statements :
c=10;
b=+ +c+ + +c;
20 | |
22 | |
23 | |
None |
Question 311 Explanation:
It will give error message because they are not given in proper syntax.
Suppose when we are taken (++c)+(++c);
→ It will give result 23 because pre/post increment will evaluate from right to left.
(++c)+(++c); /* It will increment by one. It means 11 */
(++c)+(++c); /* Before c=11 and now we are incrementing by 1. It will become 23. */
Suppose when we are taken (++c)+(++c);
→ It will give result 23 because pre/post increment will evaluate from right to left.
(++c)+(++c); /* It will increment by one. It means 11 */
(++c)+(++c); /* Before c=11 and now we are incrementing by 1. It will become 23. */
Correct Answer: D
Question 311 Explanation:
It will give error message because they are not given in proper syntax.
Suppose when we are taken (++c)+(++c);
→ It will give result 23 because pre/post increment will evaluate from right to left.
(++c)+(++c); /* It will increment by one. It means 11 */
(++c)+(++c); /* Before c=11 and now we are incrementing by 1. It will become 23. */
Suppose when we are taken (++c)+(++c);
→ It will give result 23 because pre/post increment will evaluate from right to left.
(++c)+(++c); /* It will increment by one. It means 11 */
(++c)+(++c); /* Before c=11 and now we are incrementing by 1. It will become 23. */
Answer is 24.
Thanks. Updated