CS - 08 Numerical & Statistical Computing
June 2001

1. (a) Write, which of the following variable names, is invalid in FORTRAN and why? (3)
(i) STOP
(ii) A * B
(iii) ROOTZ
(iv) 2RATES

(b) Write, which of the following FORTRAN constants are invalid and why? (3)
(i) - 3/4
(ii) 12.5 E + 4
(iii) 12345
(iv) 25

(c) Write a FORTRAN 90 statement for each of the following formulae: (3)
(i) X = [(ab)/(c + dk/m + k)] + a
(ii) u = e| x2 - y2 |

BC
(viii) v = A

(d) For J = 2 and K = 5, find the final values of J and K after each program segment: (3)
(i) If (J - K) 10, 10, 20
10 J = K
20 J = J + 2
(ii) IF (J .GE. K) J = K + 2
J = J + 2

(e) Suppose J, K and L contain 10, 20 and 30 respectively. Find the value of each of the following logical expressions: (3)
(i) .NOT. (5 .EQ. J - 5 .AND. 2 * K .EQ. J + L)
(ii) 2 * J .EQ. K .AND. K .LE. L

(f) Suppose A, B and C contain 111.222, 444.666 and 777.888 respectively , and (3)
WRITE (*, 100) A, B, C
is executed. Describe the output, if the accompanying FORMAT statement is
(i) 100 FORMAT (1X, F10.2)
(ii) 100 FORMAT (F7.3, 2X, E15.7/F15.2)

(g) Following table gives the height (in inches) of the employees of an organization: (4)

Height in inches

Number of employees

50-60

05

60-70

35

70-80

08

80-90

02


Calculate the variance of the above class-distribution.

(h) Fit a straight line to the data given by the following table: (4)

Independent Variable
x

Dependent
Variable
y

1

6

2

5

4

9

5

11

6

13

8

17


(i) A jar contains 6 red balls, 4 green balls, 3 blue balls, and 2 white balls. A sample of size 6 balls is selected at random without replacement. Find the probability that the sample contains 2 red balls, 2 green balls, 1 blue ball, and 1 white ball. (4)

2. (a) Write a FORTRAN function which reads an integer n and then reads n pairs of (x, y) points. For each point (x, y) finds whether the point lies within a circle with center (0, 0) and radius 2 and prints suitable message. (6)

(b) Write a program to convert any n-digit hexadecimal number to its equivalent decimal number. For example, decimal equivalent of AB8F is 43919. (9)

3. (a) A departmental store keeps records of various items in a format (10)

Stock number

Item description

Quantity at hand

Unit
Price

Stock number is a 2-digit number, Item description is a 13-character name of the item and its category/size, Quantity-at-hand is a 4-digit number, which is the number of items in hand/store. Unit price is the price of a single item.

Develop a program to prepare sequential access file consisting of N records, each record refers to one item. The program should be such that it makes the following checks:

  1. the stock number should not lie outside 1 to 99.
  2. the initial data are to be entered from the terminal (unit = 1)
  3. the price of an item should not be negative, and
  4. the number of items of a particular type should not be negative.

(b) For the following frequency distribution, draw (less-than type) frequency polygon:

Class

Frequency

1-4

3

4-7

5

7-10

4

10-13

1

13-16

6

16-19

7

19-22

5

22-25

14

25-28

1

28-31

4

 

4. (a) If the probabilities that a person purchasing a new car will choose green, white, red or blue colour are 0.08, 0.09, 0.15 and 0.21 respectively, then what is the probability that a given buyer will choose a new car which has any one of these colours? (4)

(b) The probability that a college student being male and that of being female are 1/8 and 7/8 respectively. The probability that a male student completes the course is 2/3 and that a female student completes the course is 1/3. A student is selected at random and is found to have completed the course. What is the probability that the student is a male? (6)

(c) Let X be the number of 1's obtained in 15 throws of an unbiased dice. Find its mean and variance. (5)

5. (a) Calculate the correlation coefficient for the following data: (7)

x

y

15

9

10

12

5

18

12

10

17

5

18

2


(b) The following table gives the average wholesale prices of the four grains for the years 1996 to 2000. Compute the chain base index number. (8)

Grain

1996

1997

1998

1999

2000

Wheat

100

120

115

125

150

Gram

100

95

105

115

98

Barley

100

110

105

95

120

Rice

100

115

110

120

115


6. (a) Compute the approximate value of the integral
I =(x + x2) dx
using Simpson's rule by taking interval size h as 1. (7)

(b) Find the value of dy/dx at x = 2.0 for the function given by the following table: (8)

x

f(x)

1.0

2.7183

1.2

3.3201

1.4

4.0552

1.6

4.9530

1.8

6.0496

2.0

7.3891

2.2

9.0250

Next Paper

UNIVERSAL TEACHER PUBLICATIONS
Web: universalteacherpublications.com, universalteacher.com, universalteacher4u.com