Line Point Distance Multiple Choice Questions and Answers (MCQs)

This set of Data Structures & Algorithms Multiple Choice Questions & Answers (MCQs) focuses on “Line Point Distance”.

1. The shortest distance between a line and a point is achieved when?
a) a line is drawn at 90 degrees to the given line from the given point
b) a line is drawn at 180 degrees to the given line from the given point
c) a line is drawn at 60 degrees to the given line from the given point
d) a line is drawn at 270 degrees to the given line from the given point
View Answer

Answer: a
Explanation: The shortest distance between a line and a point is achieved when a line is drawn at 90 degrees to the given line from the given point.

2. What is the shortest distance between the line given by ax + by + c = 0 and the point (x1,y1)?
a) Shortest distance between line given by ax + by + c = 0 & the point (x1,y1) - option a
b) Shortest distance between line given by ax + by + c = 0 & the point (x1,y1) - option b
c) Shortest distance between line given by ax + by + c = 0 & the point (x1,y1) - option c
d) ax1+by1+c
View Answer

Answer: a
Explanation: The shortest distance between a line and a point is given by the formula (ax1+by1+c)/(√a2+b2). This formula can be derived using the formula of area of a triangle.

3. What is the shortest distance between the line given by -2x + 3y + 4 = 0 and the point (5,6)?
a) 4.5 units
b) 5.4 units
c) 4.3 units
d) 3.3 units
View Answer

Answer: d
Explanation: The shortest distance between a line and a point is given by the formula (ax1+by1+c)/(√a2+b2). Using this formula we get the answer 3.3 units.
advertisement
advertisement

4. What is the general formula for finding the shortest distance between two parallel lines given by ax+by+c1=0 and ax+by+c2=0?
a) Shortest distance between two parallel lines is ax+by+c1=0 & ax+by+c2=0 - option a
b) Shortest distance between two parallel lines is ax+by+c1=0 & ax+by+c2=0 - option c
c) Shortest distance between two parallel lines is ax+by+c1=0 & ax+by+c2=0 - option c
d) c1+c2
View Answer

Answer: b
Explanation: The general formula for finding the shortest distance between two parallel lines given by ax+by+c1 and ax+by+c2 is (c1-c2)/(√a2+b2). We can find this by considering the distance of any one point on one of the line to the other line.

5. What is the distance between the lines 3x-4y+7=0 and 3x-4y+5=0?
a) 1 unit
b) 0.5 unit
c) 0.8 unit
d) 0.4 unit
View Answer

Answer: d
Explanation: As the given lines are parallel so the distance between them can be calculated by using the formula (c1-c2)/(√a2+b2). So we get the distance as 0.4 unit.

6. What will be the slope of the line given by ax + by + c = 0?
a) -a/b
b) -b/a
c) -c/a
d) a/c
View Answer

Answer: a
Explanation: The slope of a line given by the equation ax + by + c=0 has the slope of -a/b. So two lines having the same ratio of the coefficient of x and y will be parallel to each other.

7. What will be the slope of the line given by 10x + 5y + 8=0?
a) -5
b) -2
c) -1.25
d) 5
View Answer

Answer: b
Explanation: The slope of a line given by the equation ax + by + c=0 has the slope of -a/b. So the slope of the given line will be -2.
advertisement

8. What will be the co-ordinates of foot of perpendicular line drawn from the point (-1,3) to the line 3x-4y-16=0?
a) (1/5,2/5)
b) (2/25,5/25)
c) (68/25,-49/25)
d) (-49/25,68/25)
View Answer

Answer: c
Explanation: The foot of perpendicular can be found by equating the distance between the two points and the distance between point and line. This is found to be (68/25,-49/25).

9. Which of the following is used to find the absolute value of the argument in C++?
a) abs()
b) fabs()
c) mod()
d) ab()
View Answer

Answer: b
Explanation: In C++ the absolute value of an argument can be found by using the function fabs(). It is available under the header file math.h.
advertisement

10. What will be the slope of the line perpendicular to the line 6x-3y-16=0?
a) 1/2
b) -1/2
c) 2
d) -2
View Answer

Answer: b
Explanation: For two lines to be perpendicular the product of their slopes should be equal to -1. So as the slope of given line is 2 so the slope of line perpendicular to it will be -1/2.

11. Find the output of the following code.

#include<math.h> 
#include<iostream>
using namespace std;
void distance(float x, float y, float a, float b, float c) 
{ 
	float d = fabs((a * x + b * y + c)) / (sqrt(a * a + b * b)); 
	cout<<d;
	return; 
} 
int main() 
{ 
	float x = -2; 
	float y = -3; 
	float a = 5; 
	float b = -2; 
	float c = - 4; 
	distance(x, y, a, b, c); 
	return 0; 
}

a) 2.8
b) 1.8
c) 1.4
d) 2.4
View Answer

Answer: c
Explanation: The given code calculates the shortest distance between line and a point. So the output will be 1.4.

Sanfoundry Global Education & Learning Series – Data Structures & Algorithms.

To practice all areas of Data Structures & Algorithms, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.