Javascript ES5 Assessment

A colorful illustration of a computer screen displaying JavaScript code with a playful design, highlighting loops, fun<wbr>ctions, and operators.

JavaScript ES5 Mastery Quiz

Test your knowledge of JavaScript ES5 with this comprehensive quiz! Designed for developers of all levels, this assessment will challenge your understanding of JavaScript operators, loops, and functions.

Participate to:

  • Enhance your coding skills
  • Identify areas for improvement
  • Challenge yourself with tricky questions
16 Questions4 MinutesCreated by CodingWizard101
Which JavaScript operator does not represent a loop?
For
While
If
Foreach
What will be the text of alert message?
 
var i=0;
if(i > 0) {
   alert("A");
}
else {
   alert("B");
}
if(false) {
   alert("C");
}
A
B
C
 
What will be the value of num?
 
var num = 3;
num++;
num = num-1;
num += 1;
3
4
6
5
How many times are we going to see an alert message?
 
for(var i=0;i<5;i++){
   alert("ping");
}
4
5
6
Infinite
How many times are we going to see an alert message?
 
for(var i=0;i<=3+4;i++){
   alert("ping");
}
7
8
9
3
4
How many times are we going to see an alert message?
 
var i=0;
while(i < 3) {
   alert("ping");
   i++;
}
2
3
4
Infinite
Which way of defining a function is incorrect?
Function functionName(a){...}
Var functionName=function(a){...}
FunctionName function(a){...}
FunctionName = function(a){...}
How many times are we going to see an alert message?
 
var i=5;
while(true) {
   i--;
  if(i == 1)
 {
    break;
 }
   alert("ping");
}
4
5
3
Infinite
What will be the value of str?
 
var str = 1;
str+= "2";
12
3
21
-1
What will be the value of num?
 
var num=0;
var s = "1";
if(s == 1) {
  num++;
}
 
if(s === 1) {
  num++;
}
 
if(s+1 == 11) {
  num++;
}
 
if(s+1 === 11) {
  num++;
}
1
2
3
4
What will be the text of alert message?
 
function cl()
{
  this.prop1 = 2;
  var prop2 = 3;
}
var obj1 = new cl();
var obj2 = {
   prop1: 4,
   prop2: obj1
};
 
alert(obj1.prop1+","+obj1.prop2+","+obj2.prop1+","+obj2.prop2.prop1);
2,undefined,4,2
2,3,4,2
2,3,4,undefined
2,undefined,4,undefined
3,3,4,undefined
What will be the value of arr?
 
var arr = [1,2,3,4];
for(var i=0;i<3;i++) {
  arr[i]+= arr[i+1];
}
1,2,3,4
3,5,7,9
3,5,7,4
2,4,6,8
2,4,6,8
Choose all valid examples(multiple choice) of getting an HTML element by id="id1" in Javascript
Document.getElementById("id1")
Document.querySelector("id1")
Document.querySelectorAll("#id1")[0]
Document.getElementById("#id1")
Document.querySelector(".id1")
Which JS code will select the following elements:
 
<div id="parent">
  <span class="class1">
  </span>
  <div class="class1">
    <div class="child"> <!-- This One -->
      <div class="child"></div>
    </div>
    <div class="child"> <!-- This One -->
    </div>
  </div>
</div>
<div>
  <div class="class1">
    <div class="child">
    </div>
  </div>
</div>
 
Document.querySelectorAll("#parent div.class1>.child")
Document.querySelectorAll("#parent>.class1>.child")
Document.querySelectorAll("#parent>div.class1 .child")
Document.querySelectorAll("div.class1 .child")
Document.querySelectorAll("#parent div.class1 #child")
What will be the text of alert message?
 
var num=1;
function increase(num)
{
  this.num+=num;
  num++;
}
var obj = {
  num:10,
  num1:this.num+num,
  increase:increase
};

obj.increase(obj.num);

alert(num+","+obj.num+","+obj.num1);
1,20,1
1,20,2
2, 20,1
2,20,2
1,11,2
2,11,1
{"name":"Javascript ES5 Assessment", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"Test your knowledge of JavaScript ES5 with this comprehensive quiz! Designed for developers of all levels, this assessment will challenge your understanding of JavaScript operators, loops, and functions.Participate to:Enhance your coding skillsIdentify areas for improvementChallenge yourself with tricky questions","img":"https:/images/course1.png"}
Powered by: Quiz Maker