Functions

  1. Which of the following is true for "call by value" in C?
    1. Called function has access to original argument
    2. Called function creates a local copy of the passed argument
    3. Both A and B are true
    4. None of the above
  1. View Hint | View Answer | Workspace | Discuss In Forum | Report

    arguments passed to called funtion are local to the calling function. Calling function cannot modify its value

    Correct Option: B

    pass by value means that called function is given the value of its arguments in temporary variables rathen than originals.

    Report

  1. Which of the following is true for "call by reference" in C program?
    1. Called function can alter the value of variable passed from calling function
    2. Called function creates a private temporary copy of the passed argument and modifies it.
    3. Both A and B are false
    4. A is true
  1. View Hint | View Answer | Workspace | Discuss In Forum | Report

    In case of call by reference, called function has access to original argument.

    Correct Option: A

    Call by reference allows called program to access and modigy the original value of the argument passed.
    Called function does not need to create a copy of the argument passed

    Report

  1. What error will the following function give on compilation?
    fun(int x, int y )
    {
    int x ;
    y = 54 ;
    return x ;
    }
    1. Missing parentheses in return statement
    2. The function should be defined as int fun(int x, int y )
    3. Re declaration of x
    4. None of the above
  1. View Hint | View Answer | Workspace | Discuss In Forum | Report

    Re declaration of a.

    Correct Option: C

    Re declaration of a.

    Report