ExamVeda
Login
Home
11
Rhino is originated by
Discuss
Answer & Solution
Answer: Option B
Solution:
Rhino is free software from Mozilla.
12
Which of the following are global functions that are not part of core JavaScript?
Discuss
Answer & Solution
Answer: Option A
Solution:
The spawn(f) runs f() or loads and executes file f in a new thread.
13
Which of the following reads the textual contents of a URL and returns as a string?
Discuss
Answer & Solution
Answer: Option D
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.
14
Which Rhino command quits Rhino environment?
Discuss
Answer & Solution
Answer: Option C
Solution:
The quit() command makes Rhino exit.
15
Which is a useful way to try out small and simple Rhino programs and one-liners?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
16
Which is a more formal way of importing packages and classes as JavaScript objects?
Discuss
Answer & Solution
Answer: Option B
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
17
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?
Discuss
Answer & Solution
Answer: Option D
Solution:
The output for the above code snippet is false as it is a writer and not a Reader.
18
What does Rhino do when the getter and setter methods exist?
Discuss
Answer & Solution
Answer: Option A
Solution:
Rhino allows JavaScript code to query and set the static fields of Java classes and the instance fields of Java objects. Java classes often avoid defining public fields in favor of getter and setter methods. When getter and setter methods exist, Rhino exposes them as JavaScript properties.
19
The JavaScript classes can be instantiated using _____ operator?
Discuss
Answer & Solution
Answer: Option B
Solution:
Just like the JavaScript classes use new operator to instantiate, so does the Java classes.
20
The new Java arrays can be created into a JavaScript programs using which of the following classes?
Discuss
Answer & Solution
Answer: Option D
Solution:
There is no natural JavaScript syntax that Rhino can extend to allow JavaScript programs to create new Java arrays, so you have to do that using the java.lang.reflect.Array class.