Structures


  1. Which of the following uses structure?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Linked Lists, Array of structures and Binary Tree uses structure.


  1. What is the correct syntax to declare a function fun() which receives an array of structure in function?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    void fun(struct *num);



  1. What will be the output of the following C code? (Assuming size of int be 4)
    #include <stdio.h>
    struct Count
    {
    int n1;
    int n2;
    int n3;
    } cnt[] = {0};
    main()
    {
    printf("%d", sizeof(cnt));
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    12


  1. What will be the output of the following C code?
    #include <stdio.h>
    struct Employee
    {
    char *name;
    };
    struct Employee emp[2];
    void main()
    {
    emp[0].name = "Ajit";
    emp[1] = emp[0];
    printf("%s %s", emp[0].name, emp[1].name);
    emp[1].name = "Sujit";
    printf(" %s %s", emp[0].name, emp[1].name);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    Ajit Ajit Ajit Sujit



  1. What will be the output of the following C code?
    #include <stdio.h>
    struct Worker
    {
    char *name;
    };
    struct Worker w1[2], w2[2];
    void main()
    {
    w1[0].name = "Imaraj";
    w1[1] = w1[0];
    w2 = w1;
    printf("%s%s", w2[0].name, w2[1].name);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    Compilation Error

    main.c: In function ‘main’:
    main.c:11:12: error: assignment to expression with array type
    w2 = w1;