JavaScript Interview MCQ Questions With Answers

20 Questions | Attempts: 527
Share

SettingsSettingsSettings
JavaScript Interview MCQ Questions With Answers - Quiz

Are you preparing for an interview in JavaScript? If yes, attempt this JavaScript MCQ quiz questions with answers created for freshers and experienced. JavaScript, abbreviated as JS, is one of the world's most popular programming languages that is used both on the client-side and server-side to make web pages interactive and dynamic. If you think you know this language very well, why don't you give this quiz a try? Play the quiz below and evaluate your knowledge. Good luck!


Questions and Answers
  • 1. 
    Which statement cannot be used to declare a variable in JavaScript?
    • A. 

      Let

    • B. 

      Var

    • C. 

      Int

    • D. 

      Const

  • 2. 
    What are block scoped variables in JavaScript?
    • A. 

      The variables cannot be accessed outside the function in which they are declared.

    • B. 

      The variables can be used globally.

    • C. 

      The variables can be used globally.

    • D. 

      The variable is only accessible inside the block(if-else/for block) inside which it is declared

    • E. 

      Both a and c

  • 3. 
    Which of the following is block scoped?
    • A. 

      Var

    • B. 

      Let

    • C. 

      Const

    • D. 

      Both b and c

  • 4. 
    What are Functions in JavaScript?
    • A. 

      Functions are basically a statement which returns a constant value.

    • B. 

      Functions are basically a set of statements that perform some task

    • C. 

      Functions are one of the data types in JavaScript.

    • D. 

      All of these

  • 5. 
    Which of the following is an array method?
    • A. 

      Map

    • B. 

      Filter

    • C. 

      Reduce

    • D. 

      All of these

  • 6. 
    Which of the following is considered a first class citizen in JavaScript?
    • A. 

      Functions

    • B. 

      Class

    • C. 

      Array

    • D. 

      Object

  • 7. 
    What is destructuring in JavaScript?
    • A. 

      Through destructuring, we can unpack values from arrays or object properties into separate variables.

    • B. 

      Destructuring allows us to restructure object properties

    • C. 

      Destructuring allows us to restructure array elements.

    • D. 

      All of these.

  • 8. 
    What will be the output of the below code snippet? let{name,age}={name:"abc",age:1,id:1} console.log(name,age)
    • A. 

      Abc 1

    • B. 

      Throws error

    • C. 

      Null null

    • D. 

      Undefined undefined

  • 9. 
    What do you mean by Function Composition?
    • A. 

      It is the process of combining two or more functions to create a new function.

    • B. 

      The function declaration is termed as function composition in JavaScript

    • C. 

      Both a and b

    • D. 

      None of these

  • 10. 
    Which of the following is the right way to add a single line comment in JavaScript?
    • A. 

      #This is a comment.

    • B. 

      ##This is a comment .

    • C. 

      /This is a comment.

    • D. 

      //This is a comment

  • 11. 
    Which is the correct way to bind an object to the current method?
    • A. 

      Func = func.bind(this)

    • B. 

      Let func = () => {}

    • C. 

      Both a and b

    • D. 

      None of these

  • 12. 
    Which of the following is a valid function declaration syntax?
    • A. 

      Function abc() {}

    • B. 

      Var abc = () => {} 

    • C. 

      Both a and b

    • D. 

      None of these

  • 13. 
    What will ‘0 == false ’ evaluate to?
    • A. 

      Null

    • B. 

      Undefined

    • C. 

      Throws error

    • D. 

      True

  • 14. 
    Which array method is used to iterate on all the array elements and perform some task/transformation on them and return the new array?
    • A. 

      Map

    • B. 

      Filter

    • C. 

      Reduce

    • D. 

      ForEach

  • 15. 
    What will be the output of the below code snippet? let numbers=[1,2,3,4,5,6,7,8]; console.log(numbers.filter(x=>x%2==0);
    • A. 

      True

    • B. 

      False

    • C. 

      1,3,5,7

    • D. 

      2,4,6,8

  • 16. 
    What is the right syntax to accept an indefinite number of parameters?
    • A. 

      Function sum(...theArgs) {}

    • B. 

      Function sum(theArgs...) {}

    • C. 

      Function sum(theArgs) {} 

    • D. 

      Function sum([theArgs]) {}

  • 17. 
    Which method is used to listen to events from DOM elements?
    • A. 

      Element.addListener(event => {})

    • B. 

      AddListener(element, event => {}) 

    • C. 

      AddEventListener(element, event => {})

    • D. 

      Element.addEventListener(event => {})

  • 18. 
    What is the full form of DOM?
    • A. 

      Data Object Model

    • B. 

      Document or Model

    • C. 

      Document Object Model

    • D. 

      Document Object Meduim

  • 19. 
    Which method is used to convert the JSON string to a JSON object?
    • A. 

      JSON.parse(string)

    • B. 

      JSON.convertToObject(string)

    • C. 

      JSON.object(string)

    • D. 

      None of these

  • 20. 
    Which of the following are the Object methods?
    • A. 

      Object.keys(obj)

    • B. 

      Object.values(obj)

    • C. 

      Object.entries(obj)

    • D. 

      All of these

Back to Top Back to top
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.