0% found this document useful (0 votes)
16 views29 pages

Test Test

Uploaded by

nutthapol.a
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views29 pages

Test Test

Uploaded by

nutthapol.a
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

Stat by TM

&

Exercise :
Chapter S

1 .
find mean

mean ,
=
375/5 =
75

meanz =
375/5 =
75
.
2 Find Median was how 1 Was des Muse dis
Median , = 76

medianz =
76
3 Find Mode miro:
mode , = 76
mode z =
76
↑ find

53 =
variance
6

62 = 39

5 .
Find
61 =
S D
.
2 45
.
.

-
62 = 6 .
24
Chapter 9 : Stat by TM
Stat by TM
Stat by TM
Stat by TM
Stat by TM
Chapter 10
Stat by TM
Stat by TM

=
O
4

Question 7. For the following sample,


81, 29, 56, 66, 69
Please determine (round your answer to four decimal places)
(a). the median
[3 marks]
(b). the sample standard deviation
[3 marks]

Question 8: Suppose n is given, which of the following Python snippet can calculate ∏ ln (𝑖) ? The
symbol ∏ stands for the product operator throughout mathematics. For example, ∏ 𝑥 stands for
the product 𝑥 , 𝑥 , … , 𝑥 and 𝑥 ; and ∏ i = 1 × 2 × 3 × 4 = 24.

[4 marks]
a)
𝑑=1
import math
for x in range(n):
d = d * math.log(x)
b)
d=1
import math
for x in range(2,n+1)
d = d * math.log(x)
c)
import math
for x in range(2,n):
d = d * math.log(x)
d)
d=1
import math
for x in range(2,n+1):
d = d * math.log(x)

Question 9. Which of the following functions is a built-in function in Python?


a) factorial()
b) print()
c) mean()
d) sqrt()
[3 marks]

Question 10. Which of the following statements is used to create a set in Python?
a) ( )
b) [ ]
c) { }
d) set()
[4 marks]
5

Question 11. Which of the following Python commands can be used to add a new element to a list?
a) list1.addEnd(5)
b) list1.addLast(5)
c) list1.append(5)
d) list1.add(5)
[4 marks]

Question 12. What are the two main types of functions in Python?
a) System function
b) Custom function
c) Built-in function & User defined function
d) User function
[3 marks]

Question 13. To open a file c:\salesdata.txt for reading, we use _____________


a) infile = open(“c:\ salesdata.txt”, “w”)
b) infile = open(“c:\\ salesdata.txt”, “r”)
c) infile = open(file = “c:\ salesdata.txt”, “r”)
d) infile = open(file = “c:\\ salesdata.txt”, “w”)
[4 marks]

Question 14. Which one of the following is a valid Python if statement?


a) if a<=2:
b) if a >= 2 or <=12:
c) if (a => 102)
d) if a = 22
[4 marks]

Question 15. Which of the following is not a declaration of the dictionary?


a) {1: 'A', 2: 'B'}
b) dict([[1,”A”],[2,”B”]])
c) {1,"A",2,"B"}
d) { }
[4 marks]

Question 16. What is a variable defined outside a function referred to as?


a) A static variable
b) A global variable
c) A local variable
d) An automatic variable
[3 marks]

Turn over
6

Question 17. David wants to create a dataframe ‘Salesdata’ based on the data from sale.csv, which is
stored in folder ‘Python’ on c: drive. Which of the following statements should he use?
a) Salesdata=pd.read_csv(“sale.csv”)
b) Salesdata=pd.read_csv(“c:/Python/sale.csv”)
c) Salesdata=pd.to_csv(“c:/Python/sale.csv”)
d) Salesdata=pd.write(“sale.csv”)
[4 marks]

Question 18. Looking at the code below, what would this line do?
newTable=pd.merge(Sales, Products, on=“ProdNo”)
a) Create a DataFrame named newTable that is the intersection of the values of the key “ProdNo”
from both Sales and Products.
b) Create a DataFrame named newTable that is the union of the values of the key “ProdNo” from both
Sales and Products.
c) Create a DataFrame named newTable that contains all the records from Sales and also those
records which satisfy a condition from Products.
d) Create a DataFrame named newTable that contains all the records from Products and also those
records which satisfy a condition from Sales.
[3 marks]

Question 19. Which of the following is the correct declaration of a function in Python?
a) def function function_name():
b) declare function function_name():
c) def function_name():
d) declare function_name():
[3 marks]

Question 20. How many times will the following loop run?

i=3
while(i>=0):
i=i-1

a) 3
b) 4
c) 2
d) 1
[4 marks]

You might also like