# Tutor profile: Kevin C.

## Questions

### Subject: Python Programming

Which of the following statements can be used to generate the following list of numbers? [10, 8, 6, 4, 2] list(reversed([2, 4, 6, 8, 10])) sorted(list({4, 2, 8, 6, 10}), reverse=True) list(range(10, 0, -2)) << None of the above

list(range(10, 0, -2)) <<

### Subject: MATLAB

i. do the Monte Carlo estimates stabilize as Nreps increases? ii. what happens to the estimated Sn as n increases? iii. does the CI halfwidth capture the actual error behavior? iv. what happens to the CI halfwidth for Sn as n increases? v. is there anything unusual in your plots for high n and low Nreps?

Ans: Monte Carlo estimates stabilizes with increase in Nreps since with increase in Nrep random points one obtains reduced statistical error. Ans: The volume S_n increases exponentially, attaining a peak value when n=5. Then it decreases further to infinity. My results suggest that all of the volume of a high-dimensional sphere is contained in the skin. This is due to the sphere hardening phenomenon. Ans: yes, the confidence interval halfwidth captures the actual error behavior. The width of CI decreases when Nreps increase which then reduces the statistical error. When confidence interval (CI) increases the marginal error increases Ans: The CI halfwidth decreases as n increases. Also, statistical error reduces. For high n the plots seem to stabilize but for low Nreps there is high variance. The unusualness is due to the fact that the Monte Carlo estimate of ( p) ̂ converges to p as Nreps increases.

### Subject: C++ Programming

5. Write a program that Inputs a telephone number as string in the from (555)555-5555. The program should the function strtok to extract the area code as a token the first three digits of the phone number as a token and the last four digits of the phone number as a token. The seven digits of the phone number should be concatenated into one string. Both the area code and the phone number should be printed( hint* Use pointers)

#include <string.h> #include <stdio.h> int main() { char str[20]; char *num[5]; int j = 0; printf("Enter a Telephone Number as a string in the form as (555)555-5555: "); scanf("%s", str); char *token = strtok(str, " ()-"); // Keep printing tokens while one of the // delimiters present in str[]. while (token != NULL) { num[j++] = token; token = strtok(NULL, " ()-"); } printf("The integer area code is given as %s\n", num[0]); printf("The long integer Telephone Number is %s%s\n", num[1],num[2]); return(0); }

## Contact tutor

needs and Kevin will reply soon.