Sample Exam 1 - Winter 2000 | MATLAB Programming | COMP 1200, Exams of Database Programming

Material Type: Exam; Class: Matlab Programming; Subject: Computer Sci & Software En; University: Auburn University - Main Campus; Term: Unknown 2000;

Typology: Exams

Pre 2010

Uploaded on 10/12/2009

koofers-user-5zk-2
koofers-user-5zk-2 🇺🇸

4.5

(2)

10 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
pxerra *r Page fof5 -v-
j
* U\/
tlt;
3. Identify the invalid Fortran identifiers below by circling them [1 pt eachj:
GG.D
--.--6
$3ffio
rzgffi
@
C1ub33
COMP 0120 Fditran, Winter 2000
SAMPLE EXAM1
1. Match each item in the first column[2 pts each]:
2. Find the FORTRAN ASSIGNMENT STATEMENT conesponding to the following
'EQUATIONS (assumingthatall variables represent real values)[l pts eacbl:
n\
la. )ndicate if the following statements are valid or invalid [2 pts each]:
\-/ Assume the following declarations:
REAL ::Pi:3.141593
INTEGER :: NF5,N:10,P
CHARACTER(Ien : 4) :: "Teta, Beta* 1, Alpha*S
Irttp:l lweb99.duc. auburn. ed)web99/p99 I 8/cse I 20lsample-exl .htm
A group of binary digits
B central processing unit
D language translator
FORTRAN ASSIGNMENT STATEMENT
num_derivative=(Log"(X+Delta_X)-Logu
(X)/Delta_X /)qn - el<t Iv^):,<. . ( Lo>e (x I bcl l< - "() -
/ l< .xx
,_flux:e x da' cos(theta) c /n./,,. - F/ux = 2F ola V oos (
average_velocit5(x2-x 1 / (tz-tl) ue /c ,1 - W loo; \ , (,xvo) - tj X',& t\ /ltt
distancrvelocity x 1i*.*u"celeratiori x
tim&tz.o a(;ll<n,< = v</*i lr,* 1,,< * a6ce/er*);,-
centripetal acc=4.0 x piz x r/(*) 4sn/n;pe/^ l -atc<. tl,t2 * pi
2t2t00
pf3
pf4
pf5

Partial preview of the text

Download Sample Exam 1 - Winter 2000 | MATLAB Programming | COMP 1200 and more Exams Database Programming in PDF only on Docsity!

pxerra *r Page fof5 -v-

j

  • U/

tlt;

3. Identify the invalid Fortran identifiers below by circling them [1 pt eachj:

GG.D--.--

$3ffio rzgffi @C1ub

COMP 0120 Fditran,^ Winter 2000

SAMPLE EXAM

1. Match each item in the first column[2 pts each]:

2. Find the FORTRAN ASSIGNMENT STATEMENT conesponding to the following

'EQUATIONS (assumingthatall variables represent real values)[l pts eacbl:

n
la. -/ )ndicate if^ the^ following^ statements are^ valid^ or^ invalid^ [2 pts^ each]:

Assume the following declarations:

REAL ::Pi:3.

INTEGER :: NF5,N:10,P

CHARACTER(Ien :^ 4) :: (^) "Teta, Beta* (^) 1, Alpha*S

Irttp:l lweb99.duc. auburn. ed)web99/p99 I 8/cse (^) I 20lsample-exl .htm

A group^ of binary digits

B central processing unit

D language translator

FORTRAN ASSIGNMENT STATEMENT

num_derivative=(Log"(X+Delta_X)-Logu (X)/Delta_X

/)qn - el<t^ Iv^):,<.^.^ (^ Lo>e^ (x^ I^ bcl^ l<^ - "() -

/ l< .xx ,_flux:e x^ da'^ cos(theta)^ c /n./,,.

  • F/ux^ = €^ 2F^ ola^ V oos^

( average_velocit5(x2-x (^1) / (tz-tl) (^) ue /c (^) ,1 - (^) W loo; (^) \ , (,xvo) (^) - tj X',& t\ /ltt distancrvelocity x^ 1i.u"celeratiori x tim&tz.o

a(;ll<n,< (^) = v</i lr,^ 1,,< * a6ce/er*);,-

centripetal acc=4.0 x^ piz x^ r/(*) (^) 4sn/n;pe/^ l (^) -atc<. tl,t2 (^) * pi

2t2t

F' (^) '-At

",LE EXAM^ #1^ Page2^ of^5

statement is (^) valid?, (Place X)

is invalid?

(Place (^) X)

Alpha:"ALulluPFIAu

lr-

fttl (^) --

M/N=O.5 -X

p__N*,r(Z+1)

t-

Teta:l001 .X

Teta:Beta+Pi -k

5. Indicate the value computed in the following Forfran expressioiis (remember numbers with

decimnl points^ are REALtype and whole numbers arc INTEGERtype - make sure your I

answer reflects the type, in this manqer, as 12 pls eachl:

at is the.result of the following Logical Expressions (please check in .TRUE.

r >FALSE.^ column). Assume the following declarations [2pts. ea]

REAL:: d:9.

INTEGER :: sl = 16- s2: 12

With the following Declarations and Statements indicate the output produced [6 pts]:

CA\IU\CTER( I 7) : : ourStr :^ "COMPIJTER SCIENCE'

CHARACTER(LEN :^1 1) : :"engStr, resultStr*

l+3**

4.-3*(2t6)

(4.0+2.0)*2t

(3/5+t) *6.

(2 e^ 3) 4' 2

s2< sl) .AND.( d >^ 5+

.NOT. (s1^ <5 .OR. s2 >^ 15/2.0)

NOT. (s2::^ 14) .OR. (.NOT.^ d: :7^ .6.OR. (^) d >:^ 4.

http://web99.duc. auburn.edu/web99 I p99 l8l cse I 20lsample -^ ex l.htm 2t2t

IPLE EXAM #I

Sum,= Sum +^ REAL

IF {Sum > Linit)

Count:Count+

END DO

PRINT *,^ t'Count^ = "

END PROGRAM Doloop

EXIT

, Count,^ "Sum = Jtr^ Sum

l_-/ t I

t-,

tv^ /n

L,' {1.tl

S-*+::_l^ I

Page 4 of

2U

I^ I a \y' t

-{(?^ t

Output:

10. Write a complete program to implement the following specification [30 pts]:

Problem:

  • (^) ' We want you^ to^ write^ a^ program^ ihat for: Vr(initial (^) velocity measured in ft/sec)

Theta (angle^ at which a rocket is fired measured in radians)

r (time after firing measured in seconds)

"aption (^) (user's (^) option) (^) , calculates: ' (^) X(horizontal (^) displacement of the rocket, measured in ft)

or

I'(vertical displacement of the rocket measured in ft)

depending on userrs option using the following formulas:

http://web99. (^) duc.auburn .edulwebggl p99 I 8/cse I 2Olsample-ex I (^) .htm

X -: Vo"x t. x cos (Theta)

1' - vo x t'x sin (Th;h)^ - 75 x t

as long the dser wish. (^)!

Specilication:

Allow (^) userto input: n Vo{intial velocity measured (^) in ft/sec) value Theta (angle at which a rocket is fired measured in radians

t (time after firing measured in"seconds)

real values and:

op t (^) io n (user's (^) eiption) character value which (^) values can be:

uX* (^) if (^) the user wants to compute the horizontal displacement of the rocket, measured in ft.+ "Y" if the user wsnts to compute the vertical displacement ofthe rocket measured in ft 'E" if^ the^ users^ wish^ no longer^ to^ compute any^ of these two values

and be sure t9 use aprompt for the user.

?he program should output the computed values of :

X (hoizontal displacement measured in ft)or

X(vertical displacement measured in ft) or-

all

,IPLE EXAM #1 (^) Page 5 of

212/0a

an eror message in case the user type in a wrong option.

f *nlt,^ '1 ,'^

t , fror"* (^) ''6''fr'e F

rf

;&}i (^) )'t{ v;'tytl;t; r (^ t x^ , (^)?

.Ch a r .,^ cle t, t\t^ ^ t."Ce|,^ h b<"^ \

I t^ tl"r$t.tty',4', 'L I Pr

th*rv\l

DoP",nt (^) r, " Eo,le,^

t vllaa^lile"il^ *:r

ftnorl


,

l/''l.q

fr;nrY,"fnltn

+v l:-z"

K'^'l

r' t

/r; (^) ^r

, " /r'{rt^

tL i^ *;Lt^ n)^

ve (^) fo':}7t

t

/u^}

#, (^) Vo h,rl,? {0, -(r:n]*, "^ f^ ^lut

Nii{"'l

'tl' l'"'i7o-I*l^ ;: ;r (^) '"'" ' A

'r,'r'"*t

d,ryLrJror"

t (^) !' {1:f J (^) "l Wtt:c'al

q'2f(^<v' (^) )''

r ) t.* i Llr^ *{-^ n^ ^ l,^ $r 1{ le^ "

#i 'i^ ,

i

; lu (^) )t. {

{ t

rt,{fu$,r6Pii:d's (^) \ r ' 'ti{ (^) (Kn+r"^e-'? t ) L*: , , \

rJiy

,- (^) L/o * (^) L' (^) ; 1?e !t++3 r-^

,t (^) x ,"{enr"

8,,!if

.i,''fi','i:';$"t'i;"^'e

*r a'l^ y'

b.:^(r,*,, I^ Y,.!^ i^ 2,(i!:,I),^ :^

lrt r,Y t"l#^

A

Else tr( (ro, pt*€, t^ t^ t) (^) Ef;t

hdElI( (^) 'att*ta

i'tvn+ (^) €r'l' \

f"'lDO , , :

E,/,

(C.tL KArt

t

httpt lweb99. duc. auburn. edu/web 99 I p99 | 8/ cse I 2Olsample_ex 1 .htm