Challenge 33 – What is the Correct answer to this problem?
Challenge #33 involved solving a simple math problem.
Five equations are presented.
The goal is to find the result of the 5th equation.
- X + 2Y = 23
- Y – Z = 6
- -Z + X = 17
- R = true
- !R || R && (Y==3) ? X % 6 : Z + 2 = ?
The following are the requirements for coding Challenge #33
- Find the result of equation 5 above.
The following is the correct response.
X + 2Y = 23
2Y = 23 – X
Y = (23 – 15) / 2
Y = 4
Y – Z = 6
4-Z = 6
-Z = 2
Z = -2
(23 – X) / 2 – (X-17) = 6
23 – X – 2X + 34 = 12
-3X + 57 = 12
3X = 45
X = 15
R = True
!R || R && (Y==3) ? X % 6 : Z + 2 = ?
False || True && ( False) ? 15 Mod 6 : -2+2 = 0
Winners (out of approximately 10 respondents)
Thanks to everybody for your responses to SCS Coding Challenge #33!!!
Ryan Abrahamson Is this month’s winner based upon first correct response received.
|Name||Prize Winner||Good Answer|
Monthly Programming Tidbits: JSON vs. XML
Both JSON and XML can be used to receive data from a web server.
The following JSON and XML examples both defines an employees object, with an array of three employees:
JSON is Like XML Because
- Both JSON and XML are “self describing” (human readable)
- Both JSON and XML are hierarchical (values within values)
- Both JSON and XML can be parsed and used by lots of programming languages
- Both JSON and XML can be fetched with an XMLHttpRequest
JSON is Unlike XML Because
- JSON doesn’t use end tag
- JSON is shorter
- JSON is quicker to read and write
- JSON can use arrays
The biggest difference is:
Why JSON is Better Than XML
XML is much more difficult to parse than JSON.
For AJAX applications, JSON is faster and easier than XML:
- Fetch an XML document
- Use the XML DOM to loop through the document
- Extract values and store in variables
- Fetch a JSON string
- JSON.Parse the JSON string
Coding Challenge #34
Please stay tuned, SCS Coding Challenge #34 will be published next week. Details will follow. The winner will be awarded based upon the best approach.