Functions


  1. Which of the following is true for "call by reference" in C program?









  1. View Hint View Answer Discuss in Forum

    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


  1. Which of the following is true for "call by value" in C?









  1. View Hint View Answer Discuss in Forum

    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.



  1. Which of the following function with ellipsis are illegal?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    void func(…);


  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    struct NN
    {
    char *name;
    struct NN *next;
    };
    struct NN *ptrary[10];
    struct NN n, nn;
    n.name = "Rahul";
    n.next = NULL;
    ptrary[0] = &n;
    nn.name = (char*)malloc(sizeof(char)*3);
    strcpy(nn.name, n.name);
    nn.next = &nn;
    ptrary[1] = &nn;
    printf("%s\n", ptrary[1]->next->next->name);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    Rahul



  1. What will be the output of the following C code?
    #include <stdio.h>
    struct Employee
    {
    char str[];
    };
    void main()
    {
    struct Employee Emp;
    printf("%d", sizeof(struct Employee));
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: E

    Compilation Error

    main.c:4:14: error: flexible array member in a struct with no named members
    char str[];