Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

js Quiz

Total questions: 40

Worksheet time: 7mins

Name
Class
Date
1.

Question: Do you know what will be the output of this code?

Sual: Bu kodun nəticəsinin nə olacağını bilirsinizmi?

console.log(typeof typeof 1 );

a)

String

b)

number

c)

1

d)

true

2.

Question: Do you know what will be the output of this code?

let array=[1,2,3];

array[6]=9;

console.log(array[5]);

Sual: Bu kodun nəticəsinin nə olacağını bilirsin

a)

undefined

b)

1

c)

2

d)

9

3.

Question: Can you guess what will be the output of the code below?

console.log(typeof NaN);

Sual: Aşağıdakı kodun nəticəsinin nə olacağını təxmin edə bilərsinizmi?

a)

NaN

b)

number

c)

null

d)

undefined

4.

Question: Do you know what will be the output of this code?

console.log(false=='0');

Bu kodun nəticəsinin nə olacağını bilirsinizmi?

a)

false

b)

true

5.

Question: Do you know what will be the output of this code?

console.log("This is a string." instanceof String);

Bu kodun nəticəsinin nə olacağını bilirsinizmi

a)

true

b)

false

6.

Question: Do you know what will be the output of this code?

const numbers = [33, 2, 8];

numbers.sort();

console.log(numbers[1])

Bu kodun nəticəsinin nə olacağını bilirsinizmi?

a)

33

b)

2

c)

8

d)

1

7.

If you type the following code in the console window, what result will you get?

3 > 2 > 1 === false;

Konsol pəncərəsində aşağıdakı kodu yazsanız, hansı nəticəni əldə edəcəksiniz?

a)

true

b)

false

8.

JavaScript is a ___ -side programming language.

JavaScript ___ tərəfli proqramlaşdırma dilidir.

a)

Client

b)

Server

c)

Both

d)

None

9.

Which of the following will write the message “Hello DataFlair!” in an alert box?

Aşağıdakılardan hansı “Salam DataFlair!” mesajını yazacaq. xəbərdarlıq qutusunda?

a)

alertBox("Hello DataFlair!");

b)

alert(Hello DataFlair!);

c)

alert("Hello DataFlair!");

d)

alert("Hello DataFlair!);

10.

How do you find the minimum of x and y using JavaScript?

JavaScript-dən istifadə edərək minimum x və y-ni necə tapırsınız?

a)

min(x,y);

b)

Math.min(x,y)

c)

Math.min(xy)

d)

min(xy);

11.

Which of the following statements will throw an error?

Please select 2 correct answers

Aşağıdakı ifadələrdən hansı xətaya səbəb olacaq?

Zəhmət olmasa 2 düzgün cavab seçin

a)

var fun = function bar( ){ }

b)

var fun = function bar{ }

c)

function fun( ){ }

12.

If the value of x is 40, then what is the output of the following program?

(x % 10 == 0)? console.log(“Divisible by 10”) : console.log(“Not divisible by 10”);

Əgər x-in qiyməti 40-dırsa, onda aşağıdakı proqramın nəticəsi nədir?

(x % 10 == 0)? console.log("10-a bölünür") : console.log("10-a bölünmür");

a)

ReferenceError

b)

Divisible by 10

c)

Not divisible by 10

d)

None of the above

13.

Which JavaScript label catches all the values, except for the ones specified?

Hansı JavaScript etiketi göstərilənlərdən başqa bütün dəyərləri tutur?

a)

catch

b)

label

c)

Try

d)

default

14.

Which are the correct “if” statements to execute certain code if “x” is equal to 2?

Əgər “x” 2-yə bərabərdirsə, müəyyən kodu yerinə yetirmək üçün düzgün “if” ifadələri hansılardır?

a)

if(x 2)

b)

if(x = 2)

c)

f(x == 2)

d)

if(x != 2 )

15.

What will the code return?

Boolean(3 < 7)

Kod nə qaytaracaq?

Boolean (3 < 7)

a)

true

b)

false

c)

NaN

d)

SyntaxError

16.

What is the output of the following code in the console?

Konsolda aşağıdakı kodun çıxışı nədir?

var x = 0;

function fun(){

++x;

this.x = x;

return x;

}

var bar = new new fun;

console.log(bar.x);

a)

ReferenceError

b)

undefined

c)

1

d)

TypeError

17.

Which is the correct JavaScript syntax to change the HTML content given below?

<p id=”test”>Hello World!</p>

Aşağıda verilmiş HTML məzmununu dəyişdirmək üçün düzgün JavaScript sintaksisi hansıdır?

a)

document.getElementById(“test”).innerHTML = “Hello DataFlair!”;

b)

document.getElementsById(“test”).innerHTML = “Hello DataFlair!”;

c)

document.getElementById(test).innerHTML = “Hello DataFlair!”;

d)

document.getElementByTagName(“p”)[0].innerHTML = “Hello DataFlair!”;

18.

Are “==” and “===” operators different in JavaScript?

JavaScript-də “==” və “===” operatorları fərqlidirmi?

(a)  

19.

A Function Associated With An object is Called:

Obyektlə əlaqəli funksiya necə adlanır:

a)

Function

b)

Method

c)

Link

d)

None

20.

JavaScript is ECMAScript

a)

True

b)

False

21.

Which of the following is not a primitive data type in JavaScript?

Aşağıdakılardan hansı JavaScript-də primitiv məlumat növü deyil?

a)

Number

b)

String

c)

Boolean

d)

Object

22.

What does the “typeof” operator do in JavaScript?


“typeof” operatoru JavaScript-də nə edir?

a)

Returns the data type of a variable

b)

Checks if a variable is defined

c)

Assigns a value to a variable

d)

Concatenates two strings

23.

console.log(2 + “2”);

a)

“4”

b)

“22”

c)

4

d)

22

24.

Which of the following is not a comparison operator in JavaScript?

Aşağıdakılardan hansı JavaScript-də müqayisə operatoru deyil?

a)

==

b)

===

c)

!=

d)

=<

25.

var x = 5;

var y = “5”;

console.log(x == y);

a)

true

b)

false

c)

undefined

d)

Error

26.

var x = [1, 2, 3];

console.log(x.length);

a)

1

b)

2

c)

3

d)

4

27.

console.log(2 ** 3);

a)

5

b)

6

c)

8

d)

9

28.

What is the correct syntax for a “for” loop in JavaScript?


JavaScript-də “for” döngəsi üçün düzgün sintaksis nədir?

a)

for (var i = 0; i < 5; i++)

b)

for (i = 0; i < 5; i++)

c)

for (var i = 5; i > 0; i–)

d)

for (i = 5; i > 0; i–)

29.

What is the output of the following code:

console.log(Math.random());

Aşağıdakı kodun çıxışı nədir

a)

0

b)

0.2

c)

1

d)

A random number between 0 and 1

30.

What is the output of the following code:

console.log(“Hello”.charAt(1));

Aşağıdakı kodun çıxışı nədir: console.log(“Salam”.charAt(1));

a)

"H"

b)

“e”

c)

“l”

d)

“o”

31.

What is the output of the following code:

var x = [1, 2, 3];

x.push(4);

console.log(x)

Aşağıdakı kodun çıxışı nədir

a)

[1, 2, 3]

b)

[2, 3, 4]

c)

[1, 2, 3, 4]

d)

Error

32.

What is the output of the following code:

Aşağıdakı kodun çıxışı nədir

var x = 5;

var y = 3;

console.log(x *= y);

a)

8

b)

15

c)

12

d)

25

33.

What is the output of the following code:

Aşağıdakı kodun çıxışı nədir:

var x = [1, 2, 3];

console.log(x.slice(1));

a)

[1, 2]

b)

[2, 3]

c)

[1, 2, 3]

d)

Error

34.

What is the output of the following code:

Aşağıdakı kodun çıxışı nədir

console.log(typeof []);

a)

“array”

b)

“object”

c)

“null”

d)

“undefined”

35.

Which of the following methods removes the last element from an array and returns that element?

Aşağıdakı üsullardan hansı massivdən sonuncu elementi çıxarır və həmin elementi qaytarır?

a)

push()

b)

pop()

c)

shift()

d)

unshift()

36.

Which built-in method returns the string representation of the number's value?

Hansı daxili metod nömrənin dəyərinin sətir təsvirini qaytarır?

a)

toValue()

b)

toNumber()

c)

toString()

d)

None of the above.

37.

Which of the following function of String object returns the characters in a string between two indexes into the string?

String obyektinin aşağıdakı funksiyalarından hansı iki indeks arasındakı sətirdəki simvolları sətirə qaytarır?

a)

slice()

b)

split()

c)

substr()

d)

substring()

38.

How do you write a comment in JavaScript?

JavaScript-də şərhi necə yazırsınız?

a)

var name;

b)

variable = name;

c)

variable name;

d)

v name;

39.

console.log('10' + 20);

a)

1020

b)

30

c)

102010

d)

NaN

40.

What is the correct way to write an if statement in JavaScript?
JavaScript-də if ifadəsini yazmağın düzgün yolu nədir?

a)

if (x === 5) {

    console.log('x is equal to 5');

b)

if x === 5 {

    console.log('x is equal to 5');

c)

if x = 5 {

    console.log('x is equal to 5');

d)

if x == 5 {

    console.log('x is equal to 5');