You are on page 1of 3

morales (om3263) Reection 1 turner (56525) This print-out should have 9 questions.

ns. Multiple-choice questions may continue on the next column or page nd all choices before answering. 001 (part 1 of 7) 10.0 points

4. A= vector(3, 0, 0) B= vector(5, 2, 0)

5. A=< 3, 0, 0 > B=< 5, 2, 0 >

Lets say we want to turn the above diagram into a VPython scene. You should type in the correct lines of code for each question as you go so that you end up with a working program. Remember to begin every VPython program with the following two lines:

6. A.vector= (3, 0, 0) B.vector= (5, 2, 0)

from future import division from visual import

002 (part 2 of 7) 10.0 points Which line of code correctly calculates the vector C? 1. C = vector(A) + vector(B) 2. C = vector(A) - vector(B) 3. C = < A > < B >

First, we will need to dene our vectors A and B. Which two lines of Vpython code accomplish this? 1. A= vec(3, 0, 0) B= vec(5, 2, 0)

4. C = B - A 5. C = A - B

2. A.vector=< 3, 0, 0 > B.vector=< 5, 2, 0 >

6. C = < B > < A > 003 (part 3 of 7) 10.0 points Verify that C comes out as expected. Which of the following lines of code will output C to the shell? 1. print C.vector 2. println(C)

3. A.vector= vector(3, 0, 0) B.vector= vector(5, 2, 0)

morales (om3263) Reection 1 turner (56525) 3. cout << C 4. print < C > 5. print C 004 (part 4 of 7) 10.0 points Now that our vector objects are dened, let us display them. Which of the following lines of code correctly displays vector A in the VPython scene, as shown in the gure above? 1. AArr = arrow(pos=A, axis=vector(A), color=color.red) 2. AArr = arrow(vector(0,0,0), axis=A, color=color.red) 3. AArr = color=color.red) 4. AArr = A 5. AArr = arrow(pos=vector(0,0,0), axis=A, color=color.red) 6. AArr = arrow(< 0, 0, 0 >, axis=vector(A), color=color.red) 005 (part 5 of 7) 10.0 points Which of the following lines of code correctly displays vector B, as shown in the gure above? 1. BArr = arrow(< 0, 0, 0 >, axis=vector(B), color=color.red) 2. BArr = arrow(vector(0,0,0), axis=B, color=color.red) 3. BArr = B 4. BArr = color=color.red) arrow(pos=A, axis=B, arrow(pos=A, axis=A,

6. BArr = arrow(pos=vector(0,0,0), axis=B, color=color.red) 006 (part 6 of 7) 10.0 points Which of the following lines of code correctly displays C, as shown in the gure above? 1. CArr = arrow(pos=-B, color=color.green) 2. CArr = arrow(pos=A, color=color.green) 3. CArr = C 4. CArr = arrow(pos=-A, color=color.green) 5. CArr = arrow(pos=B, color=color.green) axis=C, axis=C, axis=C,

axis=C,

6. CArr = arrow(pos=(0,0,0), axis=C, color=color.green) 007 (part 7 of 7) 10.0 points Now that your program is working, calculate another vector C with dierent values of A and B just by changing the two lines in which A and B are dened. Make A =< 5, 3.6, 1.7 > and B =< 2.4, 2, 5.3 >. 1. < 7.4, 1.6, 5 > 2. C =< 3.8, 1.6, 7 > 3. C =< 7.4, 1.6, 7 > 4. C =< 1.6, 1.6, 6.3 > 5. C =< 7.4, 2.1, 7.2 > 6. C =< 3.8, 2, 7 > 008 (part 1 of 2) 10.0 points Suppose that you are going to program a computer to carry out an iterative calculation of motion involving non-constant forces. Which of the following calculations should be

5. BArr = arrow(pos=B, axis=vector(B), color=color.red)

morales (om3263) Reection 1 turner (56525) done before starting the repetitive loop calculations? (A) Dene constants such as G. (B) Update the (vector) position of each object. (C) Calculate the (vector) forces acting on the objects. (D) Specify the initial (vector) momentum of each object. (E) Specify an appropriate value for the time step. (F) Specify the mass of each object. (G) Update the (vector) momentum of each object. (H) Specify the initial (vector) position of each object. 1. A, D, E, F, H 2. B, D, F 3. B, C, F, G 4. A, B, D, H 5. C, G 6. A, B, C, D, F, H 7. C, G, H 8. A, B, D, G, E 9. B, F 10. A, E, H 009 (part 2 of 2) 10.0 points Inside the repetitive loop, assuming that we use the nal velocity in each time interval as the approximation to the average velocity in that time interval, what should be the correct sequence of the following calculations? (A) Update the (vector) momentum of each object. (B) Calculate the (vector) forces acting on the objects. (C) Update the (vector) position of each object. 1. B, C, A 2. A, B, C 3. A, C, B 4. C, A, B 5. B, A, C 6. C, B, A

You might also like