Visva-Bharati · Department of Mathematics
DSEMA-3A
B.Sc. Mathematics · Semester VI2023
- 1(a) Write two differences between compiler and assembler. [2]
- 1(b) A Fibonnaci sequence is defined as follows: $0,1,1,2,3,5,\ldots$ ($F_{n+1}=F_n+F_{n-1}$, $n\ge1$). Using standard symbols, draw a flowchart to find all the numbers of this sequence which are $\le2023$. [3]
- 2(a) Why are the following unacceptable as FORTRAN 77 real constants? \begin{verbatim} (i) 5E - 7 (ii) E + 8 (iii) 8,987.43 (iv) 7.6E2.8 \end{verbatim} [2]
- 2(b) Write a FORMAT statement to print an integer value $-2023$. [1]
- 2(c) What do you mean by character expression? Explain with a suitable example. [2]
- 3(a) Assume that $M$ and $N$ are integer variables having the values $-75$ and 78 respectively, and that $X$, $Y$, $Z$ are real variables with values $-73.56$, 80.0 and 114.7 respectively. Find the value of the following expression. \begin{small} \begin{verbatim} .NOT. ((M .GT. N) .AND. (X .LT. Z)) .NEQV. ((M .LE. N) .OR. (X .GE. Z)) \end{verbatim} \end{small} [3]
- 3(b) State two main differences between READ statement and DATA statement. [2]
- 4(a) The graph of the equation $x^2+y^2=50$ is a circle with center at the origin and radius $\sqrt{50}$. Write a FORTRAN 77 program to determine the number of points with integer coordinates which lie in the circle. [3]
- 4(b) Write an arithmetic IF statement equivalent to: \begin{verbatim} GO TO(15,25,35), JACK \end{verbatim} [1]
- 4(c) Point out the errors (if any) in the following: \begin{verbatim} DIMENSION M(50) S = 0.0 DO 15 J = 1, 3 15 IF(M(J) .EQ. 0) S = S + J \end{verbatim} [1]
- 5(a) Write the FORTRAN 77 program segment for the following flowchart using IF-THEN-ELSE statement. \begin{center} \includegraphics[width=.7\linewidth]{BSc_VI_2023_DSEMA3A_Q5a.png} \end{center} [3]
- 5(b) Rewrite the following FORTRAN 77 segment using a DO loop. \begin{verbatim} KOUNT = 0 I = I + 1 10 READ(*,5) A IF(A .GT. 0) KOUNT = KOUNT + 1 I = I + 1 IF(I .LE. 250) GO TO 10 \end{verbatim} [2]
- 6(a) Find the output (mentioning all the necessary steps involved) of the following program: \begin{verbatim} INTEGER X(6) DO 10 K = 1, 6, 2 X(K) = 3 * K X(K + 1) = K + 2 10 CONTINUE DO 20 J = 1, 6, 3 X(J) = X(J) + X(J + 1) 20 CONTINUE IF(X(2) .LT. 7) X(2) = X(3) WRITE(6,15) X 15 FORMAT(1X,6I8) STOP END \end{verbatim} [3]
- 6(b) Define a statement function to calculate $Z=\sqrt{a_1b_1+a_2b_2}$ and write an assignment statement to calculate \[A=\frac{\sqrt{x_1^2+x_2^2}\sqrt{y_1^2+y_2^2}}{\sqrt{x_1y_1+x_2y_2}}.\] [2]