Q. Choose the correct JavaScript syntax to change the content of the following HTML code.

  • (A) document.getElementById ("letsfindcourse").innerHTML = I am a letsfindcourse;
  • (B) document.getId ("letsfindcourse") = "I am a letsfindcourse";
  • (C) document.getElementById ("letsfindcourse").innerHTML = "I am a letsfindcourse";
  • (D) document.getElement ("letsfindcourse").innerHTML = "I am a letsfindcourse";
πŸ’¬ Discuss
βœ… Correct Answer: (C) document.getElementById ("letsfindcourse").innerHTML = "I am a letsfindcourse";

Q. Which of the following is correct about features of JavaScript?

  • (A) It can not Handling dates and time
  • (B) JavaScript is a object-based scripting language.
  • (C) JavaScript is not interpreter based scripting language.
  • (D) All of the above
πŸ’¬ Discuss
βœ… Correct Answer: (B) JavaScript is a object-based scripting language.

Q. Inside which HTML element do we put the JavaScript?

  • (A) <style>
  • (B) <meta>
  • (C) <head>
  • (D) <script>
πŸ’¬ Discuss
βœ… Correct Answer: (D) <script>

Q. what will be the output of below JavaScript code?

Code:
var val = "JavaScript String"
splittedVal = val.split('a',2)
console.log(splittedVal);
  • (A) [ 'J', 'v' ]
  • (B) [ 'J' ,'v','Script']
  • (C) [ 'J', 'v', 'Script String' ]
  • (D) [ 'JavaScript String' ]
πŸ’¬ Discuss
βœ… Correct Answer: (A) [ 'J', 'v' ]

Q. What will be printed in the console on execution of the below JavaScript code?

Code:
var materials = [
'Table',
'Chair',
'Boxes',
'Press'
];

console.log(materials.map (material => material.length));
  • (A) [5,5,5,5]
  • (B) [5]{4}
  • (C) [5]
  • (D) Both A and B
πŸ’¬ Discuss
βœ… Correct Answer: (A) [5,5,5,5]

Q. What will be printed in the console on execution of the following JS code:

Code:
var array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
var myArr= array.filter(v => v % 3 === 0);

console.log(myArr);
  • (A) myArr
  • (B) [3, 6, 9, 12, 15]
  • (C) [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
  • (D) [1, 2, 4, 5, 7, 8, 10, 11, 13, 14]
πŸ’¬ Discuss
βœ… Correct Answer: (B) [3, 6, 9, 12, 15]

Q. What will be printed in the console on execution of the following JS code:

Code:
var array = [2, 4, 6, 7, 8, 10];
var myArr= array.filter(v => v / 2 === 0);

console.log(myArr);
  • (A) [7]
  • (B) [2, 4, 6, 8, 10]
  • (C) [2, 4, 6, 7, 8, 10]
  • (D) myArr
πŸ’¬ Discuss
βœ… Correct Answer: (B) [2, 4, 6, 8, 10]

Q. What keyword is used to check whether a given property is valid or not?

  • (A) in
  • (B) is in
  • (C) exists
  • (D) lies
πŸ’¬ Discuss
βœ… Correct Answer: (A) in

Q. How can a datatype be declared to be a constant type?

  • (A) const
  • (B) var
  • (C) let
  • (D) constant
πŸ’¬ Discuss
βœ… Correct Answer: (A) const

Q. What will be the output of the following code snippet?

Code:
<script type="text/javascript">
a = 5 + "9";
document.write(a);
</script>
  • (A) Compilation Error
  • (B) 14
  • (C) Runtime Error
  • (D) 59
πŸ’¬ Discuss
βœ… Correct Answer: (D) 59