812). What type of scope is present in JavaScript?
[A]Lexical
[B]Literal
[C]Both Lexical and Literal
[D]Local
Show Answer
Correct Answer: Lexical
Notes:
Answer: a
Explanation: Lexical scoping (sometimes known as static scoping) is a convention used with many programming languages that sets the scope (range of functionality) of a variable so that it may only be called (referenced) from within the block of code in which it is defined.
813). Which function is used to stop the time logging?
[A]stopTimeLogging()
[B] stop()
[C]finish()
[D]abort()
Show Answer
Correct Answer: stopTimeLogging()
Notes:
Answer: a
Explanation: The function stopTimeLogging() is used to stop the time logging. The stopTimeLogging() stops the timing data for ad hoc, etc for referencing an uncached document.location.
814). The lexical scooping in JavaScript is based on which of the following?
[A]Segments
[B]Blocks
[C]Functions
[D]Entire code
Show Answer
Correct Answer: Functions
Notes:
Answer: c
Explanation: Lexical scoping (sometimes known as static scoping) is a convention used with many programming languages that sets the scope (range of functionality) of a variable so that it may only be called (referenced) from within the block of code in which it is defined. JavaScript has lexical scoping based on functions but not blocks.
815). What is the return data type of the property accept that belongs to the Input element?
[A]integer
[B]string
[C]boolean
[D]float
Show Answer
Correct Answer: string
Notes:
Answer: b
Explanation: The accept attribute is used to define the types of files that the control can select. When type is “file”, this property is a comma-separated list of MIME types that specify the types of files that may be selected. The strings “audio/*”, “video/*”, and “image/*” are also legal.
816). What is the purpose of the property width belonging to the ImageData element?
[A]Number of data
[B] Number of pixels
[C]Number of pixels per row of data
[D]Number of columns
Show Answer
Correct Answer: Number of pixels per row of data
Notes:
Answer: c
Explanation: Image data element indicates the intrinsic width of the image, in CSS pixels. The width property is used to retrieve or store the number of pixels per row of data.
817). What is the purpose of the adoptNode() method?
[A]Removes node
[B]Makes it ready for insertion
[C] Removes node and Makes it ready for insertion
[D]Changes the node
Show Answer
Correct Answer: Removes node and Makes it ready for insertion
Notes:
Answer: c
Explanation: This method removes the node from whatever document it is currently part of and changes its ownerDocument property to this document, making it ready for insertion into this document. The adoptNode() method adopts a node from another document. The adopted node can be of all node types.
818). What is the function of the method importNode()?
[A]Copies without removing
[B]Copies and removes
[C]Only copies
[D]Only removes
Show Answer
Correct Answer: Copies without removing
Notes:
Answer: a
Explanation: The importNode() method imports a node from another document. The imported node can be of all node types. The method importNode() copies a node from another document without removing it.
819). How can you create a node for comment in JavaScript?
[A]comment()
[B] createComment()
[C]comm()
[D]create()
Show Answer
Correct Answer: createComment()
Notes:
Answer: b
Explanation: The comment node can be created using the method Comment createComment(string data). The createComment() method creates a Comment node with the specified text.
820). How can you dispatch a synthetic event object?
[A]dispatchEvent()
[B]dispatch()
[C]dispatch(Event)
[D]eventdispatch()
Show Answer
Correct Answer: dispatchEvent()
Notes:
Answer: a
Explanation: When you have created and initialized a synthetic event object, you can dispatch it using the dispatchEvent() method of EventTarget. The dispatchEvent method throws UNSPECIFIED_EVENT_TYPE_ERR if the event’s type was not specified by initializing the event before the method was called, or if the event’s type is null or an empty string.
821). How do you specifically execute a command in JavaScript?
[A]execcommand()
[B]exec(command)
[C]execCommand()
[D]exec(command id)
Show Answer
Correct Answer: execCommand()
Notes:
Answer: c
Explanation: The command can be executed using boolean execCommand(string commandId, [boolean showUI, [string value]]). The execCommand() method executes the specified command for the selected part of an editable section.