JavaScript quiz

Fundamental Quiz about JavaScript:

Question: Why do JavaScript and Java have similar names?
(a) JavaScript is a stripped-down version of Java
(b) JavaScript’s syntax is loosely based on Java’s
(c) They both originated on the island of Java
(d) Both were invented by Java Toshomashi

Answer. (b)

Question: What does the <noscript> tag do?
(a) Enclose text to be displayed by non-JavaScript browsers.
(b) Prevents scripts on the page from executing.
(c) Describes certain low-budget movies.
(d) None of the above

Answer. (a)

Question: Scripting language are
(a) High Level Programming language
(b) Assembly Level programming language
(c) Machine level programming language

Answer. (a)

Question: JavaScript is _____ language.
(a) Application
(b) Programming
(c) Scripting
(d) None of These

Answer. (c)

Related: python quiz with answers

Question: JavaScript entities start with _______ and end with _________.
(a) Semicolon, colon
(b) Semicolon, Ampersand
(c) Ampersand, colon
(d) Ampersand, semicolon

Answer. (d)

Question: ______ tag is an extension to HTML that can enclose any number of JavaScript statements.
(a) <SCRIPT>
(b) <BODY>
(c) <HEAD>
(d) <TITLE>

Answer. (a)

Question: Which of the following best describes JavaScript?
(a) low-level programming language.
(b) a scripting language precompiled in the browser.
(c) a compiled scripting language.
(d) an object-oriented scripting language.

Answer. (d)

Question: JavaScript can be written –
(a) directly onto HTML pages
(b) directly into JS file and included in HTML
(c) None of these
(d) directly on the Server Script

Answer. (a), (b)

Related: Powerpoint quiz questions with answers

Question: Which of the following attributes is used to include External JS code inside your HTML Document –
(a) link
(b) script
(c) ext
(d) src

Answer. (d)

Question: Which of the following events fires when the form element loses focus: <button>, <input>, <label>, <select>, <textarea>?
(a) onfocus
(b) onblur
(c) onclick
(d) ondblclick

Answer. (b)

Question: Which of the following attributes can hold the JavaScript version?
(a) LANGUAGE
(b) SCRIPT
(c) VERSION
(d) None of the above

Answer. (a)

Question: When a user views a page containing a JavaScript program, which machine actually executes the script?
(a) The user’s machine running a Web browser
(b) The Web server
(c) A central machine deep within Netscape’s corporate offices
(d) None of the above

Answer. (b)

Question: How to create a Date object in JavaScript?
(a) dateObjectName = new Date([parameters])
(b) dateObjectName.newDate([parameters])
(c) dateObjectName := new Date([parameters])
(d) dateObjectName Date([parameters])

Answer. (a)

Question: _____ JavaScript statements embedded in an HTML page can respond to user events such as mouse-clicks, form input, and page navigation.
(a) Client-side
(b) Server-side
(c) Local
(d) Native

Answer. (a)

Question: The syntax of a blur method in a button object is ________
(a) Blur()
(b) Blur(contrast)
(c) Blur(value)
(d) Blur(depth)

Answer. (a)

Question: What is the correct JavaScript syntax to write “Hello World”?
(a) System.out.println(“Hello World”)
(b) println (“Hello World”)
(c) document.write(“Hello World”)
(d) response.write(“Hello World”)

Answer. (c)

Related: Photoshop questions

Question: The syntax of capture events method for documents is ______________
(a) captureEvents()
(b) captureEvents(argseventType)
(c) captureEvents(eventType)
(d) captureEvents(eventVal)

Answer. (c)

Question: JavaScript is designed for the following purpose –
(a) To add interactivity to HTML Pages.
(b) To Execute Query Related to DB on Server
(c) To Perform Server Side Scripting Operation
(d) To Style HTML Pages

Answer. (a)

Question: Choose the client-side JavaScript object:
(a) Database
(b) Cursor
(c) Client
(d) FileUpLoad

Answer. (d)

Question: The syntax of close method for document object is ______
(a) Close(doC
(b) Close(object)
(c) Close(val)
(d) Close()

Answer. (d)

Related: microsoft excel exam questions

Question: In JavaScript, Window.prompt() method returns true or false value ?
(a) False
(b) True

Answer. (a)

Question: Which of the following methods can be used to indicate the LANGUAGE attribute?
(a) <LANGUAGE=”JavaScriptVersion”>
(b) <SCRIPT LANGUAGE=”JavaScriptVersion”>
(c) <SCRIPT LANGUAGE=”JavaScriptVersion”> JavaScript statements…</SCRIPT>
(d) <SCRIPT LANGUAGE=”JavaScriptVersion”!> JavaScript statements…</SCRIPT>

Answer. (c)

Question: <script language=”javascript”>
function x()
{
document.write(2+5+”8″);
}
</script>
(a) 258
(b) Error
(c) 7
(d) 78

Answer. (d)

Question: <script type=”text/javascript”>
x=4+”4″;
document.write(x);
</script>
Output——?
(a) 44
(b) 8
(c) 4
(d) Error output

Answer. (a)

Related: microsoft word quiz answers

Question: <script type=”text/javascript”>
var s = “9123456 or 80000?”;
var pattern = /\d{4}/;
var output = s.match(pattern);
document.write(output);
</script>
(a) 9123
(b) 91234
(c) 80000
(d) None of the above

Answer. (a)

Question: JavaScript Code is written inside a file having extension _______.
(a) .js
(b) .jsc
(c) .javascript
(d) .jvs

Answer. (a)

Question: What should appear at the very end of your JavaScript?
The <script LANGUAGE=”JavaScript”>tag
(a) The </script>
(b) The <script>
(c) The END statement
(d) None of the above

Answer. (a)

Question: JavaScript is ____ Side Scripting Language.
(a) Browser
(b) ISP
(c) None of these
(d) Server

Answer. (a)

Related: computer operating system quiz

Question: Inside which HTML element do we put JavaScript?
(a) <js>
(b) <scripting>
(c) <script>
(d) <javascript>

Answer. (c)

Question: Select all the correct options. State the correct place of JS Code inside HTML –
(a) Inside the Body
(b) Inside Head
(c) All of these
(d) Inside Single JavaScript File

Answer. (c)

Question: Which of the following can’t be done with client-side JavaScript?
(a) Validating a form
(b) Sending a form’s contents by email
(c) Storing the form’s contents to a database file on the server
(d) None of the above

Answer. (c)

Question: Inside which HTML element do we put JavaScript?
(a) <js>
(b) <scripting>
(c) <script>
(d) <javascript>

Answer. (c)

Related: information security questions and answers

Question: Why is JavaScript called a Lightweight Programming Language ?
(a) because we can add programming functionality inside JS
(b) because JS can provide programming functionality inside but up to a certain extent.
(c) because JS is available free of cost.
(d) because JS is client side scripting

Answer. (b)

Question: Which of the following are the capabilities of functions in JavaScript?
(a) Return a value
(b) Accept parameters and return a value
(c) Accept parameters
(d) None of the above

Answer. (c)

Question: What is the correct syntax for referring to an external script called ” abc.js”?
(a) <script href=” abc.js”>
(b) <script name=” abc.js”>
(c) <script src=” abc.js”>
(d) None of the above

Answer. (c)

About the author

Deepika

Deepika is a computer teacher who has been teaching computers to school and college kids for several years. In addition to her teaching duties, Deepika shares her knowledge of computers through her quizzes.

error: Content is protected !!