1). The web development environment (JavaScript) offers which standard construct for data validation of the input entered by the user.
[A]Controlled loop constructs
[B]Server page access
[C]Client side Event
[D]Permit server-side
Show Answer
Correct Answer: Controlled loop constructs
Notes:
Answer: a
Explanation: JavaScript provides with for, while loops and if, else, switch cases for checking the information entered by the user. Additionally, all development environments provide syntax to create and use memory variables, constants, and functions.
2). The main purpose of a “Live Wire” in NetScape is to ________
[A] Create linkage between client side and server side
[B]Permit server side, JavaScript code, to connect to RDBMS
[C]Support only non relational database
[D]To interpret JavaScript code
Show Answer
Correct Answer: Permit server side, JavaScript code, to connect to RDBMS
Notes:
Answer: b
Explanation: A Live Wire database driver also supports a number of non-relational databases.
3). The script tag must be placed in __________
[A] the head tag
[B]the head or body
[C]the title or head
[D]after the body tag
Show Answer
Correct Answer: the head or body
Notes:
Answer: b
Explanation: 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 tag.
4). A JavaScript program developed on a Unix Machine ________
[A]will throw errors and exceptions
[B]must be restricted to a Unix Machine only
[C]will work perfectly well on a Windows Machine
[D]will be displayed as a JavaScript text on the browser
Show Answer
Correct Answer: will work perfectly well on a Windows Machine
Notes:
Answer: c
Explanation: JavaScript can be executed on different operating systems therefore the program developed on UNIX will work perfectly fine on windows also.
5). JavaScript is ideal to ________
[A]make computations in HTML simpler
[B]minimize storage requirements on the web server
[C]increase the download time for the client
[D]increase the loading time of the website
Show Answer
Correct Answer: minimize storage requirements on the web server
Notes:
Answer: b
Explanation: JavaScript helps in performing various tasks with minimum storage requirements. Therefore to minimize storage requirements, JavaScript is always a better say.
6). Which attribute is used to specify that the script is executed when the page has finished parsing? (only for external scripts)
[A]parse
[B] a sync
[C]defer
[D]type
Show Answer
Correct Answer: defer
Notes:
Answer: c
Explanation: The defer attribute is a Boolean attribute. When present, it specifies that the script is executed when the page has finished parsing.
7). JavaScript Code can be called by using ____________
[A]RMI
[B]Triggering Event
[C]Preprocessor
[D]Function/Method
Show Answer
Correct Answer: Function/Method
Notes:
Answer: d
Explanation: JavaScript code can be called by making a function call to the element on which JavaScript has to be run. There are many other methods like onclick, onload, and onsubmit etc.
8). JavaScript can be written __________
[A]directly into JS file and included into HTML
[B]directly on the server page
[C]directly into HTML pages
[D]directly into the css file
Show Answer
Correct Answer: directly into JS file and included into HTML
Notes:
Answer: a
Explanation: JavaScript files can be saved by .JS extension and can be included in the HTML files. Script tag along with src attribute is used to include the js files.
9). Which of the following Attribute is used to include External JS code inside your HTML Document?
[A]src
[B]ext
[C]script
[D]link
Show Answer
Correct Answer: src
Notes:
Answer: a
Explanation: Script “tag” is used to include the JavaScript code. To include external JavaScript files “src” attribute is used inside the script tag.
10). A proper scripting language is a __________
[A]High level programming language
[B]Assembly level programming language
[C]Machine level programming language
[D]Low level programming language
Show Answer
Correct Answer: High level programming language
Notes:
Answer: a
Explanation: JavaScript is a high-level programming language that is interpreted by another program at runtime rather than compiled by the computer’s processor. Scripting languages, which can be embedded within HTML, commonly are used to add functionality to a Web page, such as different menu styles or graphics displays or to serve dynamic advertisements.
11). What will be the output of the following JavaScript code?
var txt1 = "good";
var txt2 = "day";
document.getElementById("demo").innerHTML = txt1 + txt2;
[A]good day
[B] goodday
[C]error
[D]undefined
Show Answer
Correct Answer: goodday
Notes:
Answer: b
Explanation: The + operator acts as a concatenation operator when used with string. The new string does not have any space between the two added string.
12). What will be the output of the following JavaScript code?
Show Answer
Correct Answer: 1
Notes:
Answer: b
Explanation: The % operator returns the remainder between the two numbers. It is used many times with if condition to check whether the number is divisible or not.
13). What will be the output of the following JavaScript code?
[A]5
[B]10
[C]50
[D]Error
Show Answer
Correct Answer: 50
Notes:
Answer: c
Explanation: The *= operator is a shorthand expression for multiplication of a particular number. It is a combination of two operators * and =
14). What will be the output of the following JavaScript code?
[A]onetwo
[B] one two
[C]error
[D]undefined
Show Answer
Correct Answer: onetwo
Notes:
Answer: a
Explanation: The += operator acts in the same way as the concatenation operator in the string. There is no space added when two string are added together with += operator.
15). What will be the output of the following JavaScript code?
[A]integer
[B]number
[C]string
[D]error
Show Answer
Correct Answer: string
Notes:
Answer: c
Explanation: The typeof operator returns the type of the argument passed to it. The typeof operator returns number for an integer and string for a character array.