JOIN ADRE 2.0 Telegram Group

Question

In the following code segment:

	int z,x=5,y=-10,a=4,b=2;
	z=x++ - --y* b/a;
	

What will be the final value of z?

A 5
B 6
C 10
D 11
Answer & Explanation
Option: [C]

The post increment operator is associated with the variable x. So the current variable is considered i.e. x=5.

The pre increment operator is associated with the variable y. So the value of y decreses by 1. That is y=-11.

Multiplication operator and division operator has the same precedence. So the first one is executed first.

So the expression is:

z=5-(-11)*2/4

=5-(-22/4)

=5-(-5)

=10

Advertisement
ADRE 2.0 Mock Test - 5 Start Test
ADRE 2.0 Mock Test - 5 Start Test

DOWNLOAD CURRENT AFFAIRS PDF FROM APP

ADRE 2.0 MOCK TEST

Take Mock Tests

Government Schemes Mock Test Start Test!
Political Science Mock Test – 42 Start Test
History Test – 190 Start Test
Quantitative Aptitude Test Start Test!
Trigonometry - Mock Test Start Test!
Data Interpretation - Mock Test Start Test!
General Awareness - Mock Test Start Test!
Reasoning Ability - Mock Test Start Test!
Englist(Antonyms) Mock Test 1 Start Test!
Quantitative Aptitude (Percentage) Mock Test Start Test!
Economy Mock Test 1 Unlock Test!
Books & Authors - Test 2 Unlock Test!
Advertisement