JavaScript Test: Ultimate Trivia Quiz!

34 Questions | Attempts: 641
Share

SettingsSettingsSettings
JavaScript Test: Ultimate Trivia Quiz! - Quiz

.


Questions and Answers
  • 1. 
    Given x = new Date(), how do you represent x as a String in universal time (time zone +0000)?
    • A. 

      X.getUTC();

    • B. 

      X.getUTCDate();

    • C. 

      X.toUTCString();

  • 2. 
    Where the < script > tag can be used
    • A. 

      In the < head > tag

    • B. 

      In the < body > tag

    • C. 

      Both < head > and < body > tags

  • 3. 
    What does JSON stand for?
    • A. 

      JavaScript Oriented Notation

    • B. 

      JavaScript Object Notation

    • C. 

      JavaScript Online Notation

  • 4. 
    Given the following, what is the value of x? var x = typeof "abc";
    • A. 

      Abc

    • B. 

      String

    • C. 

      Undefined

    • D. 

      Error

  • 5. 
    Variable x has a value of 5. Variable y has a value of 7 x < 7 && y > 6
    • A. 

      True

    • B. 

      False

  • 6. 
    Is javascript case sensitive ?
    • A. 

      True

    • B. 

      False

  • 7. 
    To convert string to number, which function do we use ?
    • A. 

      ParseNumber

    • B. 

      ParseString

    • C. 

      ParseInt

    • D. 

      ParseDouble

  • 8. 
    In javascript, is it required having semi-colon " ; " at the end of the statement ?
    • A. 

      True

    • B. 

      False

  • 9. 
    How do you check what the type of a value in variable x is?
    • A. 

      Gettype(x)

    • B. 

      Typeof(x)

    • C. 

      Object.type(x)

    • D. 

      X.type

  • 10. 
    What is the value of the following express: 8 % 3
    • A. 

      5

    • B. 

      2

    • C. 

      24

    • D. 

      NaN

  • 11. 
    You need to update the content of a <div> using the following code, complete the missing part <div id="myDiv"></div> <script> document.getElementById('myDiv').MISSING_PART = "new content" </script>
    • A. 

      Innerhtml

    • B. 

      InnerHtml

    • C. 

      InnterHtml

    • D. 

      InnerHTML

  • 12. 
    What's the output of the following code var name = 'John', age = 20 console.log(`Hi, my name is ${name.toUpperCase()} and I'm ${++age} years old`)
    • A. 

      Hi, my name is John and I'm 20 years old

    • B. 

      Hi, my name is John and I'm 21 years old

    • C. 

      Hi, my name is JOHN and I'm 20 years old

    • D. 

      Hi, my name is JOHN and I'm 21 years old

  • 13. 
    How to access the current element using DOM <input type="radio" name="gender" value="Male">
    • A. 

      Document.getElementById

    • B. 

      Document.getElementByName

    • C. 

      Document.getElementsByName

    • D. 

      Document.getElement

  • 14. 
    Which of these is not a logical operator?
    • A. 

      !

    • B. 

      &

    • C. 

      &&

    • D. 

      ||

  • 15. 
    What is the value of the variable a? var a = "cat".length * 2;
    • A. 

      3

    • B. 

      6

    • C. 

      0

    • D. 

      1

  • 16. 
    What is the value of x ? var a = false; var x = a ? “A” : “B”;
    • A. 

      Undefined

    • B. 

      True

    • C. 

      "A"

    • D. 

      "B"

  • 17. 
    How would one declare a string variable?
    • A. 

      Var name = "John"

    • B. 

      Var names = "7"

    • C. 

      Var firstname = new String("John")

    • D. 

      Any of these

  • 18. 
    Dvising a number by zero in JavaScript returns
    • A. 

      Error with exception

    • B. 

      NaN

    • C. 

      Infinity

  • 19. 
    How do you round the number 11.25, to the nearest whole number?
    • A. 

      Math.round

    • B. 

      Math.rnd

    • C. 

      Round

    • D. 

      Rnd

  • 20. 
    What is the value of "b" var a = "A"; var b = a.concat("B");
    • A. 

      ["A", "B"]

    • B. 

      "AB"

    • C. 

      "A"

    • D. 

      "B"

  • 21. 
    Which event fires whenever a control loses focus?
    • A. 

      On click

    • B. 

      On move

    • C. 

      On keydown

    • D. 

      On blur

  • 22. 
    Which of the following is the equivalent of the following snippet if (a) { x = b; } else { x = c; }
    • A. 

      X = a : b ? c

    • B. 

      X = a ? b : c

    • C. 

      X = a ? b , c

    • D. 

      X = a ? b || c

  • 23. 
    Which of the following events is used to handle the user click action
    • A. 

      Click

    • B. 

      Clicked

    • C. 

      Onclick

  • 24. 
    Which message does the following log to the console? bar(); function bar() { console.log('bar'); }
    • A. 

      Undefined

    • B. 

      TypeError

    • C. 

      SyntaxError

    • D. 

      "bar"

  • 25. 
    What is the value of x? var x = '1'+2+3;
    • A. 

      6

    • B. 

      15

    • C. 

      "123"

    • D. 

      The statement generates an error

Back to Top Back to top
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.