※ 引述《sky810675 (KKMAN)》之銘言:
: considering an array of record student[40], each record has three fields,
: namely, student, name, and score. if the data types of studentid, name,
: and score are integer (4 bytes), string (8 bytes), and short integer (2 bytes)
: respectively, please answer the following questions.
: 1.how many bytes in total are needed to store students?
: a. 560
: b. 40
: c. 14
: d. 160
Total = 40 * (4+8+2) = 40 * 14 = 560
: 2.if studentid[1] is stored in memory starting at loocation 1000 and the unit
: of memory location is byte, what is the staring address of students[10]?
: a. 1140
: b. 1010
: c. 1009
: d. 1126
∵4+8+2 = 14
∴14Bytes per element.
Loc(sudents[10])= 1000 + (10-1)*14 = 1000 + 126 = 1126
: 答案1.A
: 2.D
: 可以麻煩知道的人講解一下為什麼嗎??謝謝囉
--
當財團老闆在剝削欺壓勞工階層時,我保持沉默,因為我不是廣大勞動階層。
當兩黨惡鬥階級世襲社會不公不義,我保持沉默,因為我非藍非綠中間選民。
當學測考40幾級分的權貴當醫生時,沒有人作聲,因為全都死在手術檯上了。
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 123.194.100.216