Electronics and Communication Engineering - Microprocessors - Discussion
Discussion Forum : Microprocessors - Section 1 (Q.No. 47)
47.
Let JCOKE = 98 and LPEPSI = 42 Consider the statement
IF (JCOKE - 3 * LPEPSI) 5, 6, 7
5 JCOKE = JCOKE + 5
6 JCOKE = JCOKE + 8
7 JCOKE = JCOKE + 11
The value of JCOKE after the execution of above statement will beAnswer: Option
Explanation:
Since (J COKE - 3 x L PEPSI) is negative, statement 5 is executed and the result is 98 + 5 = 103.
Discussion:
13 comments Page 2 of 2.
Sanskar Gupta said:
4 years ago
Please explain the concept clearly. What is the logic behind the digit 5 6 7?
Dhanush said:
4 years ago
Arithmetic if has the syntax IF (Expression) negative, zero, positive, which means.
Execute negative, if the expression results in negative.
Execute zero, if the expression results in zero.
Execute positive if it results in positive.
Execute negative, if the expression results in negative.
Execute zero, if the expression results in zero.
Execute positive if it results in positive.
Dhanush said:
4 years ago
Any non-zero number in the 'if' statement is evaluated as 'True'.
Hence, if (-28) is true and the statement associated with the if statement is executed (here since there is no brackets only line 5 is under the control of the if statement and will get executed and line 6 and 7 will not get executed.
Hence, if (-28) is true and the statement associated with the if statement is executed (here since there is no brackets only line 5 is under the control of the if statement and will get executed and line 6 and 7 will not get executed.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers