C Language - Structures,Unions

You Are Here :: Home > C Language > Structures,Unions General Questions

 
49.

What is the output of this C code?

#include
struct student
{
char *name;
};
void main()
{
struct student s[2], r[2];
s[1] = s[0] = "shal";
printf("%s%s", s[0].name, s[1].name);
}

A. shal shal B. Nothing
C. Compile time error D. Varies




50.

What is the output of this C code?

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

A. 2 B. 4
C. 8 D. 0




51.

What is the output of this C code?

(Assuming size of int be 4)
#include
struct temp
{
int a;
int b;
int c;
} p[] = {0};
main()
{
printf("%d", sizeof(p));
}

A. 4 B. 12
C. 16 D. Can't be estimated due to ambigous initialization of array




52.

Which of the following structure declaration doesn't require pass-by-reference?

A. struct{int a;}s;
main(){}
B. struct temp{int a;};
main(){
struct temp s;
}
C. struct temp{int a;};
main(){}
struct temp s;
D. None of the mentioned




53.

What is the output of this C code?

#include
union p
{
int x;
char y;
}k = {.y = 97};
int main()
{
printf("%d\n", k.y);
}

A. Compile time error B. 97
C. a D. Depends on the standard




54.

struct employee_rec {

char name[30];
int dependents;
float pay_rate;
} full_time, part_time;
How many members does the above structures have?

A. 0 B. 1
C. 2 D. 3




« previous

1

2

3

4

5

6

8

9

...

next »

 
 
 



© 2013 freshersindia.in ® | Copyrights | Terms & Conditions
   Designed by Freshers India
Catch Us on