1. What is the official name of the parameters that are used in the code which calls a function:
    1. Input parameters
    2. First parameters
    3. Actual parameters
    4. Formal parameters

    Answer: Actual parameters

  2. What is the official name given to the parameters which appear in the definition of a function?
    1. Output parameters
    2. Second parameters
    3. Actual parameters
    4. Formal parameters

    Answer: Formal parameters

  3. Actual parameters must have the same names as formal parameters. True or False?

    Answer: False

  4. When a function which uses parameters is called, the actual and formal parameters must match each other in which of the following ways?
    1. Their data types must match.
    2. There must be the same number of actual as formal parameters
    3. The order in which they are specified must match.
    4. All of the above

    Answer: All of the above

  5. Spot the flaws in the following code:
    int mysubroutine(int x, char y, float z)
    {
        if (y == 'a') return(x);
        if (z < 3.14) return(-x);
        return(x*x);
    }
    
    int main()
    {
       int a = 1;
       char c = '1';
    
       cout << mysubroutine(3, 'a', 7.1);
       a = mysubruotine(3, 'a', 1.2);
       mysubroutine(1.0, 'c', 4);
       c = mysubroutine(1, a, 3.2);
       a = mysubroutine(1, c, 3.2);
    }
    

    Answer: The value returned by this statement is not used:

          mysubroutine(1.0, 'c', 4);
    

  6. Which of the following are illegal:
    int  foo() { return(-1); }
    int  foo() { return('1'); }
    int  foo() { return(1.0); }
    int  foo() { return("1"); }
    int  foo() {  ; }
    void foo() {  ; }
    

    Answer: int foo() { return("1"); }