November 7, 2016 0 Welcome to your JavaScript Name Integer Variable is declared using following syntax in JavaScript None of these Integer num; Var num; INT num; Why so JavaScript and Java have similar name? They both originated on the island of Java JavaScript is a stripped-down version of Java None of the above JavaScript's syntax is loosely based on Java's Choose the server-side JavaScript object? File FileUpLoad Date Function What is the special feature of the modern web applications? c. d. None of the mentioned Both a and b Can alter contents without loading document Must load the document to manipulate What is not true about try-catch block? I. The try statement allows you to define a block of code to be tested for errors while it is being executed II. The catch statement allows you to define a block of code to be executed, if an error occurs in the try block III. try {Block of code to try } catch( Exception err){ message.innerHTML = "Input is " + err; } IV. The finally statement lets you execute code, after try and catch, regardless of the result All are True Only III Only IV I and III only How to create a Date object in JavaScript? dateObjectName := new Date([parameters]) dateObjectName Date([parameters]) dateObjectName.new Date([parameters dateObjectName = new Date([parameters]) What are variables used for in JavaScript Programs? Causing high-school algebra flashbacks Storing numbers, dates, or other values Varying randomly None of the above What will be output of following code into alert: "use strict"; myFunction(); function myFunction() { y = 3.14; alert("Value of y is " +y); } None of the above Value of y is 3.14 y is not declared defined Value of y is undefined To change the style of an HTML element correct Syntax is document.getElementById(id).style.property=new style document.getElementByClass(id).Css.style.property=new style document.getElementByClass(Class).style.Val=new Property document.getElementById(id).Css= New property What is the correct JavaScript syntax to write "Hello World"? document.write("Hello World") response.write("Hello World") System.out.println("Hello World") println ("Hello World") Which is true about string methods ? I. The indexOf() method returns the index of the first occurrence of a specified text in a string II. The lastIndexOf() method returns the index of the last occurrence of a specified text in a string III. Both the indexOf(), and the lastIndexOf() methods return -1 if the text is not found II and III All I, II, III Only I I and III Which of the following is not a valid JavaScript variable name? FirstAndLast _first_and_last_names 2names None of the above What will be output ? <script language="javascript"> function x() { document.write(2+5+"8"); } </script> 258 78 7 Error When a user views a page containing a JavaScript program, which machine actually executes the script? A central machine deep within Netscape's corporate offices The User's machine running a Web browser The Web server None of the above What will be output ? <h1 onclick="changeText(this)">Click on this text!</h1> <script> function changeText(id) { id.innerHTML = "Ooops!"; } </script> Error Execute will Blank h1 Click on this text! Ooops! JavaScript entities start with _______ and end with _________. Ampersand, semicolon Semicolon, colon Semicolon, Ampersand Ampersand, colon Which is correct way to get object index value. objectName.propertyName Both A and B objectName["propertyName"] objectName[“index”] Which of the following best describes JavaScript? a compiled scripting language a low-level programming language. an object-oriented scripting language a scripting language precompiled in the browser 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? Prints 4 Prints 3.14 This will flash an error Ambiguity Which is correct Syntax to sort numerical array alphabetically array is : var points = [40, 100, 1, 5, 25, 10]; I. points.sort(function(a, b){return a - b}); II. points.sort(function(a, b){return b - a}); III. points.sort(); points.sort(); points.sort(function(a, b){return a - b}); points.sort(function(a, b){return b - a}); points.reverse(); Which of the following can't be done with client-side JavaScript? None of the above Validating a form Storing the form's contents to a database file on the server Sending a form's contents by email _____ JavaScript statements embedded in an HTML page can respond to user events such as mouse-clicks, form input, and page navigation. Native Local Server-side Client-side Which is not an Javascript HTML event onload,onscroll onmouseover, onmouseleave, onmouseenter onclick, onchange, onkeydown, onkeyup None of these Using _______ statement is how you test for a specific condition. For Select Switch If How does JavaScript store dates in a date object? The number of milliseconds since January 1st, 1970 The number of days since January 1st, 1900 None of the above The number of seconds since Netscape's public stock offering What is not true about String Functions? I. slice(), substring(), substr() are methods for extracting a part of a string II. If a parameter is negative, the position is counted from the end of the string III. If you omit the second parameter, the method will slice out the rest of the string IV. substring() is not similar to slice() and substring() cannot accept negative indexes. Only III Only II Only IV II and IV Time's up