ExamVeda
Login
Home
41
Which of the following is a way of embedding Client-side JavaScript code within HTML documents?
Discuss
Answer & Solution
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
When does JavaScript code appear inline within an HTML file?
Discuss
Answer & Solution
Answer: Option A
Solution:
JavaScript code can appear inline within an HTML file between the “script” tags.
43
Which character in JavaScript code will be interpreted as XML markup?
Discuss
Answer & Solution
Answer: Option C
Solution:
If your JavaScript code contains the < or & characters, these characters are interpreted as XML markup.
44
Which is the root element in a HTML document?
Discuss
Answer & Solution
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
What is the code for getting the current time?
Discuss
Answer & Solution
Answer: Option B
Solution:
The above code determines the current time and stores it in the variable “now”.
46
What is the code to start displaying the time when document loads?
Discuss
Answer & Solution
Answer: Option C
Solution:
The above code starts displaying the time when the document loads.
47
One of the main advantage of using src attribute is
Discuss
Answer & Solution
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
What will be done if more than one page requires a file of JavaScript code?
Discuss
Answer & Solution
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
What is the default value of the type attribute?
Discuss
Answer & Solution
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
The language is commonly used to
Discuss
Answer & Solution
Answer: Option C
Solution:
The language attribute is deprecated and should no longer be used.