JavaScript/JavaScript MCQ Questions And Answers Sample Test,Sample questions

Question:
 A ________ object is a reference to one of the classes in a Java package, such as netscape.javascript .

1.JavaArray

2.JavaClass

3.JavaObject

4.JavaPackage


Question:
 In JavaScript, _________ is an object of the target language data type that encloses an object of the source language.

1.a wrapper

2.a link

3.a cursor

4.a form


Question:
 JavaScript is interpreted by ________

1.Client

2.Server

3.Object

4.None of the above


Question:
 The syntax of a blur method in a button object is ______________

1.Blur()

2.Blur(contrast)

3.Blur(value)

4.Blur(depth)


Question:
 The syntax of capture events method for document object is ______________

1.captureEvents()

2. captureEvents(args eventType)

3.captureEvents(eventType)

4.captureEvents(eventVal)


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

1.Reverse

2.Shift

3.Slice

4.Splice


Question:
 To open a dialog box each time an error occurs, which of the following is added to prefs.js?

1.user_pref("javascript.classic.error_alerts", true);

2.user_pref("javascript.classic.error_alerts ", false);

3.user_pref("javascript.console.open_on_error ", true);

4.user_pref("javascript.console.open_on_error ", false);


Question:
 To set up the window to capture all Click events, we use which of the following statement?

1.window.captureEvents(Event.CLICK);

2.window.handleEvents (Event.CLICK);

3. window.routeEvents(Event.CLICK );

4.window.raiseEvents(Event.CLICK );


Question:
 Which of the following attribute can hold the JavaScript version?

1.LANGUAGE

2.SCRIPT

3.VERSION

4.None of the above


Question:
 Which of the following best describes JavaScript?

1. a low-level programming language.

2.a scripting language precompiled in the browser.

3.. a compiled scripting language.

4. an object-oriented scripting language.


Question:
 Which of the following is the structure of an if statement?

1. if (conditional expression is true) thenexecute this codeend if

2. if (conditional expression is true)execute this codeend if

3.if (conditional expression is true) {then execute this code>->}

4.if (conditional expression is true) then {execute this code}


Question:
 Which of the following navigator object properties is the same in both Netscape and IE?

1.navigator.appCodeName

2.navigator.appName

3.navigator.appVersion

4.None of the above


Question:
 Which types of image maps can be used with JavaScript?

1.Server-side image maps

2.Client-side image maps

3.Server-side image maps and Client-side image maps

4.None of the above


Question:
Choose the client-side JavaScript object?

1.Database

2.Cursor

3.Client

4.FileUpLoad


Question:
Choose the server-side JavaScript object?

1.FileUpLoad

2.Function

3.File

4.Date


Question:
How does JavaScript store dates in a date object?

1.The number of milliseconds since January 1st, 1970

2.The number of days since January 1st, 1900

3.The number of seconds since Netscape's public stock offering.

4.None of the above


Question:
How to create a Date object in JavaScript?

1.dateObjectName = new Date([parameters])

2.dateObjectName.new Date([parameters])

3.dateObjectName := new Date([parameters])

4. dateObjectName Date([parameters])


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

1.New Text?

2.para1.value="New Text";

3.para1.firstChild.nodeValue= "New Text";

4.para1.nodeValue="New Text";


Question:
Inside which HTML element do we put the JavaScript?

1.<js>

2.<scripting>

3.<script>

4.<javascript>


Question:
Why so JavaScript and Java have similar name?

1.JavaScript is a stripped-down version of Java

2. JavaScript's syntax is loosely based on Java's

3.They both originated on the island of Java

4.None of the above


Question:
JavaScript entities start with _______ and end with _________.

1.Semicolon, colon

2.Semicolon, Ampersand

3.Ampersand, colon

4.Ampersand, semicolon


Question:
The JavaScript exception is available to the Java code as an instance of __________

1.netscape.javascript.JSObject

2.netscape.javascript.JSException

3.netscape.plugin.JSException

4.None of the above


Question:
The syntax of close method for document object is _____________

1.Close(doC.

2.Close(object)

3.Close(val)

4.Close()


Question:
The syntax of Eval is _______________

1.[objectName.]eval(numeriC.

2.[objectName.]eval(string)

3.[EvalName.]eval(string)

4.[EvalName.]eval(numeriC.


Question:
To automatically open the console when a JavaScript error occurs which of the following is added to prefs.js?

1.user_pref(" javascript.console.open_on_error", false);

2.user_pref("javascript.console.open_error ", true);

3.user_pref("javascript.console.open_error ", false);

4.user_pref("javascript.console.open_on_error", true);


Question:
To enable data tainting, the end user sets the _________ environment variable.

1.ENABLE_TAINT

2.MS_ENABLE_TAINT

3.NS_ENABLE_TAINT

4.ENABLE_TAINT_NS


Question:
Using _______ statement is how you test for a specific condition.

1.Select

2.If

3.Switch

4.For


Question:
What are variables used for in JavaScript Programs?

1.Storing numbers, dates, or other values

2.Varying randomly

3.Causing high-school algebra flashbacks

4.None of the above


Question:
What does the <noscript> tag do?

1.Enclose text to be displayed by non-JavaScript browsers.

2.Prevents scripts on the page from executing.

3.Describes certain low-budget movies.

4.None of the above


Question:
What is the correct JavaScript syntax to write "Hello World"?

1.System.out.println("Hello World")

2. println ("Hello World")

3.document.write("Hello World")

4. response.write("Hello World")


Question:
What is the correct syntax for referring to an external script called " abc.js"?

1.<script href=" abc.js">

2. <script name=" abc.js">

3.<script src=" abc.js">

4.None of the above


Question:
What should appear at the very end of your JavaScript?
The <script LANGUAGE="JavaScript">tag

1.The </script>

2.The <script>

3.The END statement

4.None of the above


Question:
When a JavaScript object is sent to Java, the runtime engine creates a Java wrapper of type ___________

1.ScriptObject

2.JSObject

3.JavaObject

4.Jobject


Question:
When a user views a page containing a JavaScript program, which machine actually executes the script?

1.The User's machine running a Web browser

2.The Web server

3.A central machine deep within Netscape's corporate offices

4.None of the above


Question:
Which is the correct way to write a JavaScript array?

1.var txt = new Array(1:"tim",2:"kim",3:"jim")

2.var txt = new Array:1=("tim")2=("kim")3=("jim")

3.var txt = new Array("tim","kim","jim")

4.var txt = new Array="tim","kim","jim"


Question:
Which of the following are capabilities of functions in JavaScript?

1.Return a value

2.Accept parameters and Return a value

3.Accept parameters

4.None of the above


Question:
Which of the following can't be done with client-side JavaScript?

1.Validating a form

2. Sending a form's contents by email

3. Storing the form's contents to a database file on the server

4.None of the above


Question:
Which of the following event fires when the form element loses the focus: <button>, <input>, <label>, <select>, <textarea>?

1.onfocus

2.onblur

3.onclick

4.ondblclick


Question:
Which of the following is not a valid JavaScript variable name?

1.2names

2._first_and_last_names

3.FirstAndLast

4.None of the above


Question:
Which of the following is not considered a JavaScript operator?

1.New Text?

2.this

3.delete

4.typeof


Question:
Which of the following way can be used to indicate the LANGUAGE attribute?

1.<LANGUAGE="JavaScriptVersion">

2. <SCRIPT LANGUAGE="JavaScriptVersion">

3.<SCRIPT LANGUAGE="JavaScriptVersion"> JavaScript statements…</SCRIPT>

4. <SCRIPT LANGUAGE="JavaScriptVersion"!> JavaScript statements…</SCRIPT>


Question:
Which tag(s) can handle mouse events in Netscape?

1.<IMG>

2.<A>

3.<BR>

4.None of the above


Question:
__ JavaScript statements embedded in an HTML page can respond to user events such as mouse-clicks, form input, and page navigation.

1.Client-side

2.Server-side

3.Local

4.Native


Question:
_____ class provides an interface for invoking JavaScript methods and examining JavaScript properties.

1.ScriptObject

2.JSObject

3.JavaObject

4.Jobject


Question:
_____ JavaScript is also called client-side JavaScript.

1.Microsoft

2.Navigator

3.LiveWire

4.Native


Question:
_____ tag is an extension to HTML that can enclose any number of JavaScript statements.

1.<SCRIPT>

2.<BODY>

3.<HEAD>

4.<TITLE>


Question:
_____method evaluates a string of JavaScript code in the context of the specified object.

1.Eval

2.ParseInt

3.ParseFloat

4.Efloat


Question:
_______ is a wrapped Java array, accessed from within JavaScript code.

1.JavaArray

2.JavaClass

3.JavaObject

4.JavaPackage


Question:
_______ JavaScript is also called server-side JavaScript.

1.Microsoft

2.Navigator

3.LiveWire

4.Native


Question:
___________ is the tainted property of a window object.

1.Pathname

2.Protocol

3.Defaultstatus

4.Host


More MCQS

  1. JavaScript MCQ Questions And Answers
  2. JavaScript MCQ Questions And Answers Set 2
  3. JavaScript MCQ Set 1
  4. JavaScript MCQ Set 2
  5. Javascript MCQ Questions Set 1
  6. Javascript Multiple Choice Questions
  7. JAVASCRIPT MCQ
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!