Structures


  1. What will be the output of the following C code?
    #include <stdio.h>
    typedef struct N *ptr2;
    struct N
    {
    int n1;
    char n2;
    ptr2 ptr1;
    };
    int main()
    {
    struct N n = {111, 222, &n};
    printf("%d\n", n.ptr1->ptr1->n1);
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    111


  1. The number of distinct nodes the following struct declaration can point to is _____________.
    struct node
    {
    struct node *left;
    struct node *centre;
    struct node *right;
    };











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Option A, B and C is right answer.



  1. Which of the following is not possible regarding structure variable?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: E

    None of these


  1. Which of the following technique is faster for travelling in binary trees?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Recursion



  1. Which of the following will stop the loop at the last node of a linked list in the following C code snippet?
    struct node
    {
    struct node *next;
    };











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    None of these