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 1 of 2.
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.
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.
Swathipriya said:
10 years ago
Normally we will have only 2 cases for IF. Here are options. One is for negative what about remaining two?
Krisha said:
1 decade ago
98 - (3*42) = 98 - 126 = -28 according to operator priority. But what is the logic behind 103.
Jeshnavi said:
4 years ago
But why 5 should be executed. Why not 8 & 11 are executed. Can any explain this?
Sanskar Gupta said:
4 years ago
Please explain the concept clearly. What is the logic behind the digit 5 6 7?
Kali said:
8 years ago
I am not able to understand. What is the logic behind this?
Please explain.
Please explain.
Priyal patle said:
1 decade ago
I can not understand the answer please show me the logic behind it.
Puja said:
7 years ago
Please, anyone, explain the answer with the logic.
Bhavana said:
1 decade ago
JCOKE - (3*L PEPSI) check the operators priority.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers