Programming Quiz Channel – Telegram
Programming Quiz Channel
615 subscribers
81 photos
4 videos
1 file
Programming quizzes and knowledge tests

Short quizzes on programming, logic and computer science.

Test and improve your coding knowledge.
Join 👉 https://rebrand.ly/bigdatachannels

DMCA: @disclosure_bds
Contact: @mldatascientist
Download Telegram
What will this code output to the console and why?
Difficulty: Average🤨

function createAccumulator(initialValue) {
let total = initialValue;

return function(amount) {
total += amount;
return total;
};
}

const accumulator = createAccumulator(10);

console.log(accumulator(5));
console.log(accumulator(10));
console.log(accumulator(-5));

const anotherAccumulator = createAccumulator(100);
console.log(anotherAccumulator(50));
👍32🤔1
JavaScript Task
Write a function findMax(arr) that takes an array of numbers and returns the largest number in the array.
Difficulty: Easy😁

function findMax(arr) {

}

console.log(findMax([3, 5, 7, 2, 8]));
How can you apply different styles to a child element when hovering over its parent in CSS?
Anonymous Quiz
45%
parent:hover child { /* styles */ }
17%
parent + hover child { /* styles */ }
26%
child:hover { /* styles */ }
12%
parent > hover child { /* styles */ }
Find the error in the code.
Difficulty: Average🤨

let numbers = [1, 2, 3, 4, 5];

function sumArray(arr) {
return arr.reduce((accumulator, current) => {
return accumulator + current;
}, 0);
}

console.log('Sum:', sumArray(numbers));

numbers = '1, 2, 3, 4, 5';
console.log('Sum:', sumArray(numbers));
How many primitive data types are there in JavaScript?
Anonymous Quiz
44%
7
14%
9
14%
8
29%
6
JavaScript Task
Write a function isEven that takes a number as an argument and returns true if the number is even and false if it is odd.
Difficulty: Easy😁

function isEven(num) {

}

console.log(isEven(4));
console.log(isEven(7));
console.log(isEven(0));
console.log(isEven(-2));
👍2
Which CSS property is used to add rounded corners to an element?
Anonymous Quiz
6%
corner-radius
11%
border-corner
79%
border-radius
5%
border-style
👍1🔥1👏1
Find the error in the code.
Difficulty: Average🤨

function processData(data) {
let result = data.map(item => item.value);
return result;
}

let inputData = null;

console.log(processData(inputData));
👍3
JavaScript Task
Remove all empty strings from the array.
Difficulty: Average🤨

let arr = [1, '', 2, 3, '', 5];
How can you create a flexbox container in CSS?
Anonymous Quiz
6%
display: grid;
81%
display: flex;
9%
display: inline-flex;
4%
display: block;
Find the error in the code.
Difficulty: Hard😤

function processArray(arr) {
let result = [];

arr.forEach(item => {
if (item != '') {
result.push(item);
} else if (typeof item === 'number') {
result.push(item * 2);
}
});

return result;
}

let data = [1, '', 2, 3, '', 5, null, undefined, 'hello'];

console.log(processArray(data));
🤔2
How do you handle asynchronous operations in JavaScript?
Anonymous Quiz
18%
Using callbacks
62%
Using async/await
3%
Using Promises
18%
All of the above
JavaScript Task
Display the following pyramid
Difficulty: Average🤨

1
22
333
4444
55555
666666
7777777
88888888
999999999