Answer:
import numpy as np
import matplotlib.pyplot as plt
def calculate_pi(x,y):
points_in_circle=0
for i in range(len(x)):
if np.sqrt(x[i]**2+y[i]**2)<=1:
points_in_circle+=1
pi_value=4*points_in_circle/len(x)
return pi_value
length=np.power(10,6)
x=np.random.rand(length)
y=np.random.rand(length)
pi=np.zeros(7)
sample_size=np.zeros(7)
for i in range(len(pi)):
xs=x[:np.power(10,i)]
ys=y[:np.power(10,i)]
sample_size[i]=len(xs)
pi_value=calculate_pi(xs,ys)
pi[i]=pi_value
print("The value of pi at different sample size is")
print(pi)
plt.plot(sample_size,np.abs(pi-np.pi))
plt.xscale('log')
plt.yscale('log')
plt.xlabel('sample size')
plt.ylabel('absolute error')
plt.title('Error Vs Sample Size')
plt.show()
Explanation:
The python program gets the sample size of circles and the areas and returns a plot of one against the other as a line plot. The numpy package is used to mathematically create the circle samples as a series of random numbers while matplotlib's pyplot is used to plot for the visual statistics of the features of the samples.
Python:
sentence = “this is the sentence.”
size = len(sentence)
C++:
string sentence = “this is the sentence.”
int size = sentence.size()
* Remember strings are just arrays of characters.
Answer:
1. B
2. D
3. C
4. A
5. B
Explanation:
1. To check the integrity of your hard disk and fix various file system errors, the Windows utility which should be implemented is Check disk (Chkdsk). This utility is always used with the command line interface (CLI) with the command "chkdsk."
2. An event or action took place and it caused damage to data, hardware, software and processing capability of the computer. From the statement given, security risks are being described. Any event or action that is capable of causing a problem to a computer system is considered to be a security risk and should be prevented through the use of an appropriate utility software.
3. Virus is a software program that can infect, damage and disrupts the whole computer system.
4. To protect the whole computer system, the software utility which is needed is an Anti-virus.
5. To avoid losing valuable data to your computer, the most important thing to do is to regularly back-up your files.
Insecurely attached infants who are left my their mothers in an unfamiliar setting often will Hold fast in their mothers in their return.
A. Hold fast in their mothers in their return
<u>Explanation:</u>
It is in the conscience of the infants to have the company of their parents no matter the place or time and do not generally like to be left alone. Moreover, the questions says, insecurely attached infants which further add up to this behavior.
The infant would not explore the surroundings due to lack of confidence in an unfamiliar setting. They would rather be uncomfortable and most probably weep the time until their mother arrives and hold fast on to them on their return.