Tag: technology

Questions Related to technology


function Book(id, name) {
    this.id = id;
    this.name = name;
}
var book = new Book("1001", "Head First JavaScript");
alert(book.id);
  1. 1001

  2. error

  3. Head First JavaScript

  4. id


Correct Option: A

What is the output of the below JavaScript?


var book = "Head First JavaScript";         
alert(book.length);     
  1. 21

  2. 20

  3. 22

  4. error


Correct Option: A

What is the output of the below JavaScript?


var patt1 = new RegExp("e");        
alert(patt1.test("This is an example"));    

  1. false

  2. true

  3. e

  4. 11


Correct Option: B

var patt1 = new RegExp(/e/g);
 alert(patt1.exec("This is an Example"));   

  1. e

  2. E

  3. error

  4. 16


Correct Option: A

var str = "This is an Example";
  alert(str.match("example"));      

  1. null

  2. Example

  3. example

  4. error


Correct Option: A

var str = "This is an Example"; 
 alert(str.search("example"));      

  1. 11

  2. -1

  3. error

  4. Example


Correct Option: B