2. 1) In a Javascript Application what function can be used to send
messages to users requesting for an text input?
a. Display()
b. Alert()
c. GetOutput()
d. Prompt()
ANSWER: Prompt()
Explanation:
This function is used when we want to input text in javascript.
2) - Which of the following function of String object returns a string
representing the specified object?
A - toLocaleUpperCase()
B - toUpperCase()
C - toString()
D - substring()
Answer : C
Explanation
toString() − Returns a string representing the specified object.
3. 3) - Which built-in method returns the characters in a string beginning at the
specified location?
A - substr()
B - getSubstring()
C - slice()
D - None of the above.
Answer : A
Explanation
substr() method returns the characters in a string beginning at the specified
location through the specified number of characters.
4) - Which of the following function of String object returns the characters
in a string between two indexes into the string?
A - slice()
B - split()
C - substr()
D - substring()
Answer : D
Explanation
substring() − Returns the characters in a string between two indexes into the
string.
4. 5)The script tag must be placed in
A.head
B.head and body
C.title and head
D.all of the mentioned
Answer: Option B
Solution:If the script tag is placed after the body tag, then, it will not be
evaluated at all.
Also, it is always recommended and effective to use the script snippet in the
<head> tag.
6)Which of the following attribute is used to include External JS code inside
your HTML document
A.src
B.ext
C.script
D.link
Answer: Option A
Solution:
A ”src” attribute could be used to add any external code into the HTML
document.
5. 7)The setTimeout() belongs to which object?
A.Element
B.Window
C.Location
D.None of the mentioned
Answer: Option B
Solution:
The setTimeout() method of the Window object
schedules a function to run after a specified number of milliseconds elapses.
8. To which object does the location property belong?
A.Window
B.Position
C.Element
D.Location
Answer: Option A
Solution:
The location property of the Window object refers to a Location object,
which represents the current URL of the document displayed in the window,
and which also defines methods for making the window load a new
document.
6. 9) The keyword or the property that you use to refer to an object through
which they were invoked is
A.from
B.to
C.this
D.Object
Answer: Option C
Solution:
The ‘this’ keyword is used to refer to the object through which the properties or
methods were invoked. This use of ‘this’ is a fundamental characteristic of the
methods of any class
10)The four kinds of class members are
A.Instance methods, Instance fields, Static method, Dynamic method
B.Instance fields, Instance methods, Class fields, Class methods
C.Instance fields, Non-instance fields, Dynamic methods, Global methods
D.Global methods, Local methods, Dynamic methods, Static methods
Answer: Option B
Solution:
The four kinds of class members are Instance fields, Instance methods, Class fields,
Class methods.