Friday, 22 March 2019

UGC NET Computer Science July 2018 - II | Question 2

Question 2

Consider the JavaScript Code :
  var y = "12" ;
  function f( ) {
      var y = "6" ;
      alert (this.y) ;
      function g( ) { alert (y) ; }
      g( );
  }
  f( );
If M is the number of alert dialog boxes generated by this JavaScript code and D1, D2, ....,DM represents the content displayed in each of the M dialog boxes, then :

Options:
  1. (1) M=3;  D1 displays ”12”;  D2 displays ”6”;  D3 displays ”12”.
  2. (2) M=3;  D1 displays ”6”;  D2 displays ”12”;  D3 displays ”6”.
  3. (3) M=2;  D1 displays ”6”;  D2 displays ”12”.
  4. (4) M=2;  D1 displays ”12”;  D2 displays ”6”.
Answer : (4) M=2; D1 displays ”12”; D2 displays ”6”.

Explanation Question 2

The JavaScript this keyword is used within any function scope or the global scope, and in each scope it receives a different value. The value of this inside a function, effectively depends on the object which called it.

Solved Question-2 NTA UGC NET Computer Science July 2018 - Paper II, Java Script

PreviousNext
UGC NET CS 2018 July - II Question 1UGC NET CS 2018 July - II Question 3

2 comments:

  1. Nice blog!
    Competition Guru is best UGC NET Coaching in Chandigarh. There are 2 papers in the UGC NET exam for both JRF and AF posts.

    ReplyDelete
  2. Thank you for sharing this. It's an amazing blog. We provide the bestUGC NET Coaching in Chandigarh and get trained from expert faculty.

    ReplyDelete

UGC NET Computer Science December 2019 | Question 16

Question 16 In a certain coding language. 'AEIOU' is written as 'TNHDZ'. Using the same coding language. 'BFJPV' wil...

Popular Posts