110). The function definitions in JavaScript begins with _____________

[A] Identifier and Parentheses
[B]Return type and Identifier
[C]Return type, Function keyword, Identifier and Parentheses
[D]Identifier and Return type

Show Answer

111). What will be the output of the following JavaScript code?
function printprops(o) 
{
    for(var p in o)
      console.log(p + ": " + o[p] + "\n");
}

[A] Prints the contents of each property of o
[B] Returns undefined
[C]Prints only one property
[D]Prints the address of elements

Show Answer

112). When does the function name become optional in JavaScript?
function printprops(o) 
{
    for(var p in o)
      console.log(p + ": " + o[p] + "\n");
}

[A]When the function is defined as a looping statement
[B] When the function is defined as expressions
[C]When the function is predefined
[D] when the function is called

Show Answer

113). What is the purpose of a return statement in a function?
function printprops(o) 
{
    for(var p in o)
      console.log(p + ": " + o[p] + "\n");
}

[A]Returns the value and continues executing rest of the statements, if any
[B]Returns the value and stops the program
[C]Returns the value and stops executing the function
[D]Stops executing the function and returns the value

Show Answer

114). What will happen if a return statement does not have an associated expression?
function printprops(o) 
{
    for(var p in o)
      console.log(p + ": " + o[p] + "\n");
}

[A]It returns the value 0
[B]It will throw an exception
[C] It returns the undefined value
[D] It will throw an error

Show Answer

115). A function with no return value is called ___________
function printprops(o) 
{
    for(var p in o)
      console.log(p + ": " + o[p] + "\n");
}

[A]Procedures
[B]Method
[C]Static function
[D]Dynamic function

Show Answer

116). The function stops its execution when it encounters?
function printprops(o) 
{
    for(var p in o)
      console.log(p + ": " + o[p] + "\n");
}

[A]continue statement
[B]break statement
[C]goto statement
[D]return statement

Show Answer

117). Which keyword is used to define the function in javascript?
function printprops(o) 
{
    for(var p in o)
      console.log(p + ": " + o[p] + "\n");
}

[A]void
[B]int
[C]function
[D]main

Show Answer

118). Which is an equivalent code to invoke a function m of class o that expects two arguments x and y?
function printprops(o) 
{
    for(var p in o)
      console.log(p + ": " + o[p] + "\n");
}

[A]o(x,y);
[B]o.m(x) && o.m(y);
[C] m(x,y);
[D]o.m(x,y);

Show Answer

119). What will be the equivalent code of the following JavaScript code?
o.m(x,y);

[A]o.m(x) && o.m(y);
[B] o[“m”](x,y);
[C] o(m)[“x”,”y”];
[D]o.m(x && y);

Show Answer

120). What will be the output of the following JavaScript code?
function info()
{  
    int a=1;
    int b=2;
    return a*b;  
}  
document.write(info());

[A]1
[B]2
[C]3
[D]error

Show Answer

121). What will be the output of the following JavaScript code?
var arr = [7, 5, 9, 1];  
var value = Math.max.apply(null, arr);  
document.writeln(value);

[A]7
[B]5
[C]1
[D]9

Show Answer

122). What will be the output of the following JavaScript code?
var person = 
{  
      name: “Rahul”,  
      getName: function() 
      {  
          nreturn this.name;  
      }  
} 
var unboundName = person.getName;  
var boundName = unboundName.bind(person);  
document.writeln(boundName());

[A]runtime error;
[B]compilation error
[C]Rahul
[D]undefined

Show Answer

123). What will be the output of the following JavaScript code?
function code(id,name) 
{  
  		this.id = id;   
  		this.name = name;  
}  
function pcode(id,name) 
{  
 		code.call(this,id,name);  
}
document.writeln(new pcode(101,"vivek").id);

[A]vivek
[B]101
[C]Runtime error
[D]Compilation error

Show Answer

124). What will be the output of the following JavaScript code?
 var pow=new Function("num1","num2","return Math.pow(num1,num2)");  
     document.writeln(pow(2,3));

[A]2
[B]3
[C]8
[D]eror

Show Answer