• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

JavaScript Course | Practice Quiz-3

Question 1

What will be the output of the following code? 

JavaScript
<script>
let result = 0;
for (let i = 0; i < 5; i++) {
  result += i;
}
document.write(result);
</script>
  • 5

  • 0

  • 10

  • None of the above

Question 2

True or false: All keys in an object are strings.
  • True
  • False
  • Depends on the Object type
  • None of the above

Question 3

Given a collection of artists and lists of their songs, would you store the artist-song-list pairs in an Object or an Array?
  • Object
  • Array
  • Function
  • None of the above

Question 4

What will be the output of the following code? JavaScript
 <script>
 if (5) { 
  document.write(\"I like peanuts\"); 
  }
  </script>
  • I like peanuts
  • undefined
  • nothing will be printed
  • None of the above

Question 5

What will be the output of the following code? JavaScript
<script>
let bar  = 1;
foo = {};
foo: {
     bar : 2;
     baz : ++bar;
};
document.write(foo.baz + foo.bar + bar);
</script>
  • NaN
  • 5
  • 4
  • 1

Question 6

What will be the output of the following code? 

< script>

document.write( 10 > 9 > 8 === true );

</ script> 

  • true

  • false

  • 1

  • 0

Question 7

What will be the output of the following code? JavaScript
<script>
  document.write(String(\'Hello\') == \'Hello\');
</script>
  • true
  • false
  • 1
  • 0

Question 8

What will be the output of the following code? JavaScript
<script>
document.write(( true + false ) > 2 + true );
</script>
  • true
  • false
  • 1
  • 0

Question 9

What will be the output of the following code? JavaScript
<script>
document.write(Number(\'1\') - 1 == 0);
</script>
  • true
  • false
  • 1
  • None of the above

Question 10

What will be the output of the following code? JavaScript
<script>
 document.write(NaN == NaN);
</script>
  • true
  • false
  • 1
  • 0

There are 10 questions to complete.

Last Updated :
Take a part in the ongoing discussion