o level computer science 2210 pre-released material practice question paper for june 2015l - solved

Upload: tanvir-khan

Post on 06-Oct-2015

886 views

Category:

Documents


1 download

DESCRIPTION

The O level computer science pre-released material for CIE exams 2015 is free and one should not be paid even a single penny for it.contact: +923212490887

TRANSCRIPT

  • 5/21/2015

    Prepared By: | Tanvir Iqbal Khan

    O LEVEL COMPUTER

    SCIENCE 2210

    PRACTICE PAPER OF PRE-RELEASED MATERIAL 2015

  • Pag

    e1

    SYLLABUS CODE: 22101/01

    O LEVEL COMPUTER SCIENCE

    Author: Tanvir Iqbal Khan Subject Specialist O Level Computer Science

    A Level Computing

    Website: sirtanviriqbalkhan.tk Facebook: www.facebook.com/tanvirik

    Email: [email protected] PHONE: +923212490887

    You are advised to spend no longer than 40 minutes answering this section. Here is a copy of the pre-release material. DO NOT attempt Tasks 1, 2 and 3 now. Use the pre-release material and your experience from attempting the tasks before the examination to answer Section A Question 1.

    TASK 1

    A school keeps records of the weights of each pupil. The weight, in kilograms, of each pupil is

    recorded on the first day of term. Input and store the weights and names recorded for a class of

    30 pupils.

    You must store the weights in a one-dimensional array and the names in another one-

    dimensional array.

    All the weights must be validated on entry and any invalid weights rejected. You must decide

    your own validation rules. You may assume that the pupils names are unique. Ouput the names

    and weights of the pupils in the class.

    TASK 2

    The weight, in kilograms, of each pupil is recorded again on the last day of term. Calculate and

    store the difference in weight for each pupil.

    TASK 3

    For those pupils who have a difference in weight of more than 2.5 kilograms, output, with a

    suitable message, the pupils name, the difference in weight and whether this is a rise or fall.

    Your program must include appropriate prompts for the entry of data. Error messages and other

    outputs need to be set out clearly and understandably. All variables, constants and other

    identifiers must have meaningful names. Each task must be fully tested.

  • Pag

    e2

    SYLLABUS CODE: 22101/01

    O LEVEL COMPUTER SCIENCE

    Author: Tanvir Iqbal Khan Subject Specialist O Level Computer Science

    A Level Computing

    Website: sirtanviriqbalkhan.tk Facebook: www.facebook.com/tanvirik

    Email: [email protected] PHONE: +923212490887

    O LEVEL COMPUTER SCIENCE CIE EXAM 2015

    PRE-RELEASED MATERIAL: PAPER 2

    SOLUTION: Algorithm

    1. Set Name =

    2. Set NameCount = 0

    3. Set WeightFirstDay = 0

    4. Set WeightCountFirstDay = 0

    5. Set WeightLastDay = 0

    6. Set WeightCountLastDay = 0

    7. Set WeightDifference = 0

    8. Set WeightDifferenceCount = 0

    9. For PupilCount = 1 to 30

    10. Print Enter Pupils Name

    11. Input Name

    12. NameCount(PupilCount) = Name

    13. Print Pupils First day weight

    14. Input WeightFirstDay

    15. If WeightFirstDay > 15 AND WeightFirstDay < 100 Then

    16. WeightCountFirstDay (PupilCount) = WeightFirstDay

    17. Else

    18. Print Invalid Weight

    19. Input WeightFirstDay

    20. WeightCountFirstDay (PupilCount) = WeightFirstDay

    21. End If

    22. Next PupilCount

    Initialization of Variables

    Loop for First Day Name & Weight if 30 Students

    Data Validation for Invalid Weight

  • Pag

    e3

    SYLLABUS CODE: 22101/01

    O LEVEL COMPUTER SCIENCE

    Author: Tanvir Iqbal Khan Subject Specialist O Level Computer Science

    A Level Computing

    Website: sirtanviriqbalkhan.tk Facebook: www.facebook.com/tanvirik

    Email: [email protected] PHONE: +923212490887

    23. For PupilCount = 1 to 30

    24. Print Enter Pupils last day weight"

    25. Input WeightLastDay

    26. WeightCountLastDay (PupilCount) = WeightLastDay

    27. WeightDifference = WeightLastDay (PupilCount) WeightCountFirstDay (PupilCount)

    28. WeightDifferenceCount (PupilCount) = WeightDifference

    29. If WeightDifferenceCount (PupilCount) > 2.5 Then

    30. Print NameCount (PupilCount), WeightDifferenceCount (PupilCount), Rise in Weight

    31. Else if WeightCountLastDay(PupilCount) < WeightCountFirstDay (PupilCount)

    32. Print NameCount (PupilCount), WeightDifferenceCount (PupilCount), Fall in Weight

    33. Else If WeightDifference = 0 or WeightDifference < 2.5 Then

    34. Print NameCount (PupilCount), WeightCountFirstDay (PupilCount)

    35. End If

    36. Next PupilCount

    Loop For Input Weight For Last Day

    Equation is used to calculate Weight Difference between First Day & Last Day

    Data Validation For Weight Difference if more than 2.5 Kilogram

    Display appropriate message along with Name & Weight Difference if Weight Difference is

    found more than 2.5 Kilogram on last day

    Display Students Name whose Weight difference is same as First Day

  • Pag

    e4

    SYLLABUS CODE: 22101/01

    O LEVEL COMPUTER SCIENCE

    Author: Tanvir Iqbal Khan Subject Specialist O Level Computer Science

    A Level Computing

    Website: sirtanviriqbalkhan.tk Facebook: www.facebook.com/tanvirik

    Email: [email protected] PHONE: +923212490887

    SOLUTION: Programming Language (Visual Basic 6.0)

    Dim StudentName(1 To 3) As String Dim StudentWeight(1 To 3) As Single Dim WeightDifference(1 To 3) As Single Dim STName As String Dim count, Weight, Difference, PreviousWeight As Single STName = "" count = 0 Weight = 0 Difference = 0 PreviousWeight = 0

    For count = 1 To 30 STName = InputBox("Enter Student Name", "First day of the term") StudentName(count) = STName Weight = InputBox("Enter Student Weight in KG", "First day of the term")

    If Weight > 10 And Weight

  • Pag

    e5

    SYLLABUS CODE: 22101/01

    O LEVEL COMPUTER SCIENCE

    Author: Tanvir Iqbal Khan Subject Specialist O Level Computer Science

    A Level Computing

    Website: sirtanviriqbalkhan.tk Facebook: www.facebook.com/tanvirik

    Email: [email protected] PHONE: +923212490887

    For count = 1 To 30

    PreviousWeight = StudentWeight(count)

    Weight = InputBox("Enter Student Weight in KG", "Last day of the term") StudentWeight(count) = Weight

    Difference = Val(StudentWeight(count)) - Val(PreviousWeight) WeightDifference(count) = Difference

    If Val(WeightDifference(count)) >= 2.5 Then MsgBox StudentName(count) & " has gained " & WeightDifference(count) & "KG", , "Last day of the term" ElseIf Val(WeightDifference(count))

  • Pag

    e6

    SYLLABUS CODE: 22101/01

    O LEVEL COMPUTER SCIENCE

    Author: Tanvir Iqbal Khan Subject Specialist O Level Computer Science

    A Level Computing

    Website: sirtanviriqbalkhan.tk Facebook: www.facebook.com/tanvirik

    Email: [email protected] PHONE: +923212490887

    1. (a) All variables, constants and other identifiers should have meaningful names.

    (i) Declare the array to store the students names.

    ............................................................................................................................. ..

    (ii) Declare the arrays to store each students weight and weight difference.

    ............................................................................................................................. ..

    ............................................................................................................................. ..

    (b) (i) Show the design of your algorithm to complete Task 1 and Task 2 using pseudocode, programming statements or a flowchart. Do not include any of the validation checks in your algorithm. ....................................................................................................................................

    ............................................................................................................................. .......

    ....................................................................................................................................

    ............................................................................................................................. .......

    ....................................................................................................................................

    ............................................................................................................................. .......

    ............................................................................................................................. .......

    ....................................................................................................................................

    ............................................................................................................................. .......

    ....................................................................................................................................

    ............................................................................................................................. .......

    ....................................................................................................................................

    ............................................................................................................................. .......

    ....................................................................................................................................

    ............................................................................................................................. .......

    ....................................................................................................................................

    ............................................................................................................................. .......

    For Examiners

    Use

    [8]

    TANVEERTypewritten Text1.Set Name = , Set NameCount = 0, Set WeightFirstDay = 0, Set WeightCountFirstDay = 02.Set WeightLastDay = 0, Set WeightCountLastDay = 0, Set WeightDifference = 03.Set WeightDifferenceCount = 0

    TANVEERTypewritten Text

    TANVEERTypewritten Text

    TANVEERTypewritten Text

    TANVEERTypewritten Text

    TANVEERTypewritten Text

    TANVEERTypewritten Text

    TANVEERTypewritten Text

    TANVEERTypewritten Text

    TANVEERTypewritten Text

    TANVEERTypewritten Text4.For PupilCount = 1 to 305.Print Enter Pupils Name, Input Name 7.NameCount(PupilCount) = Name8.Print Pupils First day weight, Input WeightFirstDay10.Next PupilCount

    TANVEERTypewritten Text

    TANVEERTypewritten Text

    TANVEERTypewritten Text

    TANVEERTypewritten Text

    TANVEERTypewritten Text

    TANVEERTypewritten Text

    TANVEERTypewritten Text

    TANVEERTypewritten Text11.For PupilCount = 1 to 3012.Print Enter Pupils last day weight"13.Input WeightLastDay14.WeightCountLastDay (PupilCount) = WeightLastDay

    TANVEERTypewritten Text

    TANVEERTypewritten Text

    TANVEERTypewritten Text15.WeightDifference = WeightLastDay (PupilCount) WeightCountFirstDay (PupilCount)16.WeightDifferenceCount (PupilCount) = WeightDifference

    TANVEERTypewritten Text

    TANVEERTypewritten Text

    TANVEERTypewritten Text

    TANVEERTypewritten Text

    TANVEERTypewritten Text29.If WeightDifferenceCount (PupilCount) > 2.5 Then

    TANVEERTypewritten Text

  • Pag

    e7

    SYLLABUS CODE: 22101/01

    O LEVEL COMPUTER SCIENCE

    Author: Tanvir Iqbal Khan Subject Specialist O Level Computer Science

    A Level Computing

    Website: sirtanviriqbalkhan.tk Facebook: www.facebook.com/tanvirik

    Email: [email protected] PHONE: +923212490887

    (ii) Comment on the efficiency of your design.

    ............................................................................................................................. .......

    ....................................................................................................................................

    ............................................................................................................................. .......

    (c) Show two different sets of student data that you could use to check the validation

    used in Task 1. Explain why you chose each data set.

    Set 1.............................................................................................................................

    Reason for choice.........................................................................................................

    ............................................................................................................................. .......

    ....................................................................................................................................

    Set 2.............................................................................................................................

    Reason for choice.........................................................................................................

    ............................................................................................................................. .......

    ....................................................................................................................................

  • Pag

    e8

    SYLLABUS CODE: 22101/01

    O LEVEL COMPUTER SCIENCE

    Author: Tanvir Iqbal Khan Subject Specialist O Level Computer Science

    A Level Computing

    Website: sirtanviriqbalkhan.tk Facebook: www.facebook.com/tanvirik

    Email: [email protected] PHONE: +923212490887

    (d) (i) Explain how you select the student with the Weight rise or Weight fall (Task 3).

    You may include pseudocode or programming statements to help illustrate your

    explanation.

    ............................................................................................................................. .......

    ....................................................................................................................................

    ............................................................................................................................. .......

    ....................................................................................................................................

    ............................................................................................................................. .......

    ............................................................................................................................. .......

    ....................................................................................................................................

    ............................................................................................................................. .......

    ....................................................................................................................................

    ............................................................................................................................. .......

    ....................................................................................................................................

    ............................................................................................................................. .......

    ....................................................................................................................................

    ............................................................................................................................. .......

    (ii) How does your program work when there is weight of a student having no change? Explain using your method given in part (d)(i).

    ............................................................................................................................. .......

    ....................................................................................................................................

    ............................................................................................................................. .......

  • Pag

    e9

    SYLLABUS CODE: 22101/01

    O LEVEL COMPUTER SCIENCE

    Author: Tanvir Iqbal Khan Subject Specialist O Level Computer Science

    A Level Computing

    Website: sirtanviriqbalkhan.tk Facebook: www.facebook.com/tanvirik

    Email: [email protected] PHONE: +923212490887

    2. A golf course charges $10 for each game of two people. Each additional person incurs a

    further charge of $2 per game. If they book two or more games in advance, they get a

    10% discount on the total charge.

    The following program has been written in pseudocode to calculate the charges for a

    game.

    1 extracost = 0

    2 input numberpeople, numbergames

    3 charge = 10 * numbergames

    4 extrapeople = numberpeople 2

    5 if numberpeople < 2 then extracost = 2 * extrapeople * numbergames

    6 charge = extracost

    7 if numbergames > 1 then charge = charge * 0.1

    8 print charge

    There are three errors in the program. Locate these errors and suggest a correct piece

    of coding.

    Error 1..........................................................................................................................

    ............................................................................................................................. .......

    Correction 1..................................................................................................................

    ............................................................................................................................. .......

    Error 2..........................................................................................................................

    ............................................................................................................................. .......

    Correction 2..................................................................................................................

    ............................................................................................................................. .......

    Error 2..........................................................................................................................

    ............................................................................................................................. .......

    Correction 2..................................................................................................................

    ............................................................................................................................. .......

    (b) What type of validation check is being carried in line number 5 and 7?

    ............................................................................................................................. .......

  • Pag

    e10

    SYLLABUS CODE: 22101/01

    O LEVEL COMPUTER SCIENCE

    Author: Tanvir Iqbal Khan Subject Specialist O Level Computer Science

    A Level Computing

    Website: sirtanviriqbalkhan.tk Facebook: www.facebook.com/tanvirik

    Email: [email protected] PHONE: +923212490887

    3. (a) The following pseudocode was written to input 1000 dates.

    1 count = 1

    2 repeat

    3 input day, month, year

    4 count = count + 1

    5 until count = 1000

    (i) Describe why the loop only inputs 999 dates instead of 1000.

    .....................................................................................................................

    .....................................................................................................................

    .................................................................................................................. [1]

    (ii) What needs to be changed or added to the above code to make sure 1000

    dates are input?

    .....................................................................................................................

    .....................................................................................................................

    ..................................................................................................................[1]

    (b) Errors in code can be found using test data.

    Name three different types of test data. Using month from the pseudocode above,

    give an example of each type of test data.

    test data type 1....

    example .....

    .....

    test data type 2....

    example .....

    .....

    test data type 3....

    example .....

    ... [6]

  • Pag

    e11

    SYLLABUS CODE: 22101/01

    O LEVEL COMPUTER SCIENCE

    Author: Tanvir Iqbal Khan Subject Specialist O Level Computer Science

    A Level Computing

    Website: sirtanviriqbalkhan.tk Facebook: www.facebook.com/tanvirik

    Email: [email protected] PHONE: +923212490887

    4. A piece of pseudocode was written to input 1000 positive numbers and then output the

    highest and lowest numbers.

    10 highest = 0

    20 lowest = 0

    30 for count = 1 to 100

    40 input number

    50 if number > highest then number = highest

    60 if number < lowest then number = lowest

    70 count = count + 1

    80 next count

    90 print highest, lowest

    There are errors in the code.

    Locate these errors and suggest a correction.

    Error 1..

    .

    .

    Correction.

    .

    .

    Error 2..

    .

    .

    Correction.

    .

    .

    Error 3..

  • Pag

    e12

    SYLLABUS CODE: 22101/01

    O LEVEL COMPUTER SCIENCE

    Author: Tanvir Iqbal Khan Subject Specialist O Level Computer Science

    A Level Computing

    Website: sirtanviriqbalkhan.tk Facebook: www.facebook.com/tanvirik

    Email: [email protected] PHONE: +923212490887

    .

    .

    Correction.

    .

    .

    Error 4..

    .

    .

    Correction.

    .

    [8]

  • Pag

    e13

    SYLLABUS CODE: 22101/01

    O LEVEL COMPUTER SCIENCE

    Author: Tanvir Iqbal Khan Subject Specialist O Level Computer Science

    A Level Computing

    Website: sirtanviriqbalkhan.tk Facebook: www.facebook.com/tanvirik

    Email: [email protected] PHONE: +923212490887

    5. The following flowchart inputs ten temperatures and outputs the average (mean)

    temperature and the number of temperatures which were negative (i.e. < 0).

  • Pag

    e14

    SYLLABUS CODE: 22101/01

    O LEVEL COMPUTER SCIENCE

    Author: Tanvir Iqbal Khan Subject Specialist O Level Computer Science

    A Level Computing

    Website: sirtanviriqbalkhan.tk Facebook: www.facebook.com/tanvirik

    Email: [email protected] PHONE: +923212490887

    (a) Complete the trace table for this flowchart using the following test data:

    5, 11, 16, -4, -10, 8, 10, -3, 17, 10

    (b) What values are outputs from the flowchart using the above test data?

    ..[1]

  • Pag

    e15

    SYLLABUS CODE: 22101/01

    O LEVEL COMPUTER SCIENCE

    Author: Tanvir Iqbal Khan Subject Specialist O Level Computer Science

    A Level Computing

    Website: sirtanviriqbalkhan.tk Facebook: www.facebook.com/tanvirik

    Email: [email protected] PHONE: +923212490887

    6. A floor turtle uses the following commands:

    In the following grid, each of the squares represents 10 cm by 10 cm:

  • Pag

    e16

    SYLLABUS CODE: 22101/01

    O LEVEL COMPUTER SCIENCE

    Author: Tanvir Iqbal Khan Subject Specialist O Level Computer Science

    A Level Computing

    Website: sirtanviriqbalkhan.tk Facebook: www.facebook.com/tanvirik

    Email: [email protected] PHONE: +923212490887

    Complete the set of instructions to draw the shape shown on the left:

    1 PENDOWN

    2 LEFT 90

    3 REPEAT 2

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    16

    17

    18

    19

    20

    21

    22

    23

    24

    25

    [6]

  • Pag

    e17

    SYLLABUS CODE: 22101/01

    O LEVEL COMPUTER SCIENCE

    Author: Tanvir Iqbal Khan Subject Specialist O Level Computer Science

    A Level Computing

    Website: sirtanviriqbalkhan.tk Facebook: www.facebook.com/tanvirik

    Email: [email protected] PHONE: +923212490887

    7. A shop keeps its stock file on a computer system. Part of the file is shown in the diagram

    below:

    The following codes have been used.

    B = Black G = Green R = Red S = Silver

    (a) State how many records are shown in the diagram.

    .............................................................................................................................................. [1]

    (b) State two advantages of coding the data in the COLOUR field.

    1. ...............................................................................................................................................

    2. ..

    .*2]

    (c) State the data type that should be used for the WEIGHT (KG) data.

    ................................................................................................................................................[1]

    (d) State one advantage of using fixed-length records for storing the data.

    ...............................................................................................................................................[1]

    (e) Which STOCK NO data will be listed if the following search condition is input?

    (COLOUR NOT B) AND (WEIGHT (KG) < 2.0)

    ......................................................................................................................................................[2]

  • Pag

    e18

    SYLLABUS CODE: 22101/01

    O LEVEL COMPUTER SCIENCE

    Author: Tanvir Iqbal Khan Subject Specialist O Level Computer Science

    A Level Computing

    Website: sirtanviriqbalkhan.tk Facebook: www.facebook.com/tanvirik

    Email: [email protected] PHONE: +923212490887

    (f) Write down a search condition that will search for all the items with less than 16 in

    stock and the price is more than $100.

    ..................................................................................................................................................... [3]

    (g) State which field should be used to link this stock file to a supplier file. Give a reason

    for your choice of field.

    Field..................................................................................................................................................

    Reason.............................................................................................................................................

    ......................................................................................................................................................[2]

  • Pag

    e19

    SYLLABUS CODE: 22101/01

    O LEVEL COMPUTER SCIENCE

    Author: Tanvir Iqbal Khan Subject Specialist O Level Computer Science

    A Level Computing

    Website: sirtanviriqbalkhan.tk Facebook: www.facebook.com/tanvirik

    Email: [email protected] PHONE: +923212490887

    VERY IMPORTANT:

    Students are strongly advised to follow instructions written below.

    1. Practice on each section of the algorithm of page 2 of this Pre-released materials

    Practice Question Paper

    2. Practice on topic Program flowchart of Past Papers (2011 2014 all May and October

    papers) from previous syllabus Computer Studies 7010.

    3. Practice on topic Logo Programming of Past Papers (2011 2014 all May and October

    papers) from previous syllabus Computer Studies 7010.

    4. Practice on topic Database of Past Papers (2011 2014 all May and October papers)

    from previous syllabus Computer Studies 7010.

    Your valued & precious feedback and suggestions are always appreciated.

    GOOD LUCK!

    Sir Tanvir Khan