1. Question: What will be the output of the following code?
    var total=new Function("item","tax","return item+=tax");
    document.write("Your bill is $"+total(14.43,06))

    A
    Syntax Error

    B
    $20.43

    C
    No output

    D
    14.4306

    Note: This is function follows function constructor syntax: var variable=new Function("arg1","arg2","retrun expression")
    1. Report
  2. 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
  3. 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
  4. 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
  5. 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
  6. Question: What will be the output for the following code?
    let n=Math.round(-20.51)
      document.write(n);

    A
    20

    B
    -20

    C
    -21

    D
    21.5

    Note: Not available
    1. Report
  7. Question: Which of the following is best describe the action of setInterval() function?

    A
    It execute the script action only once

    B
    It does not repeat the script action

    C
    It repeats a script action after a certain time

    D
    It is not a function anyway

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