1. Question: What will be the output for the following JavaScript code:
    var total=function(item,tax){return item+=tax}
    document.write("Your bill is $"+total(14.95,06))

    A
    $20.95

    B
    Syntax Error

    C
    No output

    D
    14.9506

    Note: This syntax follows function literal. It is observed that there is no function name except function keyword before parenthesis. In this syntax variable name will be the function name where function is set.
    1. Report
  2. Question: What is the following is function property in JavaScript?

    A
    parameters

    B
    arguments

    C
    function

    D
    public

    Note: Inside the function block{ } you can use arguments as a property. Example:
    function avg(a,b){
      return (a+b)/arguments.length; 
    }
    
    document.write(avg(3,5))
    In the above code arguments.length will return the number of arguments in the function
    1. Report
  3. Question: Which of the following is the built-in function of any function in JavaScript?

    A
    toString()

    B
    toPrint()

    C
    toConcat()

    D
    None

    Note: Example:
    function add(a,b){
        return a+b;
    }
    function sub(a,b){
       return a-b
    }
    
    let a=add(3,4).toString(); // calling toString() function of add() function
    let b=sub(3,2);
    
    document.write(a+b); //71
    1. Report
  4. Question: What will be the output of the following code?
    let str="Cricket is Proud";
      document.write(str.substring(4,7))

    A
    et

    B
    ket

    C
    ket is

    D
    cket

    Note: Prototype: string substring(fromIndex,toIndex) This function is used to copy part of a string.
    1. Report
  5. Question: Which of the following code will make an infinite loop?

    A
    let i=10;
      do{
         
        i++
       }(i>10);

    B
    let i=10;
      do{
         
        i++
       }(i<19);

    C
    let i=10;
      do{
         
        i++
       }(i>11);

    D
    None

    Note: Not available
    1. Report
  6. Question: What is this keyword in JavaScript?

    A
    The this keyword is just an operator.

    B
    The this keyword is a reference variable that refers to the current object

    C
    The this keyword is a reference variable that refers to the any object

    D
    None

    Note: Not available
    1. Report
  7. Question: What is the correct syntax of creating JavaScript cookie?

    A
    cookie="name=value;[expires];[path];[domain];[secure]"

    B
    document.cookie="name=value;[expires];[path];[domain];[secure]"

    C
    window.cookie="name=value;[expires];[path];[domain];[secure]"

    D
    document.cookie="name=value;[path];[expires];[domain];[secure]"

    Note: Not available
    1. Report
  8. Question: You cannot place spaces, commas, or semicolons in cookie values.

    A
    True

    B
    False

    Note: Not available
    1. Report
  9. Question: Which of the following is not optional cookie attribute in JavaScript?

    A
    name

    B
    expires

    C
    path

    D
    domain

    E
    secure

    Note: Not available
    1. Report
  10. Question: What is the output of the following code?
    <script>
     var a=4;
     document.write(a++);
     document.write(++a);
     document.write(a--);
     document.write(--a);
    </script>

    A
    4654

    B
    4664

    C
    5664

    D
    4654

    Note: Not available
    1. Report
Copyright © 2024. Powered by Intellect Software Ltd