# MCQ | Line Drawing Algorithms in Computer Graphics

**Multiple choice questions and answers (MCQ)** based on the **Line Drawing Algorithms in computer graphics** with 4 choices, correct answer and explanation.

Submitted by Monika Sharma, on October 12, 2020

**Question 1: What is the formula for calculating the slope 'm' of a line?**

- m = dx / dy
- m = dy / dx
- y = mx + c
- None of the above

**Answer: b. m = dy / dx**

**Explanation:**

The slope of a straight line is calculated using the following:

m = (y2 – y1) / (x2 – x1) m = dy / dx

**Question 2: Which of the following is a line drawing algorithm?**

- Line equation algorithm
- Digital Differential Analyzer (DDA) algorithm
- Bressenham's algorithm
- All of the above

**Answer: d. All of the above**

**Explanation:**

All the mentioned algorithms: Line equation algorithm, the DDA algorithm and the Bressenham's line drawing algorithm are used for line drawing in computer graphics.

**Question 3: Which of the following statements is not true with respect to the Digital Differential Analyzer (DDA) algorithm?**

- It is an incremental method of scan conversion of line
- In this method, calculation is performed at each step but by using the results of previous steps.
- This algorithm can also be used to draw circle
- None of the above

**Answer: c. This algorithm can also be used to draw circle.**

**Explanation:**

The DDA algorithm is applicable only for line drawing. Circle cannot be drawn using this algorithm. For circle drawing, there are other algorithms available like the mid-point circle drawing algorithm, etc.

**Question 4: Which of the following options is not correct according to the definition of Bresenham's line drawing algorithm?**

- It gives a close approximation of points of line by determining n-dimensional raster that should be selected.
- It is an incremental error algorithm.
- It gives exact line points.
- None of the above

**Answer: c. It gives exact line points**

**Explanation:**

It gives a close approximation of points of line by determining n-dimensional raster that should be selected.

**Question 5: "The Digital Differential Analyzer (DDA) algorithm is an incremental method of scan conversion of line."Based upon the above statement, determine whether the following condition is true or false."The DDA algorithm uses the results of previous step for determining the value of the next step."**

- True
- False

**Answer: a. True**

**Explanation:**

As the DDA algorithm is an incremental algorithm, it uses the previous values for determining the next values.

TOP Interview Coding Problems/Challenges

- Run-length encoding (find/print frequency of letters in a string)
- Sort an array of 0's, 1's and 2's in linear time complexity
- Checking Anagrams (check whether two string is anagrams or not)
- Relative sorting algorithm
- Finding subarray with given sum
- Find the level in a binary tree with given sum K
- Check whether a Binary Tree is BST (Binary Search Tree) or not
- 1[0]1 Pattern Count
- Capitalize first and last letter of each word in a line
- Print vertical sum of a binary tree
- Print Boundary Sum of a Binary Tree
- Reverse a single linked list
- Greedy Strategy to solve major algorithm problems
- Job sequencing problem
- Root to leaf Path Sum
- Exit Point in a Matrix
- Find length of loop in a linked list
- Toppers of Class
- Print All Nodes that don't have Sibling
- Transform to Sum Tree
- Shortest Source to Destination Path

Comments and Discussions

**Ad:**
Are you a blogger? Join our Blogging forum.