JavaScript Course | Practice Quiz-2

Last Updated :
Discuss
Comments

Question 1

Which of the following javascript functions allows you to get user input data?
  • alert
  • prompt
  • confirm
  • None of the above

Question 2

Which logical operator only accepts a single operand?
  • &&(AND)
  • ||(OR)
  • !(NOT)
  • None of the above

Question 3

What will be the result of the following code? Javascript
<script>   document.write( true && 1 && 3); </script> 
  • 0
  • 1
  • true
  • 3

Question 4

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

Question 5

What will be the output of the following code? Javascript
<script>  let ans = 0 / 0;  document.write(ans); </script> 
  • 0
  • infinity
  • NaN
  • None of the above

Question 6

What will be the output of the following code? Javascript
<script>  let i = 30;   if( i == 10 || i > 20){     console.log('Hola');   }else if( i == 5){     console.log('Breaking up the code');   }else{     console.log('Adios');  } </script> 
  • Hola
  • Breaking up the code
  • Adios
  • None of the above

Question 7

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

Question 8

What will be the output of the following code? Javascript
 <script>   let age = 20;   let result = age>18 ? 'Great' : 'Not so great';   document.write(result);  </script> 
  • Great
  • Not so great
  • true
  • None of the above

Question 9

What will be the output of the following code? Javascript
<script>   let y = 1;   y = typeof x;    document.write(typeof y); </script> 
  • string
  • null
  • number
  • boolean

Question 10

What will be the output of the following code? Javascript
 <script>     var x = [typeof x, typeof y][1];     document.write(typeof typeof x);  </script> 
  • undefined
  • string
  • number
  • boolean

There are 10 questions to complete.

Take a part in the ongoing discussion