Professional Documents
Culture Documents
A Application
Scripting
C Programming
D None of These
1.
A. generators
B. emitters
C. dispatchers
D. highevents
Answer: Option B
Solution:
Node objects that generate events (known as event emitters) define an on() method for
registering handlers
2.
What is the function used to deregister event handler ‘f’?
A. deleteAllListeners(name)
B. deleteListener(name,f)
C. removerListener(name,f)
D. removeAllListeners(name)
Answer: Option C
3.
A. deleteAllListeners(name)
B. deleteListener(name,f)
C. removerListener(name,f)
D. removeAllListeners(name)
Answer: Option D
Solution:
The removeAllListeners(name) is used to remove all handlers from name events represented as
:
emitter.removeAllListeners(name)
4.
A. addListener()
B. listeners()
C. once()
D. add()
Answer: Option A
Solution:
The on() method is used for registering handlers. addListener() is a synonym for on().
5.
A. once
B. process
C. listeners
D. on
Answer: Option B
Solution:
The process object is an event emitter. The Node defines other important globals under the
process namespaces that contain properties of that object like version, argv, env, pid,getuid(),
cwd(), chdir() and exit().
6.
Answer: Option A
Solution:
Uncaught exceptions generate events, if any handlers are registered. Otherwise, the exception
just makes Node print an error and exit.
7.
A. SIGDOWN
B. SIGFLOAT
C. SIGINT
D. SIGSHORT
Answer: Option C
Solution:
The SIGINT is a POSIX signal that generates event.
8.
A. s.pause();
B. s.stop();
C. s.halt();
D. s.wait();
Answer: Option A
Solution:
The above code snippet is used to pause data events, for throttling uploads, e.g.
9.
When the “end” event fires on EOF when no more data will
arrive, which function is called?
A. s.on("data",f);
B. s.on("end",f);
C. s.on("error",f);
D. s.on("default",f);
Answer: Option B
Solution:
10.
What will be the return value of the write() method when
the Node cannot write the data immediately and has to
buffer it internally?
A. 0
B. 1
C. True
D. False
Answer: Option D
Solution:
The write() method never blocks. If Node cannot write the data immediately and has to buffer it
internally, the write() method returns false.
11.
Rhino is originated by
A. Microsoft
B. Mozilla
C. Apple
D. None of the mentioned
Answer: Option B
Solution:
Rhino is free software from Mozilla.
12.
A. spawn(f);
B. trim();
C. exult();
Answer: Option A
Solution:
The spawn(f) runs f() or loads and executes file f in a new thread.
13.
B. load(filename,…);
C. readFile(file);
D. readUrl(url);
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.
A. terminate()
B. exit()
C. quit()
D. close()
15.
Answer: Option A
No explanation is given for this question Let's Discuss on Board
16.
A. import(java.util.*);
B. importClass(java.util.*);
C. import.Class(java.util.*);
D. Class.import(java.util.*);
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:
17.
A. Error
B. True
C. Exception
D. False
Answer: Option D
Solution:
The output for the above code snippet is false as it is a writer and not a Reader.
18.
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.
A. create
B. new
C. instantiate
D. create.new
Answer: Option B
Solution:
Just like the JavaScript classes use new operator to instantiate, so does the Java classes.
20.
A. java.Array
B. java.lang.*
C. java.lang.Array
D. java.lang.reflect.Array
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.
21.
A. Node
B. Sockets
C. Processors
D. Closures
Answer: Option A
Solution:
Node is a fast C++-based JavaScript interpreter with bindings to the low-level Unix APIs for
working with processes, files, network sockets, etc., and also to HTTP client and server APIs.
22.
Answer: Option B
Solution:
Because the APIs are asynchronous, Node relies on event handlers, which are often
implemented using nested functions and closures.
23.
A. node(program.js)
B. program.js
C. node program.js
D. node.program.js
Answer: Option C
Solution:
The node programs can be run with the command:
node program.js
24.
B. module()
C. log()
D. require()
Answer: Option D
Solution:
Use require() instead of load(). It loads and executes (only once) the named module, returning
an object that contains its exported symbols.
25.
A. print();
B. console.log(…);
C. debug(…);
D. execute(…);
26.
Answer: Option A
Solution:
The above code snippet says hello one second from now.
27.
A. getInterval()
B. Interval()
C. clearTime()
D. clearTimeout()
Answer: Option D
Solution:
Node supports the client-side timer functions set setTimeout(), setInterval(), clearTimeout(),
and clearInterval().
28.
A. variables
B. system
C. process
D. using
Answer: Option C
Solution:
Node defines other important globals under the process n
29.
Why does Node not block while waiting for operations to
complete?
A. Static
B. Asynchronous
C. Synchronous
Answer: Option B
Solution:
Because Node’s functions and methods are asynchronous, they do not block while waiting for
operations to complete.
30.
A. on()
B. register()
C. add()
D. include()
Answer & Solution Discuss in Board Save for Later
Answer: Option A
Solution:
Node objects that generate events (known as event emitters) define an on() method for
registering handlers.
31.
B. User Interface
C. Visual effects
Answer: Option A
Solution:
JavaScript can help to facilitate that experience, for example by:
1. Creating animations and other visual effects to subtly guide a user and help with page
navigation
2. Sorting the columns of a table to make it easier for a user to find what she needs
3. Hiding certain content and revealing details progressively as the user “drills down” into that
content
32.
A JavaScript program can traverse and manipulate
document content through
A. Element Object
B. Document Object
Answer: Option C
Solution:
A JavaScript program can traverse and manipulate document content through the Document
object and the Element objects it contains. It can alter the presentation of that content by
scripting CSS styles and classes.
33.
Answer: Option B
Solution:
The JavaScript program can define the behavior of document elements by registering
appropriate event handlers.
34.
A. XMLHttpResponse
B. XMLRequest
C. XMLHttpRequest
Answer: Option C
Solution:
The best known advanced services is the XMLHttpRequest object, which enables networking
through scripted HTTP requests.
35.
B. Graphics APIs
Answer: Option D
Solution:
The HTML5 specification (which, at the time of this writing, is still in draft form) and related
specifications are defining a number of other important APIs for web apps. These include the
data storage and graphics APIs.
36.
A. Data storage
B. Networking
C. XMLHttpRequest object
Answer: Option D
Solution:
All the above mentioned are advanced services.
37.
A. Non-inline
B. External
C. Referenced
D. Inline
Answer: Option D
Solution:
Inline code are those that are writeen between a pair of “script” tags.
38.
Answer: Option C
Solution:
The Client-side JavaScript code is embedded within HTML documents in four ways :
1. Inline, between a pair of “script” tags
2. From an external file specified by the src attribute of a “script” tag
3. In an HTML event handler attribute, such as onclick or onmouseover
4. In a URL that uses the special javascript: protocol.
39.
A. Unobtrusive JavaScript
B. Obtrusive JavaScript
C. Inherited JavaScript
D. Modular JavaScript
Answer & Solution Discuss in Board Save for Later
Answer: Option A
Solution:
A programming philosophy known as unobtrusive JavaScript argues that content (HTML) and
behavior (JavaScript code) should as much as possible be kept separate. According to this
programming philosophy, JavaScript is best embedded in HTML documents using “script”
elements with src attributes.
40.
Answer: Option B
Solution:
nteractive web pages that communicate with server-side CGI scripts through HTML form
submissions were the original “web application” and can be written without the use of
JavaScript.
41.
A. From javascript:encoding
Answer: Option B
Solution:
The Client-side JavaScript code is embedded within HTML documents in four ways :
1. Inline, between a pair of “script” tags
2. From an external file specified by the src attribute of a “script” tag
3. In an HTML event handler attribute, such as onclick or onmouseover
4. In a URL that uses the special javascript: protocol.
42.
Answer: Option A
Solution:
JavaScript code can appear inline within an HTML file between the “script” tags.
43.
A. !
B. >
C. &
D. .
Answer: Option C
Solution:
If your JavaScript code contains the < or & characters, these characters are interpreted as XML
markup.
44.
A. HTML
B. HEAD
C. SCRIPT
D. BODY
Answer: Option A
Solution:
The “html” tag is the root element of any HTML document regardless of it containing a
JavaScript code or not
45.
Answer: Option B
Solution:
The above code determines the current time and st
46.
A. onload = displayTime;
B. window. = displayTime;
C. window.onload = displayTime;
D. window.onload = start;
Answer: Option C
Solution:
The above code starts displaying the time when the document loads.
47.
A. It becomes self-cached
B. It makes the HTML file modular
Answer: Option D
Solution:
The main advantage of using the src attribute is that it simplifies your HTML files by allowing
you to remove large blocks of JavaScript code from them—that is, it helps keep content and
behavior separate.
48.
C. Must be re executed
Answer: Option B
Solution:
If a file of JavaScript code is shared by more than one page, it only needs to be downloaded
once, by the first page that uses it—subsequent pages can retrieve it from the browser cache.
49.
A. text/css
B. text/javascript
C. text
D. xml
Answer: Option B
Solution:
The default value of the type attribute is “text/javascript”. You can specify this type explicitly if
you want, but it is never necessary.
50.
Answer: Option C
Solution:
The language attribute is deprecated and should no longer be used.
51.
A. Dynamic Information
B. Static Information
Answer: Option B
Solution:
Some pages present static information and can be called documents.
52.
Which object is the main entry point to all client-side
JavaScript features and APIs?
A. Standard
B. Location
C. Window
D. Position
Answer: Option C
Solution:
The Window object is the main entry point to all client-side JavaScript features and APIs. It
represents a web browser window or frame, and you can refer to it with the identifier window.
53.
A. frames
B. window
C. location
D. frame
Answer: Option B
Solution:
The Window object is the main entry point to all client-side JavaScript features and APIs. It
represents a web browser window or frame, and you can refer to it with the identifier window.
54.
A. position
B. area
C. window
D. location
Answer: Option D
Solution:
The Window object defines properties like location, which refers to a Location object that
specifies the URL currently displayed in the window and allows a script to load a new URL into
the window.
55.
Which Window object method is used to display message
in a dialog box?
A. alert()
B. prompt()
C. message()
Answer: Option A
Solution:
The Window object also defines methods like alert(), which displays a message in a dialog box.
56.
Answer: Option B
Solution:
The setTimeout(), which registers a function to be invoked after a specified amount of time.
57.
A. Register
B. Location
C. Window
D. Position
Answer: Option C
Solution:
In client-side JavaScript, the Window object is also the global object. This means that the
Window object is at the top of the scope chain and that its properties and methods are
effectively global variables and global functions.
58.
A. Representation convenience
Answer: Option D
Solution:
The Window object has a property named window that always refers to itself. You can use this
property if you need to refer to the window object itself, but it is not usually necessary to use
window if you just want to refer to access properties of the global window object.
59.
A. document
B. content
C. window
D. frame
Answer: Option A
Solution:
One of the most important properties of the Window object is document: it refers to a
Document object that represents the content displayed in the window.
60.
A. getElementsbyId()
B. getElementbyId()
Answer: Option B
Solution:
The Document object has important methods such as getElementById(), which returns a single
document element (representing an open/close pair of HTML tags and all of the content
between them) based on the value of its id attribute.
61.
A. timestamp.Child1
B. timestamp.Child(1)
C. timestamp.Child(0)
D. timestamp.firstChild
Answer: Option D
Solution:
The first child of a node can be accessed using the firstChild property.
62.
63.
A. Element
B. Window
C. Location
64.
65.
A. onload
B. manipulate
C. create
D. none of the mentioned
1234567891011121314
Read More Section(Server Side And Client Side Scripting)
Each Section contains maximum 70 questions. To get more questions visit other sections.
Server Side and Client Side Scripting - Section 2