Server Side And Client Side Scripting - Study Mode
[#71] Which of the following are global functions that are not part of core JavaScript?
Correct Answer
(A) spawn(f)
Explanation
Solution: The spawn(f) runs f() or loads and executes file f in a new thread.
[#72] Which of the following reads the textual contents of a URL and returns as a string?
Correct Answer
(D) readUrl(url)
Explanation
Solution: Rhino defines a handful of important global functions that are not part of core JavaScript in which readUrl(url) reads the textual contents of a URL and return as a string.
[#73] Which is a more formal way of importing packages and classes as JavaScript objects?
Correct Answer
(B) importClass(java.util.*)
Explanation
Solution: Because packages and classes are represented as JavaScript objects, you can assign themto variables to give them shorter names. But you can also more formally import them, if you want to: importClass ( java . util . HashMap )
// Same as : var HashMap = java.util.HashMap
[#74] Consider the following code snippet var f = new java . io . File ( "/tmp/test" )
var out = new java . io . FileWriter ( f )
out instanceof java.io.Reader What will be the output for the above code snippet?
Correct Answer
(D) False
Explanation
Solution: The output for the above code snippet is false as it is a writer and not a Reader.
[#75] When do uncaught exceptions generate events?
Correct Answer
(A) When handlers are registered
Explanation
Solution: Uncaught exceptions generate events, if any handlers are registered. Otherwise, the exception just makes Node print an error and exit. process . on (" uncaughtException " , function ( e ) { console . log ( Exception, e )
})