adplus-dvertising

Welcome to the Structures and Unions MCQs Page

Dive deep into the fascinating world of Structures and Unions with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Structures and Unions, a crucial aspect of C Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Structures and Unions, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within C Programming.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Structures and Unions. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of C Programming.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Structures and Unions. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Structures and Unions MCQs | Page 22 of 27

Explore more Topics under C Programming

Q211.
Which of the following is a properly defined struct?
Discuss
Answer: (d).struct a_struct {int a;};
Q212.
Which properly declares a variable of struct foo?
Discuss
Answer: (b).struct foo var;
Q213.
What is the output of this program?
#include <stdio.h>
struct test {
    int x = 0;
    char y = 'A';
};
int main()
{
    struct test t;
    printf("%d, %c", s.x, s.y);
    return 0;
}
Discuss
Answer: (b).Error
Q214.
What is the output of this program?
#include <stdio.h>
struct test {
    int x;
    char y;
} test;

int main()
{
    test.x = 10;
    test.y = 'A';
    printf("%d %c", test.x,test.y);
    return 0;
}
Discuss
Answer: (a).0.416666666666667
Q215.
What is the output of this program?
#include <stdio.h>
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);
}
Discuss
Answer: (b).Science 85
Q216.
What will be the size of the following structure?
struct demo{
  int a;
  char b;
  float c;
}
Discuss
Answer: (a).12
Q217.
What is the output of this program?
#include <stdio.h>         
void main()
{
struct demo{
    char * a;
    int n;
};

struct demo p = {"hello", 2015};
struct demo q = p;
printf("%d", printf("%s",q.a));
}
Discuss
Answer: (c).hello5
Q218.
What is the output of this program?
#include <stdio.h>
int main()
{
    union demo {
        int x;
        int y;
    };
 
    union demo a = 100;
    printf("%d %d",a.x,a.y);
}
Discuss
Answer: (d).Compilation Error
Q219.
What is the output of this program?
#include <stdio.h>
int main()
{
    enum days {MON=-1, TUE, WED=4, THU, FRI, SAT};
    printf("%d, %d, %d, %d, %d, %d", MON, TUE, WED, THU, FRI, SAT);
    return 0;
}
Discuss
Answer: (a).-1 0 4 5 6 7
Q220.
What is the output of this program?
#include <stdio.h>
int main(){
   struct simp 
 {
  int i = 6;
  char city[] = "chennai";
 };
 struct simp s1;
 printf("%d",s1.city);
 printf("%d", s1.i);
    return 0;
}
Discuss
Answer: (d).Compilation Error

Suggested Topics

Are you eager to expand your knowledge beyond C Programming? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!