Question 77

Observe the following graph and find the missing statement in the Python code.

Observe the following graph and find the missing statement in the Python code. import matplotlib.pyplot as pl ______ pl. show() Graph: a single line joining the points (0.0, 5), (1.0, 2), (2.0, 3), (3.0, 1); x-axis 0.0 to 3.0, y-axis 1.0 to 5.0.
  1. Apl.bar ([5, 2, 3, 1])
  2. Bpl.scatter ([5, 2, 3, 1])
  3. Cpl.plot ([5, 2, 3, 1])
  4. Dpl.line ([5, 2, 3, 1])
Show answerHide answer

Correct answer: (C) pl.plot ([5, 2, 3, 1])

Explanation

pl.plot([5, 2, 3, 1]) draws a line graph, using the indexes 0-3 as x values. bar and scatter give different charts, and pl.line does not exist.

From DSSSB TGT Computer Science Practice Set 2

This is question 77 of DSSSB TGT Computer Science Practice Set 2. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.