...
Data-Interpretation
October 20, 2023
NTA-UGC-NET 2021 Dec & 2022 June Paper-1
October 21, 2023
Data-Interpretation
October 20, 2023
NTA-UGC-NET 2021 Dec & 2022 June Paper-1
October 21, 2023

Programming

Question 311
What is the value of ‘b’ after the execution of the following code statements :

c=10;

b=+ +c+ + +c;

A
20
B
22
C
23
D
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. */
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. */
0 0 votes
Article Rating
Subscribe
Notify of
2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Thanks. Updated

2
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!