Jump to content

Archived

This topic is now archived and is closed to further replies.

thara

How this logic work? - need some explanation.

Recommended Posts

At a PHP exam I sat recently I got 2 questions about variables and here I have posted it. In this questions I couldn't understand at all and couldn't select write one.

 

Can any body here, explain how this logic work.

 

This wat my question -

 

If Variable 1,2 and 3 have the values 3,5 and 7 respectively, select the correct sequence of

equations that will result in placing values 12 in variable 1 and 15 in variable 3.

(Use only ADD operator)

1) 1 + 2 = 3
2) 2 + 3 = 1
3) 3 + 2 = 3
4) 2 + 1 = 2
5) 2 + 2 = 3
6) 2 + 3 = 3

 

 

If variables 1,2 and 3 have the values 10, 15 and 20 respectively, select the correct sequence of equations that will result in placing 55 in variable 2 and 60 in variable 3.

(Use only ADD operator)

1) 3 + 3 = 1
2) 2 + 1 = 3
3) 1 + 2 = 2
4) 3 + 3 = 2
5) 1 + 3 = 3
6) 2 + 2 = 2

 

 

Any explanation are greatly appreciated.

Thank you.

Share this post


Link to post
Share on other sites

1=3, 2=5, 3=7

 

1) 1 + 2 = 3 <=> 3 + 5 = 8

2) 2 + 3 = 1 <=> 5 + 7 = 12 => 1st op. (1) 1=12

3) 3 + 2 = 3 <=> 7 + 5 = 12 => 2nd op. (2) 3=15

4) 2 + 1 = 2 <=> 5 + 3 = 8

5) 2 + 2 = 3 <=> 5 + 5 = 10 => 2nd op. (1) 3=10

6) 2 + 3 = 3 <=> 5 + 7 = 12

Share this post


Link to post
Share on other sites

@ignace thanks for reply. Still I am confuse about this. Can you kindly elaborate it?

 

Sorry for my misunderstand.

Share this post


Link to post
Share on other sites

1 + 2 = 3 each number in this equation is a variable. Find the equation that alters the value of the variable to the requested value.

 

1 + 2 = 3 thus is 3 + 5 and it would assign 8 to variable 3. The text is confusing because they use numbers as variable names, but if you read it literally, it makes sense.

 

The first question asks to find the equation that makes variable 1 contain value 12 which is done by equation 2 (2 + 3 = 1 <=> 5 + 7 = 12).

 

The second question to get 15 in variable 3 is done by combining (sequence) equations 5 and 3.

Share this post


Link to post
Share on other sites

Thanks for good explanation. Still it not makes 100% sense for me to select the answer to my question.

 

This was my complete question with given answers to select correct one.

1. If Variable 1,2 and 3 have the values 3,5 and 7 respectively, select the correct sequence of 
equations that will result in placing values 12 in variable 1 and 15 in variable 3.

(Use only ADD operator)

1) 1 + 2 = 3
2) 2 + 3 = 1
3) 3 + 2 = 3
4) 2 + 1 = 2
5) 2 + 2 = 3
6) 2 + 3 = 3

A. 2,4,1
B. 4,3,6
C. 2,5,6
D. 3,4,5
E. 2,3,4 

Share this post


Link to post
Share on other sites

Hello i think it will be simply understandable if you put it this way.

 

Question 1) If Variable 1,2 and 3 have the values 3,5 and 7

 

like the last user said, the problem in this question is they used numbers for valuable representation. literary a valuable is a place holder for a value. so what they are saying here is if we had place holders 1,2 and 3. place holder 1holds value 3, place holder 2 holds value 5 and place holder 3 holds value 7.

 

this is how its writen in php. first of all in php valuable names have rules, one of which is theie names cant start with an integer. so we shall represent the above valuables in this way.

$one = 3;

$two = 5;

$three =7;

 

I think by now the question starts to be clear.

Share this post


Link to post
Share on other sites

In my first question, still I am confusing how I get 15 for variable 3 is doing by combining equations 5 and 3.

 

Any explanation is very welcome.

Thank you.

Share this post


Link to post
Share on other sites

In my first question, still I am confusing how I get 15 for variable 3 is doing by combining equations 5 and 3.

$one = 3;
$two = 5;
$three = 7;

//equation 5
$three = $two + $two; //5 + 5 = 10, store 10 in $three

//equation 3
$three = $three + $two; //10 + 5 = 15, store 15 in $three

Share this post


Link to post
Share on other sites

Thanks for reply. Then my question is, is there any correct answer to my 1st question?

 

I think equations should be 1, 3, and 5 for this.. right?

 

1. If Variable 1,2 and 3 have the values 3,5 and 7 respectively, select the correct sequence of

equations that will result in placing values 12 in variable 1 and 15 in variable 3.

(Use only ADD operator)

1) 1 + 2 = 3
2) 2 + 3 = 1
3) 3 + 2 = 3
4) 2 + 1 = 2
5) 2 + 2 = 3
6) 2 + 3 = 3

 

A. 2,4,1
B. 4,3,6
C. 2,5,6
D. 3,4,5
E. 2,3,4

 

Share this post


Link to post
Share on other sites

Thanks for reply. Then my question is, is there any correct answer to my 1st question?

 

I think equations should be 1, 3, and 5 for this.. right?

 

 

 

 

(correct me if i'm wrong so...) try checking it?

1. If Variable 1,2 and 3 have the values 3,5 and 7 respectively, select the correct sequence of

equations that will result in placing values 12 in variable 1 and 15 in variable 3.

(Use only ADD operator)

1) 1 + 2 = 3
2) 2 + 3 = 1
3) 3 + 2 = 3
4) 2 + 1 = 2
5) 2 + 2 = 3
6) 2 + 3 = 3

variables:  one = 3,   two = 5,  three = 7

 

 

goal: one = 12    and   three = 15

 

your answer: 1,3,5

 

check:

 

1 : one + two = three    =>     3 + 5 = 8 /// three = 8

so: one = 3,   two = 5,  three = 8

 

3:  three + two = three   =>   8 + 5 = 12  ///three = 12

so: one = 3,  two = 5,  three = 12

 

5: two + two = three  => 5 + 5 = 10 ///three = 10

so: one = 3, two = 5, three = 10 

 

/// conditions have not been met. one should be equal to 12 ( one = 12) and three should be equal to 15 (three = 15)

 

also your answer should be in the choices (i.e the a, b, c choices )

 

try using these method and see if you can find the answer (i've tried it)

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.