1
CSE 3901-MIDTERM 2 EXAM LATEST UPDATE -2025/2026- 100+
QUESTIONS AND VERIFIED ANSWERS ALL THE BEST
25
javascript: what is the result of the last function call?
function apply(x, a) {
return x(a);
}
function square(i) {
return i*i;
}
apply(square, 5)
var foo = function (a, b) {...};
foo("hi", 3);
javascript: create an anonymous function and assign it to "foo" then call the
function
Dr. Turing
javascript: what does prof() return?
function grantDegree(a) {
var prefix = "Dr. ";
function add() {
return prefix + a;
, 2
}
return add;
}
var prof = grantDegree("Turing");
prof()
true, false
javascript: what are the results of testPost(4) and testPos(-3)?
function greaterThan (bound) {
function compare (value) {
return value > bound;
}
return compare;
}
var testPos = greaterThan(0);
testPos(4)
testPos(-3)
var nums = [1, 2, 3];
nums.length = 2;
javascript: create an array "nums" with the elements 1, 2, and 3 and then
concatenate it to just 1 and 2
var a = {x:1, y:4};
function increment (param) {
CSE 3901-MIDTERM 2 EXAM LATEST UPDATE -2025/2026- 100+
QUESTIONS AND VERIFIED ANSWERS ALL THE BEST
25
javascript: what is the result of the last function call?
function apply(x, a) {
return x(a);
}
function square(i) {
return i*i;
}
apply(square, 5)
var foo = function (a, b) {...};
foo("hi", 3);
javascript: create an anonymous function and assign it to "foo" then call the
function
Dr. Turing
javascript: what does prof() return?
function grantDegree(a) {
var prefix = "Dr. ";
function add() {
return prefix + a;
, 2
}
return add;
}
var prof = grantDegree("Turing");
prof()
true, false
javascript: what are the results of testPost(4) and testPos(-3)?
function greaterThan (bound) {
function compare (value) {
return value > bound;
}
return compare;
}
var testPos = greaterThan(0);
testPos(4)
testPos(-3)
var nums = [1, 2, 3];
nums.length = 2;
javascript: create an array "nums" with the elements 1, 2, and 3 and then
concatenate it to just 1 and 2
var a = {x:1, y:4};
function increment (param) {