Livecoding.tv Quiz of the Day: 28/10/2016
Answer: Surprisingly to many, the above code will output bool(true) seeming to imply that the and operator is behaving instead as an or. The issue here is that the = operator takes precedence over the…
The Education Ecosystem Blog is a hub for in-depth development blogs and new technology announcements written by professional software engineers in the Education Ecosystem network
Answer: Surprisingly to many, the above code will output bool(true) seeming to imply that the and operator is behaving instead as an or. The issue here is that the = operator takes precedence over the…
Python Quiz! Answer: The above code will output [], and will not result in an IndexError. As one would expect, attempting to access a member of a list using an index that exceeds the number…
Answer: Service is like an Activity but has no interface. For example, for fetching information on weather, blank activity will not be created. Here Service will be used. It is also known as Background Service…
Answer: 1. Encapsulation Encapsulation is a mechanism by which developer could hide implementation behind an interface. Encapsulated code has two features: Instance variables are kept protected (usually with the private modifier). Getter and setter methods provide access…
Answer: div, p – Selects all <div> elements and all <p> elements div p – Selects all <p> elements that are anywhere inside a <div> element div > p – Selects all <p> elements where the immediate parent is…
Answer: The problem here is that strpos() returns the starting position index of $str1 in $str2 (if found), otherwise it returns false. So in this example, strpos() returns 0 (which is then coerced to false when referenced in the if statement). That’s why the code doesn’t work properly. The correct…
Answer: The output will be:
1 2 |
location is null 1/1/0001 12:00:00 AM |
Although both variables are uninitialized, String is a reference type and DateTime is a value type. As a value type, an initialized DateTime variable is set to a default value of midnight of 1/1/1…
Answer Although typeof bar === “object” is a reliable way of checking if bar is an object, the surprising gotcha in JavaScript is that null is also considered an object! Therefore, the following code will,…
Answer: In Ruby, the only values that evaluate to false are false and nil. Everything else – even zero (0) and an empty array ([]) – evaluates to true. This comes as a real surprise…