AS computing

Cie AS Computing

Dear all,

            Welcome to AS computing class. I am Dr.Ravi your facilitator for this course. This course consists of two modules, theory and practicals. In theory we will have 12 chapters and in practicals we do have programming classes. You will sit for theory and practical exams at the end of the course, which is conducted by CIE.

All the best, keep moving, for there is always a helping hand above you to guide you.

Dr.Ravi

 

Views: 3404

Reply to This

Replies to This Discussion

1   A stock file in a warehouse has the following fields in each record.

 

• Name of item.

• Date of last delivery.

• Price of item.

• Whether or not an order is outstanding.

• Number of that item left in stock.

 

(i) State data types suitable for each of the fields.                                              [5]

 

(ii) Given that there are approximately 10000 different items in the warehouse, estimate the size of the stock file. You should clearly show all the stages in the calculation.            [5]

 

Answer: Q4 MJ 04 (b)

2   An algorithm has been produced which inputs two numerical values and outputs the larger one.  Select three pairs of numbers that could be used as test data. Explain what each pair of numbers is intended to test.                                                                                          [6]

 

Answer: Q3 MJ 02

 

 

3   The algorithms shown have both been written with the intention of printing out the even numbers from 2 to 10 inclusive.

 

A

X = 2

B

X = 2

 

WHILE X < > 10 DO

X = X + 2

OUTPUT X

ENDWHILE

END

 

REPEAT

X = X + 2

OUTPUT X

UNTIL X > 10

END

 

 

 

(a)  State the outputs from

 

(i) Algorithm A,

(ii) Algorithm B.                                                                                                         [2]

 

(b) Modify

 

(i) Algorithm A

(ii) Algorithm B

 

so that each will output the even numbers from 2 to 10 inclusive.                        [6]

 

Answer: Q3 on 02

            A: x = 0                                                            B: x = 0

                                                                                         Until x >= 10

Full implementation:

A

X = 0

B

X = 0

 

WHILE X < > 10 DO

X = X + 2

OUTPUT X

ENDWHILE

END

 

REPEAT

X = X + 2

OUTPUT X

UNTIL X >= 10

END

 

 

 

4   TOTAL = 10

REPEAT

READ K

IF K >= 2 THEN

TOTAL = TOTAL + K

ELSE

K= K* K

TOTAL = TOTAL + K

ENDIF

PRINT TOTAL

UNTIL K= 2

PRINT TOTAL

END

 

Write down the output produced by this code with the following input string

3, 5, 1, 2, 4, 0                                                                                                 [5]

Answer: Q3 ON 03

5 (a)    INPUT A, B

IF B = 0 THEN C = A

   ELSE C = A ÷ B

ENDIF

PRINT A, B

PRINT C

END

 

Write down the outputs produced by the algorithm if

 

(i) A = 8, B = 2                                                                                                            [4]

 

(ii) A = 6, B = 0                                                                                                           [4]

 

(b) An automatic fan is designed so that it turns on only when a person is in the room AND the temperature is above a set value (D).

 

The fan receives information from two sensors.

 

1. A motion sensor which returns a value (M) dependent upon a person being sensed in the room.

 

2. A thermistor (electronic thermometer) which returns the temperature in the room (T).

 

Produce an algorithm to control the fan.

Your algorithm may be expressed in any form.                                                              [8]

Answer: Q3 ON 06

 

6          D=1

INPUT X, E

B=E

C=E

FOR I = 1 TO (X-1)

INPUT A

IF A>B THEN B = A

ELSE IF A < C THEN C = A

END IF

END IF

D = D + 1

E = E + A

NEXT

F = E/D

OUTPUT B, C, F

END

 

(a) State the output values of B, C and F for the following input test data

 

                                           4, 6, 3, 7, 0                                                                                   [3]

 

(b) Give three other different sets of test data, explaining what condition each is meant to test.             [6]

Answer: Q6 MJ 07

7   A town election is held to elect a new mayor.

 

The people in the town can vote for whoever they prefer from the three candidates A, B, C.

 

The voting is done by each voter pressing one of a set of buttons labelled A, B and C in the voting booth. This acts as input to a computer program.  An early version of the software assumes that there are 1000 people who will be voting. It uses an array, VOTES() to store the votes that are cast. VOTES() is an array of 1000 characters, A, B or C.

 

A second array, CANDIDATE_TOTALS(), contains three integers and is used with the array, VOTES() in the following algorithm:

 

01 FOR i = 1 TO 1000

02   IF VOTES(i) = “A” THEN

03               CANDIDATE_TOTALS (1) = CANDIDATE_TOTALS (1) + 1

04               ELSE

05               IF VOTES(i) = “B” THEN

06                           CANDIDATE_TOTALS (2) = CANDIDATE_TOTALS (2) + 1

07                           ELSE

08                           CANDIDATE_TOTALS (3) = CANDIDATE_TOTALS (3) + 1

09               ENDIF

10   ENDIF

11 NEXT i

12 OUTPUT A,B,C

 

(a) (i) Explain why it will be necessary to initialise the array CANDIDATE_TOTALS () before the algorithm is run.                                                                                                        [2]

 

       (ii) Write a FOR loop which can be used to initialise the array CANDIDATE_TOTALS() at the start of the algorithm.                                                                                                        [2]

 

       (iii) Explain what happens when the program based on this algorithm is executed.

                                                                                                                                            [4]

 

       (iv) By stating the type of operator in each case, explain why the use of the ‘=’ signs in lines 2 and 3 are different.                                                                                                           [3]

 

       (v) Line 12 is meant to output the total votes for A, B and C. It does not work.

 

       Rewrite line 12 to produce the correct result.                                                      [2]

 


 

Answer: Q3 (a) Specimen Question

 (b) The following algorithm is written to determine which of A, B and C gets the highest vote.

 

01 IF CANDIDATE_TOTALS (1) > CANDIDATE_TOTALS (2) THEN

02        IF CANDIDATE_TOTALS (1) > CANDIDATE_TOTALS (3) THEN

03                    OUTPUT “A”

04                    ELSE

05                    OUTPUT “C”

06        ENDIF

07        ELSE

08        IF CANDIDATE_TOTALS (2) > CANDIDATE_TOTALS (3)THEN

09                    OUTPUT “B”

10                    ELSE

11                    OUTPUT “C”

12        ENDIF

13 ENDIF

 

(i)    Some people do not vote and the result of a particular vote is that all of A, B and C receive equal votes.

 

State the line numbers that will be executed by the algorithm and which of A, B or C will be output.                                                                                                                             [4]

 

(ii)   Explain how the algorithm would need to be altered to deal correctly with two or three of the candidates receiving equal votes. Do not produce the algorithm.                  [4]

 

Answer: Q3 (b) Specimen Question

 

 

 

 

Paper 2

75 marks

2 hour s

 

Paper 1

Attachments:

Paper 2

Attachments:

Dear AS computing Block 4 students,

                                                              I was spell bound after correcting your paper 1 and paper 2 trial exam papers. I feel most of you now can have my predicted grades when you meet me.

Now this is your trial exam result grades..

Afifah - A

Mujahid - D

Naida - C

Rajkumar - C

Muhammad Amir - B

Nurul Asmira - B

Syahmi  D

Dain  B

Asyraf B

Congratulation for making me proud.

God Bless.

Dr.Ravi

Rajkumar,

                    Thanks for providing answers for the Trial exam. However, i wish to talk to each one of you on your major mistakes and blunders that you have done in the exam paper , one by one, during our triple block.

I think now only God should help you to get good grades. I have given my best and I have tried all styles to coach you, either you are too over confident or you are not studying at all and think you can get a A grade without putting on any effort.

My predicted grades are very very poor and I think, with my predicted grades, only one or two student would get A grades.

I am just sharing my thought.

Dr.Ravi

Trace the following programming segment.

input a,b
while i < 15
i = i + 1
if i > 5 then s = s + i else i = i + b
s = s + a
print i

wend
print i,s

Difference in ROM and RAM

Attachments:

notes

Attachments:

AS computing Final class test April 24th 2012

 

1         Write the syntax for declaring a two dimensional array    (2 marks)

2         Write the programming codes that would accept ten names and store the length of each accepted names in a single dimensional array. (8)

3         (a) Find the errors (if any) in the following programming codes and (b) find the output of the following programme, assuming that there is no errors in this programme.

 

Dim a(10) As Integer

For i = 0 To 10

a(i) = i

Next i

While i > 10

i = i - 1

a(i) = a(i) + i

Wend

Print a(i)

End

 

4         Write the syntax for For … Next  nested loop  with a valid example (8)

 

5         Modify the following programme to get this output:

1                                        1

2                                        2

3                                        3

4                                        4

5                                        5

 Hint: the comma in the print statement given below is used to print the output apart by a zone

 

Programme code:

For I = 1 To 2

For j = 1 To 5

Print i,

Next I

Print J

Next I                                                                              (10)

 

 

6         Write a Programme code to split the letters “ 123” from this string “ABDFD@123$ADF”

(5)

7         Write programming code to reverse a given string without using MiD$ function

(5)

 

 

 

 

8         Convert the following programming segment without using For…Next loop

 

For I = 1 to 3

For j = 1 to 2

If I = j then 40

S  = S + j

40 Next J

Next  I

Connected Learning

hello dr ravi..

can you give a accurate definition  1 .for indexed sequential file

and if they ask to give example of serial file should i write in backup of file or in the transaction log of backup files

Amir, hope I can help...

Best example for a serial file is the transaction log....u need to be specific

For indexed sequential....i cant find a proper 'definition' but to explain it:

Indexed sequential is a type of file organisation where the data needed is 1st looked up in an index, which narrows the search. The data are then searched in sequence until the required data is found.

Then give an example. Like searching a name 'Jamal' in an indexed sequential file tht is sorted in alphabetical order

Reply to Discussion

RSS

© 2025   Created by Ravichandran.   Powered by

Report an Issue  |  Terms of Service