InterviewSolution
Saved Bookmarks
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
What will be the output of the following code?<script>let result = 0;for (let i = 0; i < 5; i++) {result += i;}document.write(result);</script>(A) 5(B) 0(C) 10(D) None of the above |
| Answer» | |
| 2. |
What will be the output of the following code?<script>if (5) {document.write("I like peanuts");}</script>(A) I like peanuts(B) undefined(C) nothing will be printed(D) None of the above |
| Answer» | |
| 3. |
What will be the output of the following code?<script>let bar = 1;foo = {};foo: {bar : 2;baz : ++bar;};document.write(foo.baz + foo.bar + bar);</script>(A) NaN(B) 5(C) 4(D) 1 |
| Answer» | |
| 4. |
True or false: All keys in an object are strings.(A) True(B) False(C) Depends on the Object type(D) None of the above |
| Answer» | |
| 5. |
Given a collection of artists and lists of their songs, would you store the artist-song-list pairs in an Object or an Array?(A) Object(B) Array(C) Function(D) None of the above |
| Answer» | |
| 6. |
What will be the output of the following code?<script>document.write( 10 > 9 > 8 === true );</script>(A) true(B) false(C) 1(D) 0 |
| Answer» | |
| 7. |
What will be the output of the following code?<script>document.write(String('Hello') == 'Hello');</script>(A) true(B) false(C) 1(D) 0 |
| Answer» | |
| 8. |
What will be the output of the following code?<script>document.write(( true + false ) > 2 + true );</script>(A) true(B) false(C) 1(D) 0 |
| Answer» | |
| 9. |
What will be the output of the following code?<script>document.write(NaN == NaN);</script>(A) true(B) false(C) 1(D) 0 |
| Answer» | |
| 10. |
What will be the output of the following code?<script>document.write(Number('1') - 1 == 0);</script>(A) true(B) false(C) 1(D) None of the above |
| Answer» | |