Top

Structures, Unions, Enums

71.

Assume that size of an integer is 32 bit. What is the output of following program?

#include
struct st
{
    int x;
    static int y;
};
 
int main()
{
    printf("%d", sizeof(struct st));
    return 0;
}

 

Answer: C

No answer description available for this question.

Enter details here

72.

Which operator connects the structure name to its member name?

Answer: B

No answer description available for this question

Enter details here

73.

What is the output of this program?

#include 
 struct 
{
 int i;
 float ft;
}decl;
int main(){
    decl.i = 4;
 decl.ft = 7.96623;
 printf("%d %.2f", decl.i, decl.ft);
 return 0;
}

 

Answer: A

In the above program the float variable ft is intialised to 7.96623, and it rounded of to 7.97 because of %.2f that we have mentioned in printf statement.

Enter details here

74.

Which of the following accesses a variable in structure *b?

Answer: A

No answer description available for this question

Enter details here

75.

Consider the following declaration :

struct addr {
     char city[10];
     char street[30];
     int pin ;
};

struct {
char name[30];
int gender;
struct addr locate;
} person , *kd = &person ;

Then *(kd -> name +2) can be used instead of

Answer: C

No answer description available for this question.

Enter details here

76.

Point out the error( if any) in the following code.

#include
enum sanfoundry
{
    a,b,c
};
enum sanfoundry g;
main()
{
    g++;
    printf("%d",g);
}

 

Answer: D

The code shown above does not result in any error. This is because, although the value of enum constants cannot be changed, yet it is possible to modify the value of the enum instance variable(that is ‘g’ in this case).

Enter details here

77.

User-defined data type can be derived by___________

Answer: D

No answer description available for this que

Enter details here

78.

String handling functions such as strcmp(), strcpy() etc can be used with enumerated types.

Answer: B

Enumerated types are not strings. Hence it is not possible to use string handling functions with enumerated data types.

Enter details here

79.

Can we have enum containing enum with same contestant?

#include "stdio.h"

enum Yenum{
       C, CPP, Java
};

enum Xenum{
    C, CPP, Java, Yenum
};

int main()
{
  enum Xenum var;
  printf("%d",sizeof(var));
  return 0;
}

 

Answer: A

No answer description available for this question

Enter details here

80.

What is the output of this program?

#include 
struct result{
  char sub[20];
  int marks;
};
void main()
{
      struct result res[] = { {"Maths",100},
      {"Science",90},
      {"English",85}
      };
    printf("%s ", res[1].sub);
    printf("%d", (*(res+2)).marks);
}

 

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