Top

Structures, Unions, Enums

11.

The number of distinct nodes the following struct declaration can point to is

struct node
{
   struct node *left;
   struct node *centre;
   struct node *right;
};

 

Answer: A

The number of distinct nodes the following struct declaration can point to is All of the above.

Enter details here

12.

#include >stdio.h>

typedef enum{
    Male, Female=-1
}SEX;

int main()
{
  SEX var = Male;
  SEX var1 = Female;
  printf("%d %d",var, var1);
  return 0;
}

 

Answer: D

No answer description available for this que

Enter details here

13.

Which of the following accesses a variable in structure b?

Answer: B

No answer description available for this question

Enter details here

14.

What is the output of this program?

#include 
int main()
{
    union demo {
        int x;
        int y;
    };
 
    union demo a = 100;
    printf("%d %d",a.x,a.y);
}

 

Answer: D

You cannot initialize an union variable like this.

Enter details here

15.

What is the output of this program?

#include 
void main()
{
  struct number
  {
    int no;
    char name[20];
  };
  struct number s;
  s.no = 50;
  printf("%d", s.no);
}

 

Answer: D

No answer description available for this question

Enter details here

16.

size of union is size of the longest element in the union

Answer: A

Max size of the union is the size of the largest data type or the memory taken by largest member.

Enter details here

17.

It is not possible to create an array of pointer to structures.

Answer: B

Making sure of the length has nothing to do with whether you assign or copy. You cannot assign to an array in C, ever. The language doesn't allow it.

Enter details here

Answer: D

No answer description available for this question.

Enter details here

Answer: A

No answer description available for this question.

Enter details here

20.

Anyone of the followings can be used to declare a node for a singly linked list. If we use the first declaration, “struct node * nodePtr;” would be used to declare pointer to a node. If we use the second declaration, “NODEPTR nodePtr;” can be used to declare pointer to a node.

/* First declaration */
struct node {
int data;
struct node * nextPtr;
};
 
/* Second declaration */
typedef struct node{
int data;
NODEPTR nextPtr;
} * NODEPTR;

 

Answer: B

No answer description available for this question.

Enter details here

Loading…
Tags: Structures, Unions, Enums Questions and Answers || Structures, Unions, Enums MCQ Questions and Answers || Structures, Unions, Enums GK Questions and Answers || Structures, Unions, Enums GK MCQ Questions || Structures, Unions, Enums Multiple Choice Questions and Answers || Structures, Unions, Enums GK || GK on Structures, Unions, Enums || C Programming Questions and Answers || C Programming MCQ Questions and Answers || C Programming GK Questions and Answers || GK on C Programming