作者k0185123 (Ethan)
看板NTU-Exam
标题[试题] 97上 谌玉真 计算机程式 期末考
时间Fri Jan 9 14:11:11 2009
课程名称︰计算机程式
课程性质︰大一化工选修
课程教师︰谌玉真
开课学院:工学院
开课系所︰化工
考试日期(年月日)︰2009/1/8
考试时限(分钟):2hrs
是否需发放奖励金:是
(如未明确表示,则不予发放)
试题 :
1.Write a subroutine UCASE that properly converts every name to uppercase
regardless of collating sequence. Print out the names(in uppercase),
grades and the letter grades in alphabetic order of the names.
The names and the grades of the students are
Sally White 75.0
Johnny Wang 85.0
Billy Smith 62.0
Simon Tsao 97.0
June Brown 46.0
Mary Johnson 12.0
Sean Koch 78.0
Don Recht 92.0
90 - 100 A
80 - 89 B
70 - 79 C
60 - 69 D
0 - 59 E
2.There are eight students playing card games. Two sets of cards are used.
Please shuffle these 104 cards. Note that these two sets of cards should
not be rearranged separately.
<Spade Heart Diamond Club>
3.In a group of n people, what is the probability that two or more of them
have the same birthday? It is possible to determine the answer to this
question by simulation. Write a function PROBABILITY that calculates the
probability that two or more of n people will have the same birthday,
where n is a calling argument. The function should create an array of size
n and generate n birthdays in the range 1 to 365 randomly. It should then
check to see if any of the n birthdays are identical. The function should
perform this experiment at least 5000times and calculate the fraction of
those times in which two or more people had the same birthday.
4.A point in a rank-2 array is said to be a relative maximum if it is higher
than any of the eight points surrounding it. For example, the element at
position (2,2) in the following array is a relative maximum, since it is
larger than any of the surrounding points.
11 7 -2 0 0 0
-7 14 3 ==> 0 1 0
2 -3 5 0 0 0
Find all the position of the relative maxima of the following 8x8 array by
using your own internal subroutine MYFINDPICK. The result should dislay
like the format shown in the upper matrix. The program should only consider
interior points within the matrix, since any point along an edge of the
matrix cannot be completely surrounded by points lower than itself.
2 -1 -2 1 3 -5 2 1
-2 0 -2.5 5 -2 2 1 0
-3 -3 -3 3 0 0 -1 -2
-4.5 4 -7 6 1 -3 0 5
-3.5 4 -7 6 1 -3 0 5
-9 -6 -5 -3 1 2 0 0.5
-7 -4 -5 -3 2 4 3 -1
-6 -5 -5 -2 0 1 2 5
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.112.240.149
※ 编辑: k0185123 来自: 140.112.240.149 (01/09 14:11)
※ 编辑: k0185123 来自: 140.112.240.149 (01/09 16:30)
※ jacky1990b:转录至看板 NTUCHE-02-HW 01/03 23:01