JavaScript Set-1

Instruction:-

  • Number of Questions : 25
  • Total Marks : 25
  • Each question carry 1 Marks.
  • No negative marking

  •  

    Results

    #1. What is the correct syntax to output “Hello World” in JavaScript?

    #2. Which of the following is the correct way to declare a JavaScript variable?

    #3. How do you create a function in JavaScript?

    #4. Which symbol is used for single-line comments in JavaScript?

    #5. What will the following code output?
    javascript
    CopyEdit
    var x = 5;
    var y = “5”;
    console.log(x == y);

    #6. What will this code return?
    javascript
    CopyEdit
    typeof “Hello”

    #7. How do you write an IF statement in JavaScript?

    #8. Which keyword is used to define a constant in JavaScript?

    #9. What is the output of this code?
    javascript
    CopyEdit
    console.log(2 + “2”);

    #10. Which event occurs when the user clicks on an HTML element?

    #11. How do you call a function named myFunction?

    #12. What does the following code output? javascript
    CopyEdit
    console.log(typeof 10);

    #13. Which of the following is not a JavaScript data type?

    #14. Which operator is used to assign a value to a variable?

    #15. Which of the following is used to check both value and type in JavaScript?

    #16. How do you write a loop that runs exactly 5 times?
    javascript
    CopyEdit
    for (let i = 0; i < ___; i++)
    {
    console.log(i);
    }

    #17. What is the result of this code?
    javascript
    CopyEdit
    var a = 10;
    var b = 3;
    console.log(a % b);

    #18. What will be the output of this code?
    javascript
    CopyEdit
    let x = true;
    let y = false;
    console.log(x && y);

    #19. Which method can convert a string to an integer in JavaScript?

    #20. What is the output?
    javascript
    CopyEdit
    let a = “Hello”;
    a += ” World”;
    console.log(a);

    #21. What will the following code output?
    javascript
    CopyEdit
    let x = “10”;
    let y = 5;
    console.log(x – y);

    #22. What does the following code display?
    javascript
    CopyEdit
    let x;
    console.log(x);

    #23. What will this code return?
    javascript
    CopyEdit
    Boolean(0)

    #24. What is the output?
    javascript
    CopyEdit
    let name = “Ali”;
    console.log(name.length);

    #25. Which of these is the correct way to check if a number is even?

    Previous
    Finish

    Leave a Comment

    Your email address will not be published. Required fields are marked *