Menu Close

C exam on Structures

Please enter your email:

1.

Output of following Code?

#include<stdio.h>
void fun();
int main()
{
  struct st
  {
    char a;
    int b;
    float c;
  };
}
void fun()
{
  struct st var ;
  printf("%d ", sizeof(struct st));
}

 

 
 
 
 

2.

A -> B is syntactically correct if?

 
 
 
 

3.

Output of following Code?

#include <stdio.h>
int main()
{
  struct sample
  {
    struct sample *s;
  }t;
  printf("%d", sizeof(t.s));
  return 0;
}

 

 
 
 
 

4.

Output of following Code?

#include<stdio.h>
union un
{
  int a, b;
};
int main()
{
  union un var ;
  var.a=10;
  var.b=20;
  printf("%d ", var.a+var.b);
  return 0;
}

 

 
 
 
 

5.

Output of following Code?

#include<stdio.h>
union un
{
  short s;
  char c[2];
};
void main()
{
  union un var ;
  var.c[0]=2;
  var.c[1]=3;
  printf("%d ", var.s);
}

 

 
 
 
 

6.

If code contains instruction “s.t.b = 10” indicates…

 
 
 
 

7.

Output of following Code?

#include<stdio.h>
union un
{
  int a, b;
};
void main()
{
  printf("%d ", sizeof(union un));
}

 

 
 
 
 

8.

Which of the following Statement about Union is false?

 
 
 
 

9.

Which operator is used to connect structure name to its member name?

 
 
 
 

10.

Output of following Code?

#include <stdio.h>
struct sample
{
  int a=100;
};
int main()
{
  struct sample s ;
  printf("%d ",s.a);
  return 0;
}

 

 
 
 
 

Question 1 of 10