Ms 2002 Ce Cs Paper Ibc C Version

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Ms 2002 Ce Cs Paper Ibc C Version as PDF for free.

More details

  • Words: 753
  • Pages: 3
Suggested Solutions to 2002 HKCEE Computer Studies Paper I Sections B & C (C Version) 6.

7.

Line Number 180 220 225 230 270 280 300 310 315 340 385

Step 1 Step 2 Steps 3, 4 & 5 Step 6 Step 7 Step 8 Step 9 Step 10 Step 11

line 40 line 60 lines 70, 80 and 90 lines 100, 110 and 180 line 120 line 130 line 140 line 150 line 160 line 170 #include <stdio.h>

00 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 8.

Program Statement char ch; DiskFile = fopen(FileName, "r"); TotalReplaced = 0; while ( !feof(DiskFile) ) fscanf(DiskFile, "%c", &ch); if ( ch == SearchChar ) printf("%c", ReplaceChar); TotalReplaced = TotalReplaced + 1; } while ( ch != '*' ); printf("\n");

(a)

1 1 1 1 1 1 1 1 1 1 1 Max 10 1 1 1 1 1 1 1 1 1 1

int main() { int former, latter, limit, cnt; scanf("%d", &limit); former = 1; latter = 1; cnt = 0; while ( former <= limit ) { printf("%d", former); latter = former + latter; former = latter - former; cnt++; if ( cnt % 6 == 0 ) printf("\n"); } return 0; } (i)

when Count equals 0, Ch = A, Tmp = A, P = A. when Count equals 0, Ch = B, Tmp = F, P = AF. when Count equals 0, Ch = L, Tmp = D, P = AFD. when Count equals 0, Ch = E, Tmp = U, P = AFDU.

1 1

SEC = AFDU.

1

2002-CE-COMP STUD 1B & C-1 (C Version)

(ii)

void Decode(char* P, char* C) { char Ch; char Tmp[2]; int Len, Count, Asc;

1

strcpy(C, ""); strcpy(Tmp, " "); Len = strlen(P); for ( Count = 0; Count < Len; Count++ ) { Ch = P[Count]; Asc = (int) Ch - A; Asc = (D * Asc) % N; Tmp[0] = (char) (Asc + A); strcat(C, Tmp); }

1

1 1

} (iii) (b) 9.

(a)

(b)

(c)

AWIK

1

Line 110 is changed to:

const int M = 5, D = 21, N = 26, A = 97;

void InputWords() { printf("Input the first English word: "); scanf("%s", word1); printf("Input the second English word: "); scanf("%s", word2); } void CheckLength() { if ( strlen(word1) != strlen(word2) ) match = false; } void ChangeUpper(char* st) { int i; for ( i = 0; i < strlen(st); i++ ) if ( st[i] >= 'a' && st[i] <= 'z' ) st[i] = st[i] - 'a' + 'A'; }

2002-CE-COMP STUD 1B & C-2 (C Version)

1+1

0.5 0.5

1+1

1

1 1

(d)

void CalFreq() { int i; for ( i = 0; i < strlen(word1); i++ ) { freq1[word1[i] - 'A']++; freq2[word2[i] - 'A']++; }

1 1

} (e)

void CheckMatching() { int i; for ( i = 0; i < 26; i++ ) if ( freq1[i] != freq2[i] ) match = false;

1 1

} 10.

(a)

(b) (c)

(i)

Web page browsers can be used.

1

(ii)

We can use data encryption to protect data from unauthorised access.

1

Data entry operator / programmer / web page designer (any two) could help Amy. 1. 2. 3.

(d)

Electronic mail service can provide 24-hour enquiry service. (time) Customers can make enquiries all over the world. / Customers are not necessary to visit the bookstore by person. (location) Staff can answer customers’ enquiries on batch./ Staff can answer similar enquiries quickly. (management)

1, 1 1 1 1

1. 2.

The web site can provide a search engine for customers to search books. (enquiry) The web site can provide online order/payment/reservation service for customers to order/buy books. (payment) 3. The web site can display new release books / top selling books / discounted books so that customers can collect more information about our store. (display) 4. The web site can provide a bulletin board / chat room for customers to feed back our services. (communication / customers’ opinion) (any three) 2, 2, 2

(e)

1. 2. 3.

Constructing the web site requires a high investment on web server development. (cost) Customers are not used to buy books online. (customers’ habit) There is a security risk on the Internet that affects customers to use the web site. (Internet security)

Effective communications: Relevance

0 / 1 /2

Language/Style correct and appropriate

0/1/2

0/1/2/3/4

2002-CE-COMP STUD 1B & C-3 (C Version)

1 1 1

Related Documents