Professional Documents
Culture Documents
17.04.2012 17:40
There are 30 questions (each 3.34 points) for a total of 100 points.
Exam Type: A
All questions are multiple choice, no points will be lost for wrong answers.
Name:
Student ID:
Section:
Signature:
AAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAA
1) Which of the below is the correct order of a
5) The mathematical theorem below
if a b then a (a+b)/2 b
FORTRAN program?
a) Declarations
b) Executable statements
can be expressed in FORTRAN as:
Executable statements
Declarations
a) if ( a<= b ) then
STOP
STOP
(a <= (a + b) / 2) .OR. (b >= (a + b) / 2)
END
END
endif None of the above
c) Executable statements
d) Declarations
b) if ( a <= b ) then
STOP
STOP
print*, (a + b) / 2
Declarations
Declarations
endif
END
END
c) x = ( a <= b );
e) STOP
y = ( a <= (a + b) / 2);
END
z = ( b >= (a + b) / 2);
Declarations
if (x) then y .AND. z
Executable statements
endif
END
d) if ( a <= b)
if ( a <= (a + b) / 2 <= b) then
print*, (a + b) / 2
2) Which of the segments causes an error?
endif
a) print*, "enter a number"
read*,m
e) None of the above
print*,m
b) print*,"enter a number" !
read*,m
6) What is the output of the program below?
read*,m
real x
print*,m,m
x = 25.025
c) print*, "enter a number"
i=x
read*,m
if ( mod ( i , 5 ) .eq. 0) then
m=2
write ( * , 5 ) sqrt ( x )
print*,m
else
d) read*,v
write( * , 5 ) sqrt ( x + 11 )
print*, "enter m"
endif
print*,v
print* , x
e) print*,"enter m"
stop
read*,m
5 format( f5.0 )
stop
end
print*,m
a) 5.0
b) 5
c) 6
d) 6.0
e) 5.0
3) What is the content of variable x after the
execution of the segment below?
integer a , b
a=5
b=9
x=a/b
a) 0.5
b) 0
c) 0.5
d) 0.55555
e) 0.55556
25.025
25.03
25.0525
25.03
25
AAAAAAAAAAAAAAAAAAAAAAA
8) What is printed by the following statements?
(letter B is used for blank/space character)
k1 = 789
k3 = - 157
x1 = 367.25
x3 = 36.725
write ( * , 5 ) k1 , k3 , x1 , x3
5
format ( i4 , i3 , 2 ( f6.1 ) )
a) B789-157B367.3BB36.7
b) B789-157367.3BBB36.7
c) B789***B367.2BB36.7
d) B789***B367.2BB36.8
e) B789***B367.3BB36.7
9) Which lines in the below program has a syntax
(compilation) error?
1
! summation of even numbers
up to 100
2
integer sum , number
3
sum = 0.0
4
read*, number=2
5
5
sum = sum + number
6
if (number .LT. 100) goto 9
7
print*, sum
8
stop
9
9
number = number + 2
10
goto 5
11
stop
12
end
a) Line3 and Line6 b) Line 4
c) Line11
d) Line1 and Line3
e) Line 8 and Line11
10) What is the output of the following program?
m=2
ic = 0
10
ic = ic + 1
l=1
lc = 3
20
if (lc - 12) 30, 30, 40
30
l = l + ic
lc = lc + m
goto 20
40
print*, l
if (lc .LT. 8) goto 10
stop
end
a) 6 b) 5
c) 4
d) 3
e) 8
11) What is the value of x after the execution of the
segment below?
real x
x=4/2*(1/2)
a) 0
b) 0.0
c) 2.0
d) 1.0
e) Error
AAAAAAAAAAAAAAAAAAAAAAA
12) What is the content of x after the execution of the
program below?
integer x
x = 4/ (2 * ( 3 / 4))
print*, x
end
a) 1.0
b) 0.0
c) 0
d) 2.0
e) Error
b) B
c) C
d) D
e) No Output
AAAAAAAAAAAAAAAAAAAAAAA
16) How many of those evaluate to
.TRUE. if IA = 5 , B = 10.0 , C = 15.0 and FLAG = .TRUE.
AAAAAAAAAAAAAAAAAAAAAAA
21) Which if structure describes the partial
function below?
e) 1 20
1 6
3 2
a)
b)
c)
d)
e)
AAAAAAAAAAAAAAAAAAAAAAA
22)What is the FORTRAN equivalent of the
following expression?
a)
a ** ( x + y ) / ( 1.0 + ( -m ) / ( 2 + t * ( 1.0 / ( x + y ) ) )
b)
a ** ( x + y ) / ( 1.0 + ( -m ) / ( 2 + t * ( 1.0 / ( x + y ) ) ) )
c)
a ** ( x + y ) / ( 1.0 + ( -m ) / ( 2 + t * ( 1.0 / ( x + y ) ) ) ) )
d)
a ** ( x + y ) / ( 1.0 + ( -m ) / ( ( 2 + t * ( 1.0 / ( x + y ) ) ) )
e)
a ** ( x + y ) / ( 1.0 + ( -m ) / ( 2 +( t * ( 1.0 / ( x + y ) ) ) )
AAAAAAAAAAAAAAAAAAAAAAA
26)What is the output of the following program
segment?
integer a, b, c
a=1
b = 10
c = 100
if ( .NOT. ( 3 /= 4 ) ) then
a=2
else if ( 3 .GT. 4 .OR. 5 < 7 - 1 )then
b = 20
else if ( .NOT. ( b /= c/50)) then
c = 200
else
print*, "a=", a
endif
print*, a+b+c
a) 121 b) 111 c) 112
36 / (4 * 2) * 2 * 2 20
a) -2
a) 3.1416
b) 3.1415 c) 3.0
e) Error
c) -4
d) -2.0
e) 0
(3 * 8 / 2 + mod (11, 2) - 1) / 2
b) 6
c) 6.5
d) 23
e) 3
b) 0
c) 37
d) 13
e) -18.5
d) 3
b) 1.5
e) None of them
a) 0
24) What will be the output of the program?
integer a
a=1
if (a-1 .LE. 0 .OR. a .GT. 2 .AND. a .GE. a+1) then
a=3
else
a=4
endif
print*, a
end
a) 0
b) 1
c) 2
d) 3
e) 4
d) 211
b) 5
c) T
d) F
e) Error