課程名稱︰計算機程式
課程性質︰群組必修
課程教師︰諶玉真
開課學院:工學院
開課系所︰化工系
考試日期(年月日)︰2011/01/06
考試時限(分鐘):110分鐘
是否需發放獎勵金:是
(如未明確表示,則不予發放)
試題 :
1.
(a) Use IMSL to fit the following data into a 2nd order polynomial
function and then proceed with the subsequent steps.
(b) Integrate the function from x=4 to x=8 using IMSL and your own
subroutines including trapezoidal method and Monte Carlo method.
(c) Find the values of its first order of derivatives at x=4 using IMSL and
your own subroutine.
(d) Find the roots of the function using IMSL (all 2 roots) and your own
subroutine by using Bisection method for 2 real root. Using the following
data for selecting the (Xl and Xu). You should list 2 (Xl and Xu) and the
corresponding roots.
The data are
y 3 1.27 0.44 -0.50 -1.1 -0.36 1.25 3.1 6.29
x 0 0.5 0.8 1.3 2 2.8 3.5 4 4.7
2.
Write a program that reads in the information from student.txt.
(a) Write a subroutine lcase that properly converts the names and the
addresses to lowercase regardless of collating sequence.
(b) Write a subroutine that will accept a character array for the first names
and alphabetizing the array. The result should be displayed in an alphabetic
order of the first names.
Columns Contents
-------------------------------------------------------------------------------------
1-5 Student number
6-20 Student’s last name
21-35 Student’s first name
36 Student’s middle initial
37-59 Address
60-66 Phone number
67 Gender (M or F)
68 Class level (1, 2, 3, 4, or 5 for special)
69-72 Major (four-letter abbreviation)
73-75 Total credits earned to date (an integer)
76-78 Cumulative GPA (no decimal point, but one digit
fore and two after the decimal point are assumed.
<student.txt>
10103Johnson James LWaupun, Wiscosin 7345229M1ENGR 15315
10104Andrews Peter JGrand Rapids, Michigan 9493301M2CPSC 42278
10110Peters Andrew JLynden, Washington 3239550M5ART 63205
10113Vandenvander Vannessa VFremont, Michigan 5509237F4HIST110374
10126Aristotle Alice AChino, California 3330861F3PHIL 78310
10144Lucky Lucy LGrandville, Michigan 7745424F5HIST 66229
10179Euler Lennie LThree Rivers, Michigan 6290017M1MATH 15383
10191Nakamura Toky OChicago, Illinois 4249665F1SOCI 12195
10226Freud Fred ELynden, Washington 8340115M1PSYC 15185
10272Spearshake William WGrand Rapids, Michigan 2410744M5ENGL102295
10274Tchaikovsky Wolfgang AByron Center, Michigan 8845115M3MUSC 79275
10284Orange Dutch VGraafschaap, Michigan 3141660M2ENGR 42298
10297Caesar Julie SDenver, Colorado 4470338F4HIST117325
10298Psycho Prunella EDe Motte, Indiana 5384609F4PSYC120299
10301Bull Sitting UGallup, New Mexico 6329971M1EDUC 14195
10302Custer General GBadlands, South Dakota 5552992M3HIST 40195
10303Fahrenheit Felicia OSheboygan, Wisconsin 5154997F2CHEM 40385
10304Deutsch Sprechen ZSparta, Michigan 8861201F5GERM 14305
10307Mendelssohn Mozart WPeoria, Illinois 2410744M3MUSC 76287
10310Augusta Ada BLakewood, California 7172339F2CPSC 46383
10319Gauss Carl FYorktown, Pennsylvania 3385494M2MATH 41400
10323Kronecker Leo PTraverse City, Michigan6763991M3MATH 77275
10330Issacson Jacob ASilver Springs, Md 4847932M5RELI 25299
10331Issacson Esau BSilver Springs, Md 4847932M5RELI 25298
10339Dewey Johanna ASalt Lake City, Utah 6841129F2EDUC 41383
10348Virus Vera WSaginaw, Michigan 6634401F4CPSC115325
10355Zylstra Zelda ADowns, Kansas 7514008F1ENGL 16195
10377Progy Bess NColumbus, Ohio 4841771F2MUSC 44278
10389Newmann Alfred BCheyenne, Wyoming 7712399M4EDUC115099
10395Medes Archie LWhitinsville, Ma 9294401M3ENGR 80310
10406Macdonald Ronald BSeattle, Washington 5582911M1CPSC 15299
10415Aardvark Anthony AGrandville, Michigan 5325912M2ENGR 43279
10422Gestalt Gloria GWheaton, Illinois 6631212F2PSYC 42248
10431GoToDijkstra Edgar GCawker City, Kansas 6349971M1CPSC 15400
10448Rembrandt Roberta ESioux Center, Iowa 2408113F1ART 77220
10458Shoemaker Imelda MHonolulu, Hawaii 9193001F1POLS 15315
10467Marx Karl ZHawthorne, New Jersey 5513915M3ECON 78275
10470Scrooge Ebenezer TTroy, Michigan 8134001M4SOCI118325
10482Nightingale Florence KRochester, New York 7175118F1NURS 15315
10490Gazelle Gwendolyn DChino, California 3132446F2PE 43278
3.
Histograms program. Write a program that accepts an array of real input data
value, divides them into a user-specified number of bins over a user-specified
range, and accumulates the number of samples that fall within each bin. Create
two tables of the histogram which are shown in table a and b.
Table a Table b
------------------------ ------------------------
Range No. of data Range No. of data
95~100 5 95~100 *****
90~95 7 90~95 *******
85~90 3 85~90 ***
80~85 6 80~85 ******
75~80 2 75~80 **
70~75 4 70~75 ****
65~70 1 65~70 *
60~65 3 60~65 ***
0~60 10 0~60 **********
------------------------ -------------------------
Hint: Create an array of 100 real numbers at random, and put them into each
bins within the determined range which is 5.
<註>95~100代表包含100也包含95,其餘的只包含下限
4.
Prime Factorization Problem. Write a program that reads a positive integer and
then calls a subprogram that displays its prime factorization, that is, a
subprogram that expresses a positive integer as a product of primes or
indicates that it is a prime. Note that a prime number is an integer n>1 whose
only positive divisors are 1 and n itself.
For example, if n=23, n is a prime number.
if n=360, n=(2**3)*(3**2)*(5)
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 125.227.190.209