Friday, April 7, 2017

Random Number: Program code ( visual basic )

Computer Science(9608) notes and Resources






Program that randomly generates number from 1 to 100 both inclusive. 




Module Module1

    Sub Main()
        Randomize()
        Dim Temp As Integer
        For i = 1 To 4
            Temp = Int(Rnd() * 100) + 1
            Console.WriteLine(Temp)
        Next
        Console.ReadLine()
    End Sub

End Module





Module Module1

    Sub Main()

        Dim temp As New Random
        Dim num As Integer
        For counter = 1 To 50
            num = temp.Next(1, 101)
            Console.WriteLine(num)
        Next
        Console.ReadLine()
    End Sub

End Module





Dictionary: Program code ( visual basic )



Computer Science(9608) notes and Resources






Implementing a dictionary using Dictionary class in Visual Basic





Module Module1

    Dim dictionary As New Dictionary(Of String, Integer)


    Sub InsertInDictionary(ByVal key As String, ByVal value As Integer)
        If dictionary.ContainsKey(key) Then
            Console.WriteLine(" Key alreadly exist! ")
        Else
            dictionary.Add(key, value)
        End If

    End Sub



    Sub findInDictionary(ByVal key As String)
        If dictionary(key) Then
            Console.WriteLine(" Found and its value is: " & dictionary(key))
        Else
            Console.WriteLine(" Not Found ")
        End If
    End Sub



    Sub removeFromDictionary(ByVal key As String)
        dictionary.Remove(key)
    End Sub



    Sub printValueInDictionary(ByVal key As String)
        Console.WriteLine(dictionary(key))
    End Sub



    Sub printNoOfEntriesInDictionary()
        Console.WriteLine(dictionary.Count)
    End Sub



    Sub printDictionary()
        Dim pair As KeyValuePair(Of String, Integer)

        For Each pair In dictionary

            Console.WriteLine("{0}, {1}", pair.Key, pair.Value)
        Next
    End Sub



    Sub Main()
        Console.WriteLine(" Inserting 4 items in dictionary")
        InsertInDictionary("John", 10)
        InsertInDictionary("maria", 90)
        InsertInDictionary("sofia", 50)
        InsertInDictionary("Mia Kalifa", 69)
        Console.WriteLine()
        Console.Write(" Value of key sofia: ")
        printValueInDictionary("sofia")
        Console.WriteLine()
        Console.Write(" Number of items in dictionary: ")
        printNoOfEntriesInDictionary()
        Console.WriteLine()
        Console.WriteLine(" Remove one item from dictionary")
        removeFromDictionary("Mia Kalifa")
        Console.WriteLine()
        Console.WriteLine(" Print whole dictionary")
        printDictionary()
        Console.WriteLine()
        Console.WriteLine(" find an item:")
        findInDictionary("sofia")
        Console.ReadLine()

    End Sub



End Module




                                                                                                         - CIE A-LEVEL COMPUTER SCIENCE (  9608 )

Linked List: Program code ( visual basic )

Computer Science(9608) notes and Resources





Linked List: A linked list is a data structure that provides links between data items. The data items are in an arranged order in the linked list.






 Implementation of Linked List in Visual basic.






Module Module1

    Dim Itemlist(4) As ListNode
    Dim headpointer, freepointer As Integer
    Dim nextFreeAddress As Integer
    Dim currentPointer, previousPointer As Integer



    Structure ListNode
        Dim name As String
        Dim pointer As Integer
    End Structure



    Sub Main()
        createLinkedList()
        additem("apple")
        additem("orange")
        additem("grapes")
        additem("banana")


        Console.WriteLine(" Printing items of linked list: ")
        Console.WriteLine(Itemlist(headpointer).name)
        Console.WriteLine(Itemlist(Itemlist(headpointer).pointer).name)
        Console.WriteLine(Itemlist(Itemlist(Itemlist(headpointer).pointer).pointer).name)
        Console.WriteLine(Itemlist(Itemlist(Itemlist(Itemlist(headpointer).pointer).pointer).pointer).name)


        Console.WriteLine(" Removing items: ")
        removeitem("orange")
        removeitem("apple")



        Console.WriteLine("  Adding items: ")
        additem("coconut")
        additem("potato")


        Console.WriteLine(" Printing items of linked list: ")
        Console.WriteLine(Itemlist(headpointer).name)
        Console.WriteLine(Itemlist(Itemlist(headpointer).pointer).name)
        Console.WriteLine(Itemlist(Itemlist(Itemlist(headpointer).pointer).pointer).name)
        Console.WriteLine(Itemlist(Itemlist(Itemlist(Itemlist(headpointer).pointer).pointer).pointer).name)


        Console.WriteLine()
        Console.Write(" Type an item be searched: ")
        Dim itemSearch As String
        itemSearch = Console.ReadLine()
        searchItem(itemSearch)
        Console.ReadLine()



    End Sub



    Sub createLinkedList()
        For index = 1 To 4
            Itemlist(index).pointer = index + 1
        Next

        Itemlist(4).pointer = 0
        freepointer = 1
        headpointer = 0
    End Sub




    Sub removeitem(ByVal newItem As String)
        Dim found As Boolean = False
        currentPointer = headpointer
        If Itemlist(currentPointer).name = newItem Then
            headpointer = Itemlist(currentPointer).pointer
            Itemlist(currentPointer).pointer = freepointer
            freepointer = currentPointer
            found = True
        Else
            While currentPointer <> 0 And found = False
                previousPointer = currentPointer
                currentPointer = Itemlist(currentPointer).pointer
                If Itemlist(currentPointer).name = newItem Then
                    Itemlist(previousPointer).pointer = Itemlist(currentPointer).pointer
                    Itemlist(currentPointer).pointer = freepointer
                    freepointer = currentPointer
                    found = True
                End If
            End While
        End If
        If found = False Then
            Console.WriteLine(" Item to be deleted not found in linked list!")
        End If
    End Sub




    Sub searchItem(ByVal newItem As String)
        Dim found As Boolean = False
        currentPointer = headpointer
        While currentPointer <> 0 And found = False
            If Itemlist(currentPointer).name = newItem Then
                Console.WriteLine(newItem & " is found at address: " & CStr(currentPointer) & " and it points to the node at adress: " & CStr(Itemlist(currentPointer).pointer))
                found = True
            End If
            currentPointer = Itemlist(currentPointer).pointer
        End While

        If found = False Then
            Console.WriteLine(" Item not found in linked List! ")
        End If
    End Sub




    Sub additem(ByVal newItem As String)
        If freepointer <> 0 Then
            Itemlist(freepointer).name = newItem
            nextFreeAddress = Itemlist(freepointer).pointer

            currentPointer = headpointer
            While Itemlist(currentPointer).name < newItem And currentPointer <> 0
                previousPointer = currentPointer
                currentPointer = Itemlist(currentPointer).pointer
            End While

            If currentPointer = headpointer Then
                Itemlist(freepointer).pointer = headpointer
                headpointer = freepointer
            Else
                Itemlist(freepointer).pointer = currentPointer
                Itemlist(previousPointer).pointer = freepointer
            End If
            freepointer = nextFreeAddress
        Else
            Console.WriteLine(" There is no free space! ")
        End If
    End Sub



End Module



                                                                                                         - CIE A-LEVEL COMPUTER SCIENCE (  9608 )


Queue: Program code ( visual basic )

Computer Science(9608) notes and Resources




Queue: A Queue has a First in First Out ( FIFO ) data structure, i.e, the first element to enter would be the first one to be processed.




Implementation of Queue in Visual basic.





Module Module1

    Dim ListQueue(4) As String
    Dim FrontOfQueuePointer, EndOfQueuePointer, count As Integer


    Sub Main()
        createEmptyQueue()
        insertIntoQueue("dog")
        insertIntoQueue("cat")
        insertIntoQueue("elephant")
        insertIntoQueue("lion")
        Console.ReadLine()

        Console.WriteLine(" Items in queue: ")

        For count = EndOfQueuePointer To FrontOfQueuePointer Step -1
            Console.WriteLine(ListQueue(count))
        Next

        Console.ReadLine()


        Console.WriteLine()
        Console.WriteLine(" Remove one item form Queue:")
        Console.WriteLine()
        removeFromQueue()
        Console.WriteLine()
        Console.ReadLine()


        Console.WriteLine(" Insert an item into Queue:")
        insertIntoQueue("tiger")
        Console.WriteLine()
        Console.ReadLine()


        Console.WriteLine(" Search an item in queue: ")
        findItem("cat")
        Console.WriteLine()
        Console.ReadLine()


        Console.WriteLine(" Items in queue: ")
        For count = EndOfQueuePointer To FrontOfQueuePointer Step -1
            Console.WriteLine(ListQueue(count))
        Next
        Console.ReadLine()

    End Sub




    Sub createEmptyQueue()
        FrontOfQueuePointer = 0
        EndOfQueuePointer = 0
    End Sub




    Sub insertIntoQueue(ByVal item As String)
        If EndOfQueuePointer = ListQueue.Length() - 1 Then
            Console.WriteLine()
            Console.WriteLine("Overflow: Can't insert item, queue is full")
            Console.WriteLine(item & " is not inserted into Queue")
        Else
            If FrontOfQueuePointer = 0 And EndOfQueuePointer = 0 Then
                EndOfQueuePointer = 1
                FrontOfQueuePointer = 1
            Else
                EndOfQueuePointer = EndOfQueuePointer + 1
            End If
            ListQueue(EndOfQueuePointer) = item
            Console.WriteLine(item & " has been inserted into Queue")
        End If
    End Sub



    Sub removeFromQueue()
        Dim item As String
        If FrontOfQueuePointer = 0 Then
            Console.WriteLine("Underflow: Can't delete, queue is empty")
        Else
            item = ListQueue(FrontOfQueuePointer)
            If FrontOfQueuePointer = EndOfQueuePointer Then
                FrontOfQueuePointer = 0
                EndOfQueuePointer = 0
            Else
                FrontOfQueuePointer = FrontOfQueuePointer + 1
            End If
            Console.WriteLine(item & " has been deleted")
        End If
    End Sub



    Sub findItem(ByVal paraSearchItem As String)
        For count = EndOfQueuePointer To FrontOfQueuePointer Step -1
            If ListQueue(count) = paraSearchItem Then
                Console.WriteLine(paraSearchItem & " is found at position: " & count)
            End If
        Next
    End Sub
End Module



                                                                                                         - CIE A-LEVEL COMPUTER SCIENCE (  9608 )


Computer Science (9608), Paper 2 notes, Theory Portion

Computer Science(9608) notes and Resources




For pdf version of this note, click here

1.      Explain about Identifier and Variable. How identifier and variable is different? List down the points.

Identifier: The name we use to call a particular entity in a program, which is not a keyword, is called identifier.
i. Identifier is used to name a variable, function, class, structure, union, etc.
ii. It is created to give unique name to an entity.
iii. All identifiers are not variable.

Variable: The name given to a distinct memory location which contains a value which may be modified while program gets executed is variable.
i.  A variable is used to name a memory location, which holds a value.
ii.  Allots a unique name to a particular memory location.
iii.  All variables names are identifiers.







2. What is Algorithm and flowchart? What is pseudo-code? Why pseudo code is used?

Algorithm: An algorithm is a well-defined procedure that allows a computer to solve a program. It is step-by-step solution to a program.


Flowchart: Flowchart is a graphical representation of the sequential steps in an algorithm.


Pseudo code: It is a method to represent algorithm. Pseudo code is not an actual programming language. It uses short phrases to write code for programs before you actually create it in specified languages. Pseudo code is for programmers own convenience and thus no standard syntax are followed.






3. Difference between Procedure and Function. Explain about the types of passing parameters type.    

i. a function returns a value whereas a procedure may or may not return a value or may return more than one value using the output parameters. 

ii. Functions are normally used for computations whereas procedures are normally used for executing business logic.


iii. Procedure is a bundle of code, it does not have return type whereas function have return type.

iv. Procedure accepts input or output parameters but function only accepts input parameters.


Passing parameters type:

By value ( byVal ): the actual value is passed into the procedure.
By reference ( byRef ): the address of the variable is passed into the procedure.







4. What is an array? List down its advantages and disadvantages. Also, explain about the types of an array.

 Array: An array is the combination of homogeneous elements with consecutive index number and successive memory locations. The values of an array are called elements of that array. 


Advantages of array:

i. Microprocessor takes time to search values stored on dispersed location but due to array    values become is sequence, so searching process of microprocessor become fast.
ii. It is used to represent multiple data items of same type by using single identifier name.
iii. It can be used to implement other data structure like linked lists, stacks, queues, trees, etc.


Disadvantage of an array:
               The elements of an array are stored in consecutive memory locations. So, insertion and deletions are very difficult and time consuming.


Types of an array:

i. One dimensional array ( 1D ) : It represents and store data in linear form. One dimensional array is a structured collection of component that can be accessed individually by specifying the position of a component with a single index value. One subscript is needed to represent each element in 1D array.

ii. Two dimensional array ( 2D ) : It represents and store data in matrix form. Two dimensional array is a structured collection of component that can be accessed individually by specifying the position of a component with two index value. Two subscripts are needed to represent each element in 2D array.






5. What is step-wise refinement, top-down design and structure chart? Explain with appropriate figures about the diagrams used in structure chat.

Step-wise refinement: A way of developing a computer program by first describing general functions, then breaking each function down into details which are refined in successive steps until the whole program is fully defined is step-wise refinement.


Top-down design: An approach in which design begins by specifying complex pieces and then dividing them into successively smaller pieces is top-down design.


Structure chart: A structure chart is a chart which shows the breakdown of a system to its lowest manageable parts. They are used in structured programming to arrange program module into a tree. Each module is represented by a box, which contains the module's name. The tree structure visualizes the relationships between modules, showing data transfer between modules with using arrows.


Diagram used in structure chat:

i. Data couple:




   Data being passed from module to module that needs to be processed.


ii. Flag:

  Check data sent to process to stop or start process.


iii. Process:
   It represents a programming modules.



Example of structure diagram:

Programming language: Visual Basic

Sub howManyThrees()
        Dim num1, count, total As Integer
        num1 = startMsg()
        count = 0
        total = 0
        While num1 > 0
            checkNumber(count, total, num1) : num1 = num1 - 1
        End While
        endMsg(count)
    End Sub

Sub checkNumber(ByRef c, ByRef t, ByVal n)

        If n Mod 3 = 0 Then
            c = divBy3(c)
        Else
            t = add(n, t)
        End If
    End Sub

    Function divBy3(x)

        Return x + 1
    End Function

    Function add(n, t)

        Return (n + t)
    End Function

    Function startMsg()

        Console.WriteLine("program strated, enter your number") : Return Console.ReadLine()
    End Function

    Sub endMsg(n)

        Console.WriteLine("checkNumber AddressOf howManyThrees: " & n)
    End Sub














6. What is meant by black-box testing, white-box testing and stub testing? Differentiate between black-box and white-box testing.

Black-box testing: In this method the internal structure design or implementation of the item being tested is not known to the tester. Tester is mainly concerned with validation of output rather than how the output is produced. In short, black-box testing is comparing expected value with actual results when program runs.


White-box testing: In this method the internal structure design or implementation of the item being tested is known to the tester. Tester validates the internal structure of the item under consideration along with the output. In short, white-box testing is testing every path through the program code. In IDE setting breakpoints, stepping and subroutine parameter checking are the features that provides to carry out white box testing.


Stub testing: When you develop a user interface, you may wish to test it before you have implemented all the facilities. You can write a 'stub' for each procedure. The procedure body only contains an output statement to acknowledge that the call was made.


Difference between Black-box and White-box testing

   Black-box testing                                                        white-box testing
i. In this testing method, internal structure,                   i. In this testing method, the internal structure,
 design and implementation of the data item                      design and implementation of the data item                    
 being tested is not known to the tester.                         being tested is known to the tester

ii. Normally independent software tester’s                      ii. Normally software developers are responsible
   are responsible for doing black-box testing.                   for doing white-box testing.

iii. Programming Implementation and                            iii. Programming Implementation and
     knowledge is not required                                      knowledge is not required.    

iv. It means functional test or external                       iv. It means structural test or interior test.  
    test.



7. Define each of the types of an error in a program: syntax error, logic error and run-time error.


Syntax error: ( an error in which a program statement does not follow the rules of the language.)
Syntax errors are errors in the grammar of the program language. That is, the rules of the language have been broken. Common errors are typing errors, such as Selct for Select. Other errors are more subtle, for example:
● an If statement without a matching End If statement
● a For statement without a matching Next statement
● an opening parenthesis without a closing parenthesis: (a + b.

Most syntax errors are spotted by the programmer before an attempt to run the code. Some program editors help with this. For example, the Visual Basic.NET editor underlines any variable in the code which has not been declared. Similarly, it highlights declared variables which have not been used in the code. Syntax errors are finally picked up during the syntax analysis stage of the program’s translation. In the case of an interpreter, the error is reported as soon as it is found. A compiler reports all errors found in the complete program in its error report. You should be aware that some editors can report syntax errors while the code is being entered. It is still the syntax analyzer that spots the error. If an examination question asks when a syntax error is found, the answer is “during the syntax analysis stage of the program’s translation”. Often the analyser reports program statements that are not correctly formed. For example, the following statement reports an error:

For Index 1 To 20
The correct Visual Basic syntax is:
For Index = 1 To 20

A similar example is a call to a function that requires two parameters in the function header; an error is reported if the programmer only provides one parameter. Similarly, the programmer may provide the
parameter but it is of the wrong data type.



Logic error: ( an error in the logic of the solution that causes program not to behave as intended.)
A logic error occurs when the programmer makes a mistake in their logic for some part of the program. Suppose a programmer wants the first 10 positive integers to be output and creates the following algorithm:

FOR Count = 0 TO 10

OUTPUT Count
NEXT Count

This algorithm has no grammatical errors but it does not produce the correct result. It produces the integers 0 to 10 not 1 to 10. This type of error can only be found by thorough testing. The programmer care carefully check the code by reading it or can attempt to run the program. Another common error is to use the wrong arithmetic symbol, e.g. a+b instead of a-b, or to put parentheses in the wrong place, such as (a+b-c)*d instead of (a+b)-c*d. These errors should be identified during testing and are all a mistake in the logic of the programmer.



Run-time error: ( an error that cause program execution to crash or freeze. )
Run-time errors occur during the execution (running) of the program. A typical error is to have an expression, such as (a+b)/(c-d), used in the program but c is equal to d, resulting in an attempted division by zero. The problem is that this error may be undetected for a considerable time because the equality of c and d rarely happens. However, it could be disastrous when it does. It is a good idea to test the denominator before division to ensure that this error doesn’t crash the program. Instead, the programmer “traps” the error and displays
an error message, as seen in the following code:


Dim A As Integer : Dim B As Integer
Dim C As Integer : Dim D As Integer
Dim Denominator As Single
A = InputBox("A ...")
B = InputBox("B ...")
C = InputBox("C ...")
D = InputBox("D ...")
If C <> D Then
Denominator = C - D
Console.writeline("Answer is ... " & Denominator)
Else
Console.writeline ("Denominator is Zero")
End If





8. What is Dry-run and trace table? Explain about the debugging features of the programming environment: breakpoint and stepping.

Dry-run:  The process of checking the execution of an algorithm or program by recording variable values in a trace table.
Trace table:  A table with a column for each variable that records their changing value.



Debugging features of the programming environment: Breakpoint and Stepping


Breakpoint:  It is a signal that tells the debugger to temporarily suspend execution of your program at a certain point. A point where the program can be halted to see if the program works at this point.


Stepping:  When your program is in break mode - that is, the program has paused at a breakpoint - you can control how execution continues or Executes one statement at a time and then pauses to see the effect of each statement.



9. What is an Integrated Development Environment ( IDE )? Describe some of the features provides by IDE.

Integrated Development Environment ( IDE ): It is a software application that provides comprehensive facilities to computer programmers for software development. An IDE normally consist of source code editor, build automation tools and a debugger.


Features of Integrated Development Environment ( IDE ):

i. Pretty printing: pretty print refers to the presentation of the program code typed into an editor. It includes indentation, color - coding of  keywords and comments.

ii. Context - sensitive prompts: this features displays hints or a choice of keywords and available identifiers appropriate at the current insertion point of the program code.

iii. Dynamic syntax check: When a line has been typed, some editor perform syntax check and alert the programmer to errors.

iv. Expanding and collapsing code blocks: When working on program code consisting of many lines of code, it saves excessive scrolling if you can collapse blocks of statements.







10. Explain about the programming constructs.


Programming constructs

Assignment statement: Code that gives a value to a variable or constant.
                               Example: MyAge ← 4, in pseudo code, assigns the value 4 to the variable MyAge.


Sequence statement: programming statements are executed consequently, as they appear in the program.


Selection statement: any program statement in which a decision is made.
                              • IF Statement
                              • SELECT Statement


Iteration/Repetition: control structure in which a block of code is repeated a number of times.
                               • FOR Loop: It is count controlled loop where there is no condition. 
                               • Do Loop: In this loop condition is given at the end of statement.
                               • WHILE Loop: In this loop condition is given at the start of statement.



11. Explain or differentiate: post-condition and pre-condition loop. 


Post-condition Loop:  It executes the statements within loop at least once. When the condition is encountered, it is evaluated. As long as condition evaluates to   False the statements within loop are executed again. When then condition evaluates to True, execution will go to the next statement after the loop.



Pre-condition Loop: It evaluates the condition before the statements within the loop are executed. Pre-condition loops will execute the statements within the loop as long as the condition evaluates to True. When the condition evaluates to False, execution will go to the next statement after the loop.






12. What is Transferable Skill? Why Programming in a high-level language is a transferrable skill?

Transferable Skills: Ability to define a specific problem in a particular situation, understand and expand the learns of broad generality that can be applied in other in other situation or field, and develop the use cases that solve the specific problem in such a way as the tool developed can be applied to the broader case.


Programming in a high-level language is a
transferrable skill:

i. Similar syntax
- Assignment, variable, data types
- Common operators, Symbols for functions

ii. Control structures
- Iteration
- Selection
- Sequence
- Layout, format (e.g. indentation )

iii. Modular features
- Objects
- Procedures , Functions








13. List down differences and similarities between Built-in function and user-defined function.


Differences:

i.  Built-in functions are made available by the programming language i.e., already in the
  system
ii.  Built-in functions are ready made and tested
iii.  User-defined functions can be modified whereas built-in cannot be modified
iv.  User defined functions can be designed to meet the user's requirements
v.  User-defined functions can only be used in the program or module


Similarities:
i. They have an identifier name
ii. They return a value
iii. They have none, one or more arguments
iv. Both perform a specific task
v. Both represent re-usable code
vi. Both are 'called'




14. Where source code is written? And what produces object code? 

Text Editor creates or modifies the source code using the text editor.

Compiler translates the source code and produces the object code.



A compiler takes a program written in a high-level language (called the source program, which is made up of source code) and translates it into an equivalent program in machine code (called the object program or object file, which is made up of object code). Once this is done, the machine code version can be loaded into the machine and executed without any further involvement of the compiler






15. What is constant variable? Explain its benefit in a program?

Constant variable: In computer programming, a constant is a value that cannot be altered by the program during normal execution.
One benefit of using constants is that its value will not change accidentally. It makes our program easier to modify. 



16. What is corrective maintenance and adaptive maintenance?


Corrective maintenance: (Correcting identified errors) Corrective maintenance is a maintenance task or operation done in order to identify, isolate or separate and rectify a particular fault. This is performed in order to restore the failed machine, equipment or system to an operational condition. Corrective maintenance is necessary when a fault or bug is found in the operation of the new system. These are software bugs which were not picked up at the formal testing stage. A technician or the original programmers will be needed to correct the error.


Adaptive maintenance: The action of making amendments to a program to enhance functionality or in response to specification changes.
Adaptive maintenance is necessary when conditions change from those that existed when the original system was created. This may be because of a change in the law (tax rates may change, for example) or the hardware may be changed, so that changes need to be made to the software for it to remain functional.







17. What is Rogue value? Explain with an example.


Rogue value: A specific value, outside the generally expected range, which is used to terminate a list of data items.


Consider the following simple program.

Program to print number from 1 to 8 ( both inclusive ) 

    Dim i As Integer = 1
    Sub Main()
        Do
            Console.WriteLine(i)
            i = i + 1
        Loop Until i = 9           ‘Here 9 is rogue value which is used to terminate the loop.
        Console.ReadLine()
    End Sub






18. Difference between a parameter and an argument.


Parameters are temporary variable names within functions. The argument can be thought of as the value that is assigned to that temporary variable. Within the function, parameters act as placeholders for the argument it is passed. 


For instance, let’s consider following simple function to cube a number.

Function cube(byVal number as integer) as integer
        Return number^3
End function

‘number’ here is the parameter for the function ‘cube’. This means that anywhere we see ‘number’ within the function will act as a placeholder until number is passed an argument. To pass an argument to a function is do something like, cube(3), which will call ‘cube’ function and would assign the value 3 ( pass the argument 3 ) to the parameter ‘number’. Now whatever you see the parameter ‘number’ within the function, it will act like a variable with the value of 3. So, it will return 3 cubed which is 27.






BIBLOGRAPHY

1. Cambridge International AS and A level Computing Course book ( hris Leadbetter, Roger Blackford and Tony Piper)
2.  Cambridge International AS and A level Computer Science Course book ( Sylvia Langfield and Dave Duddell )
3.  Wikipedia, Yahoo, Stackoverflow and many other random websites.
4.  Cambridge International computer science ( 9608 ) past papers.






                                                           - CIE A-LEVEL COMPUTER SCIENCE (  9608 )