Javascript questions
The following list indicates, without restriction, the kinds of questions
that could be asked. On exams you will be given a choice of 5 potential answers.
- Within an HTML file JavaScript appears inside which HTML element ?
- In JavaScript variables can hold what types of values ?
- In JavaScript multiple line comments are surrounded with what characters ?
- In JavaScript, after executing var x = "hello"; then if you
wanted to have var z have the value of the number of characters
in x, what JavaScript would you use ?
- Which of the following is not a fundamental type in JavaScript ?
- In JavaScript, given an object instance o, in order to access o's property
prop, and o's method method(), what Javascript would you would use ?
- In JavaScript, which of the following is not a valid comparison operator ?
- JavaScript programming for the web is described as event driven because
…
- In JavaScript, the Number type is used to represent what ?
- In JavaScript, strings are what ?
- JavaScript has the following looping constructs
- In order to declare the variable 'foo' explicitly in JavaScript, one
would write what ?
- In JavaScript, in addition to normal values, there are two special
values 'undefined' and 'null'. The difference between these two values
is what ?
- The value of the JavaScript expression "2 + 2 " + 3 + 4 is what ?
- The difference between the comparison operators == and === is what ?
- Which sequence of numbers does the variable x take on in the
following loop. var x = 7; while(x >= 0) {x -= 2;}
- Which sequence of numbers does the variable x take on in the
body of the following loop.
var x = 4; while (x < 200) {x = 2*x+2;}
- Given that x = "abcdefgdefg", what value does
x.indexOf("def") return ?
- Which of the following JavaScript errors cannot be detected by JSLint ?
- Given var x = "0", y = "5"; what is the result of
y+x+"0"
- Given var x = {desc:"description"}; var y = {next:x, desc:"empty"};
what is the value of y.next.previous
- What does the statement document.getElementsByClass("h1") return ?
- Which of the following loops generate the sequence
0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20 ?
- The following JavaScript code fragment var i=0; while (i < 10) { alert("hi"); i += 1;} creates how many alert boxes ?
- After the execution of the following code fragment,
var x=6; var i=0; while (i < 5) {var j=0; while (j < 3) { x = x+1; j += 1} i += 1 }
x has the value ?
- After the execution of the following code fragment,
var x = 2; var y = 2; var z = 6;
if((x == y) && (z < 7)){ if(x === 2) { z = 7; } else { z = 2; } } else { z = 8; }
z has the value ?
- After execution of the JavaScript fragment var x= ["a", "b","c"] is ?
- Which of the following is not a valid JavaScript variable name ?
- In JavaScript, which of the following is interpreted as being true in a logical expression
- In JavaScript, which of the following is interpreted as being false in a logical expression
- The difference between the comparison operators == and === is what ?
- In JavaScript, in addition to normal values, there are two special values 'undefined' and 'null'. The difference between these two values is what ?
- The statement "use strict"; in a JavaScript function does what ?
- If the JavaScript code var x = 1 + +"2" + "2"; is executed, then x has what value ?
- In the JavaScript code fragment var i=1; while(i <=5) {i+=2; … } within the … in the loop body i has values in what order ?
- JavaScript has what loop constructs ?
- Which JavaScript loop constructs does JSLint reject ?
- In order to declare the variable 'foo' explicitly in JavaScript, one would write what ?
- In JavaScript-HTML, a cookie is what ?
- After execution of the following JavaScript fragment
var z = 2;
var x = 3;
var q = (z == 2) || (x== 5);
then q has what value ?
- Which of the following is not a reserved word in JavaScript ?
- Unit testing is what ?
- JavaScript functions can do which of the following ?
- After execution of the following JavaScript fragment
var x = 1/0 * -1;
x has what value ?
- After execution of the following JavaScript fragment
var x = 1/0 - 1/0;
x has what value ?
- In Javascript string are immutable, this means what ?
- In Javascript how do you round a number to 2 decimal places ?