wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Web6

Total questions: 44

Worksheet time: 22mins

Name
Class
Date
1.

Result of the script if a=6, b=8:

script

st=prompt(‘a=’);

a=parseInt(st);

st=prompt(‘b=’);

b=parseInt(st);

s=a*b;

st=’s=’+s;

alert(st);

/script

a)
48
b)
14
c)
47
d)
6
e)
8
2.

Result of the script if n=15:

script

st=prompt(‘n=’);

n=parseInt(st);

k=0;

for(i=1; i<=n; i++)

if (n%i==0) k++;

alert(k);

/script

a)
4
b)
15
c)
5
d)
3
e)
2
3.

Result of the script if s=moloko:

script

st=prompt(‘ ’); L=s.length;

k=0;

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

{

c=s.charAt(i);

if (c==’o’) k++;

}

alert(k);

/script

a)
3
b)
15
c)
4
d)
5
e)
2
4.

Result of the script:

script

var num=2;
var power=10;
var result=1;
var subpower=1
while (subpower<=power){result*=num;subpower++};
document.write(result)

/script

a)
2^10
b)
10^2
c)
100
d)
1^10
e)
200
5.

Result of the script:

script

var i=1;

for (var i = 1; i <= 50; i++) {

document.write(i + '<br>');

}

/script

a)
numbers from 1 to 50
b)
1^50
c)
50^1
d)
1*50
e)
50
6.

Result of the script:

script

var i = 1;

while (i <= 50)

{

document.write(i + '<br>'); i++;

}

/script

a)
numbers from 1 to 50
b)
1^50
c)
50^1
d)
1*50
e)
50
7.

Result of the script:

script

var arr = [1, 2, 4, -1, -3, 8, 7, 0, -5, 18, 12];

for (var i = 0; i < arr.length; i++)

{

if(arr[i] > 0 && arr[i] < 10)

{

document.write(arr[i]);

}

}

/script

a)
output only those array elements that are greater than zero and less than 10
b)
output only those array elements that are greater than one and less than 11
c)
output only those array elements that are less than zero and greater than 10
d)
output only those array elements that are equal to zero and 10
e)
output only those array elements that are equal to one and 11
8.

Result of the script:

script

var arr = [1, 2, 3, 4, 5];

var sum = 0;

for (var i = 0; i < arr.length; i++)

{

sum += arr[i];

}

alert(sum);

/script

a)
15
b)
5
c)
20
d)
6
e)
0
9.

Result of the script:

script

var arr = [1, 2, 3, 4, 5];

var sum = 0;

for (var i = 0; i < arr.length; i++)

{

sum += arr[i] * arr[i];

}

alert(sum);

/script

a)
55
b)
15
c)
60
d)
5
e)
4
10.

Result of the script:

script

var arr = [1, 2, 3, 7, 6, 9];

var sum = 0;

for (var i = 0; i < arr.length; i++)

{

sum += arr[i];

}

var result = sum / arr.length;

alert(result);

/script

a)
4.7
b)
15
c)
5.6
d)
5.5
e)
10
11.

Result of the script:

script

for (var i = 2; i < 100; i += 2)

{

document.write(i + '<br>');

}

/script

a)
even numbers from 1 to 100
b)
numbers from 2 to 100
c)
numbers from 1 to 100
d)
odd numbers from 2 to 100
e)
numbers from 1 to 99
12.

Result of the script:

script

var a = 10;

var b = 3;

alert(a %b);

/script

a)
1
b)
3
c)
7
d)
30
e)
13
13.

Result of the script:

script

var a = 10;

var b = 3;

alert(a / b);

/script

a)
3.33
b)
1.33
c)
7.33
d)
30.3
e)
13.33
14.

Result of the script:

script

var arr = ['Hello, ', 'world', '!'];

alert(arr[0] + arr[1] + arr[2]);

/script

a)
Hello, world!
b)
Hello, world, !
c)
Hello world!
d)
Hello!
e)
Hello, world
15.

Result of the script:

script

var arr = ['Hello, ', 'world', '!'];

arr[0] = 'Bye, ';

alert(arr);

/script

a)
Bye, world!
b)
Hello, world!
c)
Hello, world
d)
Hello!
e)
Bye world!
16.

Result of the script:

script

var str = 'abcde';

alert(str[4]);

/script

a)
e
b)
b
c)
c
d)
d
e)
a
17.

Result of the script:

script

var num = 1;

num = num + 12;

num = num - 14;

num = num * 5;

num = num + 1;

num = num - 1;

alert(num);

/script

a)
-5
b)
-1
c)
-4
d)
5
e)
-6
18.

Result of the script:

script

var num = 47;

num = num + 7;

num = num - 18;

num = num * 10;

num = num / 15;

alert(num);

/script

a)
24
b)
15
c)
25
d)
21
e)
23
19.

Result of the script:

<button onclick="alert('Hello!')">Click me</button>

a)
message: Hello
b)
message: Click me
c)
message: Button
d)
message: alert
e)
message: onclick
20.

Result of the script:

script

var num = 10;

if (num == 10)

{

alert('True');

}

Else

{

alert('False');

}

/script

a)
True
b)
False
c)
Not true
d)
Alert
e)
Num
21.

Result of the script:

script

var result = 1;

var arr = [2, 3, 4, 5];

for (var i = 0; i < arr.length; i++)

{

result = result * arr[i];

}

alert(result);

/script

a)
120
b)
5
c)
15
d)
20
e)
100
22.

Result of the script:

script

var arr = { 'ru':['голубой', 'красный', 'зеленый'],

'en':['blue', 'red', 'green'], };

alert(arr['ru'][0]);

/script

a)
голубой
b)
красный
c)
green
d)
blue
e)
зеленый
23.

Result of the script:

script

var arr = { 'ru':['голубой', 'красный', 'зеленый'],

'en':['blue', 'red', 'green'], };

alert(arr['en'][1]);

/script

a)
red
b)
красный
c)
blue
d)
голубой
e)
зеленый
24.

Result of the script:

script

var str = 'aaa bbb ccc';

alert(str.substr(4, 3));

/script

a)
bbb
b)
abc
c)
aaa
d)
ccc
e)
cba
25.

Result of the script:

script

var str = 'aaa bbb ccc';

alert(str.substring(8, 11));

/script

a)
ccc
b)
abc
c)
aaa
d)
cba
e)
bbb
26.

Result of the script:

script

var a = ['a', 'b', 'c'];

var b = [1, 2, 3];

var c = a.concat(b);

alert(c);

/script

a)
['a', 'b', 'c', 1, 2, 3]
b)
[1, 'b', 3, 'a', 2, 'c']
c)
['a', 'b', 'c']
d)
[1, 2, 3]
e)
['a', 2, 'c', 1, 'b', 3]
27.

Result of the script:

script

var a = ['a', 'b', 'c'];

var b = [1, 2, 3];

var c = b.concat(a);

alert(c);

/script

a)
[1, 2, 3, 'a', 'b', 'c']
b)
[1, 'b', 3, 'a', 2, 'c']
c)
['a', 'b', 'c']
d)
[1, 2, 3]
e)
['a', 2, 'c', 1, 'b', 3]
28.

Result of the script:

script

var str = 'aaa@bbb@ccc';

alert(str.replace('@', '!'));

/script

a)
aaa!bbb@ccc
b)
ccc bbb aaa
c)
ccc!@aaabbb
d)
aaa bbb ccc
e)
ccc!bbb@aaa
29.

Result of the script:

script

alert(Math.max(1, 5, 10, 34, 100));

/script

a)
100
b)
1
c)
34
d)
5
e)
10
30.

Result of the script:

script

alert((Math.floor(2.9999));

/script

a)
2
b)
2.9
c)
3
d)
2.99
e)
2.10
31.

Result of the script:

script

alert((Math.abs(-3));

/script

a)
3
b)
2.9
c)
2
d)
-3
e)
2.99
32.

Result of the script:

script

let str = 'abcde';

console.log(str.length);

/script

a)
5
b)
4
c)
6
d)
2
e)
7
33.

Result of the script:

script

let str = 'Я учу учу Javascript';

console.log(str.indexOf('учу'));

/script

a)
6
b)
4
c)
2
d)
5
e)
7
34.

Result of the script:

script

let str = 'Я учу учу Javascript';

console.log(str.indexOf('учу', 5));

/script

a)
4
b)
2
c)
6
d)
5
e)
7
35.

Result of the script:

script

for (var i = 100; i > 0; i--)

{

document.write(i + '<br>');

}

/script

a)
numbers from 99 to 1
b)
numbers from 100 to 1
c)
numbers from 1 to 100
d)
odd numbers from 1 to 100
e)
even numbers from 1 to 100
36.

Result of the script:

script

var i = 2;

while( i < 9 ){

 document.write( i++ );

}

/script

a)
numbers from 2 to 8
b)
numbers from 2 to 10
c)
numbers from 1 to 10
d)
odd numbers from 2 to 9
e)
even numbers from 2 to 9
37.
Javascript. Method of processing strings:
a)
charAt(index)
b)
concopy(string)
c)
cut(string)
d)
write(index)
e)
delete(index)
38.
Select the correct version of your web-page's domain name:
a)
http://www. it. spb. ru
b)
http:\\www. it. spb. Ru
c)
ftp://www. it. spb. ru
d)
http:\\www. it. spb. ru\index\
e)
http://www. it. spb. ru/index/
39.
When was the Internet launched:
a)
late 1960’s
b)
1975
c)
late 1970’s
d)
1965
e)
late 1980’s
40.
The hypertext markup language HTML was developed by a British scientist … :
a)
Tim Berners-Lee
b)
Ton Roosendaal
c)
Bill Gates
d)
Mark Zuckerberg
e)
Daniel J. Bernstein
41.
Creator of the JavaScript programming language:
a)
Brendan Eich
b)
Ton Roosendaal
c)
Bill Gates
d)
Mark Zuckerberg
e)
Tim Berners-Lee
42.
Multi-paradigm programming language:
a)
Javascript
b)
HTML
c)
CSS
d)
Autodesk 3D max
e)
Blender
43.
The most popular search engine in the world:
a)
Google
b)
Twitter
c)
Mail.ru
d)
Facebook
e)
VKontakte
44.
The search engine:
a)
Yahoo!
b)
Twitter
c)
Mail.ru
d)
Facebook
e)
Vkontakte