0% found this document useful (0 votes)
2K views15 pages

JS_TESTS-erekle

Uploaded by

Erekle Bazanovi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views15 pages

JS_TESTS-erekle

Uploaded by

Erekle Bazanovi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

1) what will be the output of: console.log(null == undefined) ?

a. false -
b. true
c. null
d. undefined

2) what will be the output of: console.log("24" + 10 - 5) ?


a. 29
b. 2405
c. 24105
d. 19

3) let age;
what will be the output of: console.log(age);
a. null
b. 0
c. undefined
d. age is not defined
e. false

4) what will be the output of: console.log(typeof null)


a. null
b. false
c. object
d. array
e. undefined

5) what will be the output of: console.log(typeof undefined)


a. null
b. false
c. object
d. array
e. undefined

6) what will be the output of:

if(0) {
console.log("Alex")
} else if(1) {
console.log("Saba")
} else if(5>3) {
console.log("Joni")
} else {
console.log("Levani")
}

a. "Alex"
b. "Saba"
c. "Joni"
d. “Levani”

7) what will be the output of:


if(0) {
console.log("Alex")
}
if(1) {
console.log("Saba")
}
if(5>3) {
console.log("Joni")
}
if(5<3) {
console.log("Levani")
}
a. "Alex"
b. "Saba" "Joni"
c. "Joni" "Levani"
d. "Saba" "Levani"

8) let a = 4*3 - "4" + "9";


switch (a) {
case 17:
console.log( 'Joni' );
break;
case 89:
console.log( 'Alex' );
break;
case 1249:
console.log( 'Levani' );
break;
default:
console.log( 'Saba' );
}
what will be the output?
a. 'Joni'
b. 'Alex'
c. 'Levani'
d. 'Saba'

9) let a = 10 % 7;
switch (a) {
case 2:
console.log('Joni');
case 3:
console.log('Alex');
case 7:
console.log('Levani');
default:
console.log('Saba');
}
what will be the output?
a. 'Joni'
b. 'Alex' 'Levani' 'Saba'
c. 'Joni' 'Alex' 'Levani'
d. 'Saba'
e. 'Alex'

10) let a = 10 >= 5 + "3"


what will be the output of: console.log(a ? "Alex" : "Joni")
a."Alex"
b. false
c. null
d. "Joni"
e. true

11) let a = 24+10/(2+3)


console.log(a >= -5 && a < 100 && a%2)
what will be the output?
a. 13
b. 34/5
c. 26
d. true
e. false
f. 0

12) let a = 24;


console.log((a === "24" || a === 24) && a = 10)
what will be the output?
a. 24
b. true
c. 10 +
d. null
e. false --

13) const a = 24;


console.log((a === "24" && a === 24) && a > 10)
what will be the output?
a. 24
b. true
c. 10
d. null
e. false
14) let i = 5;
while (i <= 8) {
console.log( i - 1 );
i++;
}
what will be the output of this console.log?
a. 5, 6, 7, 8
b. 4, 5, 6, 7
c. 0, 1, 2, 3, 4, 5, 6, 7, 8
d. 5, 6, 7

15) for (let i = 2; i <= 15; i + 3) {


console.log(i);
}
what will be the output of this console.log?
a. 2, 5, 8, 11, 14
b. 0, 3, 6, 9, 12, 15
c. 2, 4, 8, 11, 14, 15
d. 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15

16) const a = 5
const sumFunc = (b) => {
const sum = a
return a + b
}
console.log(sumFunc(10))
what will be the output of this console.log?
a. 10
b. 15
c. undefined
d. null
e. 5
f. 30

17) const a = 5
const sumFunc = (b) => {
const sum = a + b
}
console.log(sumFunc(10))
what will be the output of this console.log?
a. 10
b. 15
c. undefined
d. null
e. 5
f. 30

18) const a = 5
const sumFunc = (b) => {
const a = 20
const sum = a + b
return sum
}
console.log(sumFunc(10))
what will be the output of this console.log?
a. 10
b. 15
c. undefined
d. null
e. 5
f. 30

19) const numbersArray = [1, 2, 3, 4, 5, 6]


const newArray = numbersArray.map(number => number > 3)
console.log(newArray)
what will be the output of this console.log?
a. [1, 2, 3, 4, 5, 6]
b. [false, false, false, true, true, true]
c. [4, 5, 6]
d. [true, true, true]
e. [undefined, undefined, undefined, true, true, true]

20) const numbersArray = [10, 20, 30, 40, 5, 6]


const newArray = numbersArray.map(number => {
return number % 4
})
console.log(newArray)
what will be the output of this console.log?
a. [2, 0, 2, 0, 1, 2]
b. [2.5, 5, 2, 0, 1, 2]
c. [2, null, 2, null, 1, 2]
d. [true, false, true, false, true, true] ---

21) const numbersArray = [1, 2, 3, 4, 5, 6]


const newArray = numbersArray.filter(number => number > 3)
console.log(newArray)
what will be the output of this console.log?
a. [1, 2, 3, 4, 5, 6]
b. [false, false, false, true, true, true]
c. [4, 5, 6]
d. [true, true, true]
e. [undefined, undefined, undefined, true, true, true]
f. [null, null, null, true, true, true]

22) function showMessage(name1, name2) {


if(name1 === "Alex") {
return "Hello" + " " + name1
} else if(name2 === "Joni") {
return "Hello" + " " + name2
} else {
return "Who are you?"
}
}
console.log(showMessage("Alex", "Joni"))
what will be the output of this console.log?
a. "Hello Alex"
b. "Hello Joni"
c. "Hello Alex" "Hello Joni"
d. "Who are you?"
e. undefined

23) function printTriangle(rows) {


let pattern = null;
for (let i = 1; i < rows; i++) {
for (let j = 1; j <= i; j++) {
pattern += 2;
}
}
console.log(pattern);
}
printTriangle(4);
what will be the output of this console.log?
a. 54
b. 12 =
c. 24 --
d. 36
e. 48
24) const array1 = [1,2,3,4]
const array2 = [1,2,3,4,...array1, 5]
console.log(array2)
what will be the output of this console.log?
a. [1, 2, 3, 4, 5]
b. [1, 2, 3, 4, 5, 1, 2, 3, 4]
c. [1, 2, 3, 4, 1, 2, 3, 4]
d. [1, 2, 3, 4, 1, 2, 3, 4, 5]

25) Which HTTP method is commonly used to send data from the front-end
(client) to the server?
a. "GET"
b. "DELETE"
c. "SEND"
d. "POST"
e. "PUT"

26) let user = { name: 'John' };


let admin = user;
admin.name = 'Pete';
console.log(user.name);
what will be the output of this console.log?
a. "John"
b. "Pete"
c. null
d. "John Pete"
e. undefined

27) let user = 'John';


let admin = user;

admin = 'Pete';

console.log(user);
what will be the output of this console.log?
a. "John"
b. "Pete"
c. null
d. "John Pete"
e. undefined

28) setTimeout(function() {
console.log("This message is displayed after 3 seconds.");
}, 3);
how much time it needs to show the console.log output?
a. 3000 seconds
b. equal or more than 0.003 seconds
c. equal or more than 3 seconds

29) const array1 = [“alex“, “joni“, “levani“]


const array2 = [“alex“, “joni“, “levani“]
console.log(array1 === array2)
what will be the output of this console.log function?
a. [“alex“, “joni“, “levani“]
b. true
c. false
d. boolean

30) const footballerObj = {


name: “Henry“,
number: 14,
currentClub: “Arsenal“,
statistics: [
{arsenal: {goals: 150, assists: 89}, france: {goals: 30, assists: 20}},
{barcelona: {goals: 50, assists: 43}, france: {goals: 40, assists: 5}},
]
}
how can you access Henry’s goals number at barcelona?
a. footballerObj[3]statistics[1].barcelona.goals
b. footballerObj.statistics[0].barcelona.goals
c. footballerObj.statistics[0].barcelona.assists
d. footballerObj.statistics[1].arsenal.goals
e. footballerObj.statistics[1].barcelona.goals
f. footballerObj.statistics[1].barcelona[0]goals

31) how can we make function asynchronous?


a. const async myFunc = () => { }
b. function async myFunc() { }
c. async function myFunc() { }
d. asynchronous function myFunc() { }

32) which array method returns a new array?


a) push
b) filter
c) foreach
d) pop

33) how can we remove less than 10 elements from: const array = [10, 20, 1,
4, 5, 34];
a. array.map(item => item > 10)
b. array.filter(item => item = 10)
c. array.filter(item => item > 10)
d. array.map(item => item < 10)
34) let name1 = null;
let name2 = “Messi“
let name3;
let name4 = “Ronaldinho“
console.log( name1 || name2 || name3 );
what will be the output of this console.log function?
a. “name1“
b. undefined
c. “Ronaldinho“
d. “Messi“
e. null

35) const array1 = [1, 2, 3, 4]


const array2 = [4,5,6,7]
const array3 = [...array1, ...array2]
const newArray = array3.filter(number => number > 3)
console.log(newArray)
what will be the output of this console.log function?

a. [[1,2,3], [4,4,5,6,7]]
b. [1,2,3,4, [4,5,6,7]]
c. [[1,2,3, 4,4,5,6,7]]
d. [1,2,3,4,4,5,6,7]
e. [4, 4, 5, 6, 7]
f. [[4, 4, 5, 6, 7]]

36) let user = {


name: “Alex“,
age: 50,
sayHi() {
console.log(this.name)
}
}
user.sayHi()
what will be the output of this console.log?
a. undefined
b. null
c. “Alex“ =
d. error --

37) console.log(name)
var name = “Alex“
what will be the output of this console.log?
a. null
b. undefined
c. “Alex“
d. Error

38) how can we access html DOM elements into Javascript file?
a. with class attribute
b. we can not access html DOM elements into Javascript file
c. with className attribute
d. with ID attribute

39) which hmtl element has „onChange“ attribute?


a. div
b. input
c. span
d. section
40) let age = 30
age = “30“
console.log(age === 30)
what will be the output of this console.log?
a. true
b. type error
c. false
d. undefined

You might also like