Ms 2003 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 2003 Ce Cs Paper Ibc C Version as PDF for free.

More details

  • Words: 526
  • Pages: 2
Suggested Solutions to 2003 HKCEE Computer Studies Paper I Sections B & C (C Version) 7.

(a)

A check digit is an extra digit to validate a code / to check the correctness of a code

1

(b)

(i)

2

Values of i just after executing the for loop

n

sum

0

4

4

1

3

7

2

14

12

3

3

15

All correct for n: 1 mark All correct for sum: 1 mark (ii)

28 invalid card number

for ( i = 0; i < strlen(x); i++ ) if ( x[i] < '0' || x[i] > '9' ) flag = false; if ( !flag ) printf("Digits from \"0\" to \"9\" only!\n");

(c)

(d)

(1) (2)

if ( sum % 10 == 0 ) printf("Calculated check digit is 0\n"); else printf("Calculated check digit is %d\n", 10 - (sum % 10));

1 1 1 1 1

OR: printf("Calculated check digit is %d\n", (10 - (sum % 10)) % 10); 8.

#include <stdio.h> int main() { int NUM, COUNT, LOWER, UPPER; scanf("%d %d", &LOWER, &UPPER); NUM = LOWER; while ( NUM <= UPPER ) { COUNT = 2; while ( (NUM % COUNT) != 0 ) COUNT++; if ( NUM == COUNT ) printf("%d\n", NUM); NUM++; } return 0;

2

1 1 1 1 1 1 1 1 1 1

} 9.

(a)

char* secret fopen “r” feof(fp)

(b)

void init() { for ( i = 0; i < strlen(secret); i++ ) solution[i] = '*'; solution[strlen(secret)] = '\0'; noOfAttempts = 2 * strlen(secret);

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

0.5 0.5 0.5 0.5

1 1

} (c)

void letterGuess() { char inp[80]; printf("Please input the letter you guess: "); scanf("%s", inp); letter = inp[0]; for ( i = 0; i < strlen(secret); i++ ) if ( letter == secret[i] ) solution[i] = letter; printf("%s\n", solution); noOfAttempts--; printf("No. of attempts remaining = %d\n", noOfAttempts);

1 1 1 1

} (d)

10.

void winCheck() { if ( strcmp(solution, secret) == 0 || noOfAttempts == 0 ) done = true; }

1 1

(a)

trackball, touch screen, touch pad, trackpoint, joystick (any two)

1+1

(b)

(i)

Smart cards can be lost / counterfeited / stolen.

1

(ii)

fingerprint recognition voice recognition retina recognition (any two)

1+1

(i)

They want to withdraw / deposit cash.

1

(ii)

It is more secure.

1

(i)

ATM kiosk 4 and ATM kiosk 6

(ii)

optical fiber (fibre) / twisted pair / UTP (any one)

1

(iii)

Data sent across the data line is encrypted (encoded) into unreadable strings of messages.

1 1

The coded strings of messages are decrypted (decoded) at the receiving end.

1

(c)

(d)

(e)

Once the database in a district computer is updated, messages should be sent to other district computers for synchronizing the copies of the database. (update the databases in the other computers)

2

(f)

Customers will spend more time at the ATM kiosks in waiting the process. (loading) If the district computer C is out of order, all ATM kiosks cannot be operated. (reliability)

2 2

Effective communications: Relevance

0 / 1 /2

Language/Style correct and appropriate

0/1/2

0/1/2/3/4

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

Related Documents