|
1 Objective Questions |
|
2 ------------------- |
|
3 |
|
4 1. Draw a plot of cosine graph between -2pi to 2pi with line thickness 4 |
|
5 |
|
6 Answer:: |
|
7 |
|
8 x = linspace(-2*pi, 2*pi) |
|
9 plot(x, cos(x), linewidth=4) |
|
10 |
|
11 2. Draw a plot of the polynomial x^2-5x+6 in the range 0 to 5 in blue dotted |
|
12 line |
|
13 |
|
14 Answer:: |
|
15 |
|
16 x = linspace(-2*pi, 2*pi) |
|
17 plot(x, x**2 - 5*x + 6, 'r.') |
|
18 |
|
19 3. Which marker is used to get circles |
|
20 |
|
21 a. '.' |
|
22 #. '^' |
|
23 #. 'o' |
|
24 #. '--' |
|
25 |
|
26 4. What does the '^' marker produce |
|
27 |
|
28 Answer: Triangle up marker |
|
29 |
|
30 5. How do you set the title as x^2-5x+6 in LaTex style formatting |
|
31 |
|
32 Answer: title("$x^2-5x+6$") |
|
33 |
|
34 6. What happens when the following code is executed:: |
|
35 |
|
36 xlabel("First label") |
|
37 xlabel("Second label") |
|
38 |
|
39 Answer: The label of x-axis is set to "Second label" |
|
40 |
|
41 7. Read thorugh the documentation and find out is there a way to modify the |
|
42 alignment of text in the command ``ylabel`` |
|
43 |
|
44 a. Yes |
|
45 #. No |
|
46 |
|
47 Answer: No |
|
48 |
|
49 8. How to add the annotation "Maxima" at the point (1, 2) |
|
50 |
|
51 Answer: annotate("Maxima", xy=(1, 2)) |
|
52 |
|
53 9. Is the command ``annotate("max", (1, 2))`` same as ``annotate("max", |
|
54 xy=(1, 2)`` |
|
55 |
|
56 a. True |
|
57 b. False |
|
58 |
|
59 Answer: True |
|
60 |
|
61 10. When a new annotation is made at a point, what happens to the old one |
|
62 |
|
63 a. It is replaced |
|
64 b. It is overwritten |
|
65 c. The new annotation is combined with old one |
|
66 |
|
67 Answer: It is overwritten |
|
68 |
|
69 11. What happens when xlim is used without arguments |
|
70 |
|
71 Answer: It gives the current limits of x-axis |
|
72 |
|
73 12. What happens when ``ylim(0, 5)`` is used |
|
74 |
|
75 Answer: It sets the lower and upper limits of y-axis to 0 and 5 |
|
76 |
|
77 13. Draw a cosine plot from 0 to 2*pi with green dots. annotate the origin as |
|
78 "origin" and set x and y labels to "x" and cos(x) and x limits to 0 and |
|
79 2pi and y limits to -1.2 and 1.2 |
|
80 |
|
81 Answer:: |
|
82 |
|
83 x = linspace(0, 2*pi) |
|
84 plot(x, cos(x), 'g.') |
|
85 annotate("origin", (0, 0)) |
|
86 xlabel("$x$") |
|
87 ylabel("$cos(x)$") |
|
88 xlim(0, 2*pi) |
|
89 ylim(-1.2, 1.2) |
|
90 |