wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Arrays

Total questions: 20

Worksheet time: 20mins

Name
Class
Date
1.

Pick up the odd one

a)

List

b)

variable

c)

array

2.

positioning of values inside array is called as

a)

position

b)

index

c)

number

d)

values

3.

Choose the incorrect format of creating an array

a)

array_name2=[];

b)

array-name=[];

c)

2arrayname=[];

d)

array@name=[];

e)

array$name=[];

4.

var names= ["batMan", "spiderMan", "hulk", "Avengers"];

value = names[1];

console.log(value);

a)

batMan

b)

spiderMan

c)

hulk

d)

Avengers

5.

var names= ["bat man", "spider man", "hulk", "Avengers"];

value = names[4];

console.log(value)

a)

Avengers

b)

hulk

c)

undefined

6.

Pick the correct syntax to find the number of values inside an array

a)

arrayname.values;

b)

arrayname.length;

c)

arrayname.length();

7.

Code to get the last value in this array


var names= ["bat man", "spider man", "hulk", "Avengers"];

a)

names[(names.length)-1];

b)

names[3];

c)

(names.length)-1

8.

Ways of adding a new value to the end of the array


var names= ["bat man", "spider man", "hulk", "Avengers"];

a)

names.push("aquaman")

b)

names[names.length]="aquaman";

c)

names.pop();

9.

var names= ["bat man", "spider man", "hulk", "Avengers"];


console.log(typeof(names));

a)

array

b)

object

c)

string

10.

Choose all that is true about array

a)

an array is a variable that is used to store different data types

b)

stores multiple values in one box

c)

an array is an ordered list of values

d)

length of an array is dynamically sized and auto-growing

e)

Every value is associated with numeric index starting with 1

11.

Array index must be

a)

string

b)

numeric

c)

both

12.

Choose the best


ar names= ["bat man", "spider man", "hulk", "Avengers"];


status=Array.isArray(names)

console.log(status);

a)

true

b)

false

c)

none

13.

The marks obtained from each project submission based on the class number sorted can be best added/stored in?

a)

variable

b)

array

14.

The total marks obtained from hats off, project submission, additional activities of projects and class attendance can be summed up and finally stored in ?

a)

variable

b)

array

15.

Adds values to the array

a)

push()

b)

pop()

c)

unshift()

d)

shift()

16.

Splice adds/removes item to/from any array.


var names= ["bat man", "spider man", "hulk", "Avengers"];


names.splice(2,0,"iron man")

console.log(names)

a)

["bat man", "iron man", "spider man", "hulk", "Avengers"]

b)

["bat man", "spider man", "iron man", "hulk", "Avengers"]

17.

Splice adds/removes value from array

var names= ["bat man", "spider man", "hulk", "Avengers"];


names.splice(2,1)

console.log(names)

a)

["bat man", "spider man", "Avengers"]

b)

["bat man", "spider man"]

c)

["bat man", "spider man", "hulk"]

18.

Concept of inserting scores into the leaderboard and arranging scores from the highest to least can be done using?

a)

arrayname.push() and arrayname.sort()

b)

arrayname.push() and arrayname.reverse()

c)

arrayname.pop() and arrayname.sort()

d)

arrayname.pop() and arrayname.reverse()

19.

collection of marks in an array is sorted descending, the highest mark can be fetched using the code

a)

arrayname[0]

b)

arrayname[arrayname.length-1]

c)

arrayname.length

20.

collection of marks in an array is sorted descending, the least score can be fetched using the code

a)

arrayname[0]

b)

arrayname[arrayname.length-1]

c)

arrayname[arrayname.length]