Javascript Interview Questions – MCQ on Arrays

Javascript objective interview practice question on arrays. In these objective questions i covered mostly used javascript array methods such push,pop,slice,shift,sort etc.

Javascript Interview Questions on Arrays

Question 1. What’s the correct syntax for Array Declaration.

a) var city = new Array(“delhi”, “agra”, “akot”, “aligarh”);

b) var city = [“delhi”, “agra”, “akot”, “aligarh”];

c) Both a and b

d) None of them

Javascript Objective Interview Questions on Arrays

Start
Congratulations - you have completed Javascript Objective Interview Questions on Arrays. You scored %%SCORE%% out of %%TOTAL%%. Your performance has been rated as %%RATING%%
Your answers are highlighted below.
Return
Shaded items are complete.
12345
6End
Return

Question 2 What’s the output of the following code.

a) [ “palampur” , “delhi”, “agra”, “akot”, “aligarh”]

b) [“delhi”, “agra”, “akot”, “aligarh”, “palampur”]

c) [“delhi”, “agra”, “akot”, “palampur”, “aligarh”]

d) None of them

Question 3 Output of the following code is.

a) [“delhi”,”agra”,”akot”]

b) [“akot”, “aligarh”, “palampur”]

c) [“delhi”,”agra”,”akot” , “aligarh”,”palampur”]

d) None

Question 4

a) agra

b) akot

c) delhi

d) aligarh

Question 5

a) delhi

b) palampur

c) agra

d) akot

Question 6

a) [“agra”, “akot”, “aligarh”, “delhi”]

b) [“delhi”, “agra”, “akot”, “aligarh”]

c) [“aligarh”, “agra”, “akot”, “delhi”]

d) [“akot”, “agra”, “delhi”, “aligarh”]

Explanation and Answers

Question 1

Answer C) Both a and b.

You can declare an array in javascript by using any of the below method. For explanation you check post on Javascript Array Methods.

Question 2

Answer b.

push() method in javascript add a new item at the end of an array.

Question 3

Answer b) [“akot”, “aligarh”, “palampur”]

Question 4

Answer C)

shift method removes first item of an array.

Question 5

Answer b)

pop() method removes the last element of an array.

Question 6

Answer a)

PHP MCQ for Practice .

Tagged , , . Bookmark the permalink.

About WebRewrite

I am technology lover who loves to keep updated with latest technology. My interest field is Web Development.