Arrays


  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    int n[2][3];
    function(n);
    }
    void function(int *n[])
    {
    int num1 = 20, num2 = 23, L;
    n[0] = &num1;
    n[1] = &num2;
    *n[0] = 23;
    for (L = 0; L < 2; L++)
    printf("%d\n", *n[L]);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    23
    23


  1. What are the applications of a multidimensional array?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Minimum Spanning Tree, Finding connectivity between nodes, and Matrix-Multiplication are the applications of a multidimensional array.



  1. What is the correct syntax to send a 3-dimensional array as a parameter? (Assuming declaration int number[4][3][2];)











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    func(number);


  1. Which of the following is not possible statically in C?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    Jagged Array



  1. Comment on the following 2 arrays with respect to I and II.
       int *num1[10];
    int *(num2[10]);
    I. Array of pointers
    II. Pointer to an array











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    num1 is I, num2 is I