JavaScript Questions and Answers

41.Which of the following is true?

A. If onKeyDown returns false, the key-press event is cancelled.
B. If onKeyPress returns false, the key-down event is cancelled.
C. If onKeyDown returns false, the key-up event is cancelled.
D. If onKeyPress returns false, the key-up event is canceled.

View Answer


42. Syntax for creating a RegExp object:
1. var txt=new RegExp(pattern,attributes);
2. var txt=/pattern/attributes;
Which of the above mentioned syntax will correct?

A. 1 only
B. 2 only
C. Both 1 and 2
D. None of the above

View Answer


43. If para1 is the DOM object for a paragraph, what is the correct syntax to change the text within the paragraph?

A. "New Text"?
B. para1.value="New Text";
C. para1.firstChild.nodeValue= "New Text";
D. para1.nodeValue="New Text";

View Answer


44. The syntax of Eval is ________________

A. [objectName.]eval(numeric)
B. [objectName.]eval(string)
C. [EvalName.]eval(string)
D. [EvalName.]eval(numeric)

View Answer


45. The _______ method of an Array object adds and/or removes elements from an array.

A. Reverse
B. Shift
C. Slice
D. Splice

View Answer


46. Which tag(s) can handle mouse events in Netscape?

A. <IMG>
B. <A>
C. <BR>
D. <span>

View Answer


47. Consider the following code snippet
const pi=3.14;
var pi=4;
console.log(pi);
What will be the output for the above code snippet?

A. This will flash an error
B. Prints 4
C. Prints 3.14
D. Ambiguity

View Answer


48. What is the default value of the asyc attribute?

A. 0
B. 1
C. False
D. True

View Answer


49. What is the purpose of the Attr object in the HTML DOM?

A. Used to focus on a particular part of the HTML page
B. HTML Attribute
C. Used to arrange elements
D. None of the mentioned

View Answer


50. Which among the following POSIX signals generate events?

A. SIGDOWN
B. SIGFLOAT
C. SIGINT
D. SIGSHORT

View Answer







Also check :


Discussion


* You must be logged in to add comment.