Academic Year 2022 Sample
Python example test – session 2
General note: The following code is executed as the first cell of the notebook in which all other problems’ codes are run.
import numpy as np from scipy.integrate
import solve_ivp
import scipy.stats as st from scipy
import signal
import matplotlib.pyplot as plt 1. What is the output of this code?
A = np.array([ [1, 2], [3, 4] ])
b = np.array([5, 6])
c = np.array([0, 1])
print(np.dot(A.T + c, b))| A | B | C | D | E | F |
|---------|---------|---------|---------|---------|---------|
| [23 45] | [17 50] | [34 34] | [28 39] | [29 40] | [22 44] |2. What is the output of this code?
A = np.arange(9).reshape(3, -1)
B = np.eye(3)
print(np.trace(A - 2 * B))| A | B | C | D | E | F | G |
|----|----|----|---|---|---|----|
| 10 | -6 | -1 | 0 | 1 | 6 | 10 |3. What is the output of this code?
A.
B.
C.
D.
4. What is the output of this code?
5. What is the output of this code?
6. What is the output of this code?
A.

B.

C.

D.

E.

F.

Last updated