logo

Crowdly

Browser

Add to Chrome

WEB202_Web Development 2_24/25_T2_11.CCP

Looking for WEB202_Web Development 2_24/25_T2_11.CCP test answers and solutions? Browse our comprehensive collection of verified answers for WEB202_Web Development 2_24/25_T2_11.CCP at moodle.ncst.edu.bh.

Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!

What is wrong with this function?

function sayHello() {

message = "Hello, World!";

return message;

}

console.log(sayHello());

View this question

What is the correct fix for this function to return `2`?

function fixMe() {

const a = 1;

const b = 1;

let result;

result = "a" + "b"; // Fix this line

return result;

}

0%
0%
0%
View this question

What will be logged to the console?

const a = 5;

let b = 7 * a;

console.log(b);

0%
0%
0%
0%
View this question
Context:

Reduce for multiplication with initial value.

What will be logged?

const arr = [2,3];

const result = arr.reduce((acc, curr) => acc * curr, 5);

console.log(result);

]]>
View this question
Context:

Using slice to extract parts of a string.

What is the result?

const str = "abcdef";

console.log(str.slice(1, 4));

]]>
0%
0%
0%
0%
View this question
Context:

Using event.target.

What will this code do?

btn.addEventListener('click', function(e) {

console.log(e.target.id);

});

]]>
View this question
Context:

Multiple event listeners.

Is it possible to attach multiple click listeners to the same element?

]]>
0%
0%
0%
0%
View this question

Context:

const user = { name: "Ali", age: 25 };

let key = "age";

How can you access the age value dynamically?

View this question

Context:

Pushing a new branch to remote repository.

View this question
Context:

Callback functions in map().

What is the output?

const nums = [10, 20, 30];

console.log(nums.map(x => x / 10));

]]>
0%
0%
0%
0%
View this question

Want instant access to all verified answers on moodle.ncst.edu.bh?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome