Wednesday 3 June 2020

UGC NET Computer Science December 2019 | Question 67

Question 67
A rectangle is bound by the lines x=0; y=0; x=5 and y=3. The line segment joining (-1, 0) and (4, 5). if clipped against this window will connect the points ______
  1. 1. (0, 1) and (3, 3)
  2. 2. (0, 1) and (2, 3)
  3. 3. (0, 1) and (4, 5)
  4. 4. (0.1) and (3, 5)
Explanation
This is simple 2-D geometry question based on equation of line (although clipping window is given and it seems to be based on Cohen Sutherland line clipping algorithm)

We have to find the two points which are the endpoint of the line segment clipped by given rectangle window. Refer the final diagram for more understanding,

Given line segment joining (−1,0) and (4,5) and lets say new endpoints of line segment after clipping are (x,y) and (x1,y1). As all these 4 points are on the same line. So, slope of the line joining any two points is same.

So, by using equation of slope of a the line,
Slope of line = (y2 – y1) / (x2 - x1)

Lets consider point (x,y).

slope of line joining (x,y) & (-1,0) = slope of line joining (4,5) & (-1,0)
∴ (y − 0) / (x − (−1)) = (5 − 0) / (4 − (−1))
∴ y = x + 1

Now only choice A (0,1) and (2,3) satisfy above equation.

So, It conclude that, points (0, 1) and (2, 3) connect line which clipped against given rectangle window.

Hence Option 2 is the right answer.


PreviousNext
UGC NET CS December 2019 - Question 66UGC NET CS December 2019 - Question 68

1 comment:

  1. Thank you for sharing this.
    UGC NET Coaching in Chandigarh from Gurukul Career Group, is considered to be the Best UGC NET Coaching in Chandigarh because of its erudite faculty who have got years of experience.

    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