JavaScript Fundamentals

A test on JavaScript programming.

25 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Which of the following type of box is used to get input from the user?

  1. inputbox
  2. alert
  3. confirm
  4. prompt
  5. dialog
Question 2 Multiple Choice (Single Answer)

Which of the following is the correct syntax to access an element of the form object?

  1. document.forms.element
  2. document.forms[0].elements[0]
  3. document[0].forms.element
  4. document.forms.elements[0]
  5. document.forms[0].element
Question 3 Multiple Choice (Single Answer)

Which of the following event occurs when an image does not load properly?

  1. onabort
  2. onerror
  3. onunload
  4. onblur
  5. onimageunload
Question 4 Multiple Choice (Single Answer)

Which of the following is NOT a valid property of the 'plugin' object?

  1. name
  2. filename
  3. description
  4. mimetypes
  5. path
Question 5 Multiple Choice (Single Answer)

What will the output of the statement - Math.ceil(5.3)

  1. 5
  2. 6
  3. 4
  4. 0
  5. 5.3
Question 6 Multiple Choice (Single Answer)

Which property of the 'navigator' object is used to detect the name of the client browser?

  1. appCodeName
  2. appBrowserName
  3. appVersion
  4. appName
  5. userAgent
Question 7 Multiple Choice (Single Answer)

Which of the following is NOT a valid cookie field?

  1. expires
  2. domain
  3. path
  4. policy
  5. secure
Question 8 Multiple Choice (Single Answer)

Which property of the 'Location' object returns the complete URL?

  1. href
  2. hash
  3. hostname
  4. pathname
  5. host
Question 9 Multiple Choice (Single Answer)

Which of the following function returns the position of a specified character in a String?

  1. charAt
  2. indexOf
  3. valueOf
  4. substring
  5. match
Question 10 Multiple Choice (Single Answer)

Which of the following is NOT a feature of JavaScript?

  1. Less server interaction
  2. We can handle events in JavaScripts
  3. JavaScript supports multithreading.
  4. It makes a web page dynamic
  5. Supports drag and drop.
Question 11 Multiple Choice (Single Answer)

With reference to the RegExp object which meta character used to find a NON WORD CHARACTER?

  1. w
  2. v
  3. W
  4. n
  5. D
Question 12 Multiple Choice (Single Answer)

Which operator is used to find out if the specified property is in the specified object?

  1. in
  2. comma
  3. new
  4. this
  5. typeof
Question 13 Multiple Choice (Single Answer)

What will be the output of the above code?

var arr = new Array();
arr[0] = "Element 1";
arr[1] = "Element 2";
arr[2] = "Element 3";
arr[3] = "Element 4";
document.write(arr[0, 1, 2, 3]);
  1. Error
  2. Element 1
  3. Element 4
  4. Element 1, Element 2, Element 3, Element 4
  5. No output (blank screen)
Question 14 Multiple Choice (Single Answer)

If we want to write a statement that processes irrespective of whether the program has an exception or not, it should be written inside the ___ block.

  1. try
  2. else
  3. catch
  4. if
  5. finally
Question 15 Multiple Choice (Single Answer)

Which of the following functions is used to determine if the argument is a number?

  1. parseInt
  2. isNan
  3. isFinite
  4. eval
  5. isDigit
Question 16 Multiple Choice (Single Answer)

Which of the following properties returns the values of the pixels of the length of the width and height of the viewer's screen?

  1. screen.width and screen.height
  2. Resolution.width and Resolution.height
  3. screen.pixels.width and screen.pixels.height
  4. ViewerScreen.width and ViewerScreen.height
  5. None of the above.
Question 17 Multiple Choice (Single Answer)

Which of the following event occurs when an object loses its focus.

  1. onblur
  2. onfocuslost
  3. onunload
  4. onreset
  5. onchange
Question 18 Multiple Choice (Single Answer)

What will be the output of the above code?

fun3();
function fun1(i) {
  function fun2(j) { return i * j; }
  return fun2;
}
function fun3() {
  r = fun1(5)(5);
  alert(r);
}
  1. 5
  2. 15
  3. 10
  4. 25
  5. Compilation Error
Question 19 Multiple Choice (Single Answer)

Which of the following is NOT a JavaScript reserved word?

  1. continue
  2. label
  3. with
  4. export
  5. bool
Question 20 Multiple Choice (Single Answer)

Which of the following statements is false regarding the 'substring' function having the above syntax?

string.substring(index1,index2);

  1. If index1 equals index1, substring returns an empty string.
  2. If any of the argument is less than 0 it is considered as 0.
  3. If index2 is not specified, substring extracts characters till the end of the string.
  4. If either argument is greater than the length of the string, it is considered as the same value as stringName.length.
  5. It is compulsory to pass at least one argument while calling the substring() function.
Question 21 Multiple Choice (Single Answer)

Which of the following statements is FALSE regarding the null data type?

  1. The null data type has only one value.
  2. The typeOf operator shows null as boolean values.
  3. null is not same as 0
  4. null is a keyword
  5. Value of a variable can be set as null.
Question 22 Multiple Choice (Single Answer)

Which of the following tasks CAN NOT be performed by JavaScript?

  1. Detecting client browser information.
  2. Validating user input.
  3. Handling date and time.
  4. Mathematical calculations on client system.
  5. Access files on the client system.
Question 23 Multiple Choice (Single Answer)

Which of the following is NOT a restriction while using the "strict option" in JavaScript?

  1. Variables must be declared
  2. Parameter name can not be duplicated
  3. eval can not be used as an identifier.
  4. with statement
  5. The word string can not be used as an identifer
Question 24 Multiple Choice (Single Answer)

What will be the output of the above code snippet?

var str=This is a sample string;
var output=str.split(,);
document.write(output);

  1. Compilation Error
  2. This,is,a,sample,string
  3. This,is,a,sample,string,
  4. ,This,is,a,sample,string,
  5. T,h,i,s,i,s,a,s,a,m,p,l,e,s,t,r,i,n,g
Question 25 Multiple Choice (Single Answer)

Which of the following statements is FALSE regarding InnerHTML?

  1. The content of a webpage can be changed dynamically using InnerHTML.
  2. The id of an element can be referred by using getElement() method.
  3. InnerHTML is not a part of DOM.
  4. It was introduced by Microsoft.
  5. It is valid for both block and inline elements.