Top

Structures, Unions, Enums

31.

Arithmetic operations such as addition, subtraction, multiplication and division are allowed on enumerated constants.

Answer: A

Arithmetic operations such as addition, subtraction, multiplication and division are allowed on enumerated constants. Valid arithmetic operators are +, -, *, / and %.

Enter details here

32.

What will be the output of the following C code?

#include
enum colour
{
    blue, red, yellow
};
main()
{
    enum colour c;
    c=yellow;
    printf("%d",c);
}

 

Answer:

Enter details here

33.

Assume that this code is running on 64 bit system
 

#include 

enum Xenum{
    C, CPP, Java
};

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

}

 

Answer: C

No answer description available for this question

Enter details here

34.

Which of the following are themselves a collection of different data types?

Answer: B

No answer description available for this question

Enter details here

35.

Arithmetic operations are not allowed on enumerated constants.

Answer: B

No answer description available for this question

Enter details here

36.

What is the output of this program?

#include          
struct student
{
  char *c;
};
void main()
{
  struct student s[2];
  printf("%d", sizeof(s));
}

 

Answer: D

No answer description available for this question

Enter details here

37.

#include 
struct st 
{ 
    int x; 
    struct st next; 
}; 
   
int main() 
{ 
    struct st temp; 
    temp.x = 10; 
    temp.next = temp; 
    printf("%d", temp.next.x); 
    return 0; 
}

 

Answer: A

No answer description available for this question.

Enter details here

38.

Find the output of below C program

#include "stdio.h"

typedef enum{
    Male, Female
}SEX;

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

}

 

Answer:

Enter details here

39.

What will be the output of the following C code if the code is executed on a 32 bit platform?

#include 
enum sanfoundry
 {
    c = 0,
    d = 10,
    h = 20,
    s = 3
} a;
 
int main()
{
        a = c;
 printf("Size of enum variable = ?ytes", sizeof(a));
 return 0;

 

Answer: C

The size of an enum variable is equal to the size of an integer. The size of an integer on a 32 bit platform is equal to 4 bytes.

Enter details here

Answer: D

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