Q. Which method is used to get the year of a date as a four-digit number?

  • (A) getYear()
  • (B) fullYear()
  • (C) getFullYear()
  • (D) getfullyear()
πŸ’¬ Discuss
βœ… Correct Answer: (C) getFullYear()

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

Code:
<script>
	document.write(Math.round(107.5))
</script>
  • (A) 107.5
  • (B) 107
  • (C) 108
  • (D) 107.00
πŸ’¬ Discuss
βœ… Correct Answer: (C) 108

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

Code:
<script>
try{
	const cars = {  
		company: 'Honda'
	};  

	delete cars.company;
	document.write(cars.company);  
}
catch (err){
	document.write(err.message);
}
</script>
  • (A) undefined
  • (B) Honda
  • (C) ValueError
  • (D) TypeError
πŸ’¬ Discuss
βœ… Correct Answer: (A) undefined

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

Code:
<script>
try{
    const cars = {  
        company: 'Honda'
    };  
    
    Object.seal(cars);
    delete cars.company;
    document.write(cars.company);  
}
catch (err){
    document.write(err.message);
}
</script>
  • (A) undefined
  • (B) Honda
  • (C) ValueError
  • (D) TypeError
πŸ’¬ Discuss
βœ… Correct Answer: (B) Honda

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

Code:
<script>
    let x = "10";
    let y = + x;
    
    document.write(typeof y);
</script>
  • (A) string
  • (B) object
  • (C) undefined
  • (D) number
πŸ’¬ Discuss
βœ… Correct Answer: (D) number

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

Code:
<script>
    let x = 10;
    
    document.write(typeof x, " , ", typeof String(x));
</script>
  • (A) number , string
  • (B) number , number
  • (C) object , string
  • (D) object , object
πŸ’¬ Discuss
βœ… Correct Answer: (A) number , string

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

Code:
<script>
    let x = 10;
    
    document.write(x, " , ", toString(x));
</script>
  • (A) 10 , 10
  • (B) 10 , undefined
  • (C) 10 , [object Undefined]
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (C) 10 , [object Undefined]

Q. What is the advantage of the code produced graphics being smaller than the images themselves?

  • (A) Bandwidth saving
  • (B) Increase in bandwidth
  • (C) Dynamic advantages
  • (D) None of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (A) Bandwidth saving

Q. Which of the following uses a lot of CPU cycles?

  • (A) GUI
  • (B) Statically generated graphics
  • (C) Dynamically generated graphics
  • (D) All of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (C) Dynamically generated graphics

Q. Consider the code snippet given below
What is the observation made?

Code:
var count = [1,,3];
  • (A) The omitted value takes “undefined”
  • (B) This results in an exception
  • (C) This results in an error
  • (D) None of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (A) The omitted value takes “undefined”