C Language - Structures,Unions

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

 
37.

What will be the output of the program ?

#include
int main()
{
struct byte
{
int one:1;
};
struct byte var = {1};
printf("%d\n", var.one);
return 0;
}

A. 1 B. -1
C. 0 D. Error




38.

Number of bytes in memory taken by the below structure is

#include
struct test
{
int k;
char c;
};

A. Multiple of integer size B. integer size+character size
C. Depends on the platform D. Multiple of word size




39.

What is the output of this C code(according to C99 standard)?

#include
struct p
{
int k;
char c;
float f;
};
int main()
{
struct p x = {.c = 97};
printf("%f\n", x.f);
}

A. 0.000000 B. Somegarbagevalue
C. Compile time error D. None of the mentioned




40.

What is the output of this C code?

#include
struct p
{
int k;
char c;
};
int p = 10;
int main()
{
struct p x;
x.k = 10;
printf("%d %d\n", x.k, p);
}

A. Compile time error B. 10 10
C. Depends on the standard D. Depends on the compiler




41.

What is the output of this C code?

#include
struct point
{
int x;
int y;
};
void foo(struct point*);
int main()
{
struct point p1[] = {1, 2, 3, 4};
foo(p1);
}
void foo(struct point p[])
{
printf("%d\n", p[1].x);
}

A. Compile time error B. 3
C. 2 D. 1




42.

What is the output of this C code?

#include
struct point
{
int x;
int y;
} p[] = {1, 2, 3, 4, 5};
void foo(struct point*);
int main()
{
foo(p);
}
void foo(struct point p[])
{
printf("%d %d\n", p->x, p[2].y);
}

A. 1 0 B. Compile time error
C. 1 somegarbagevalue D. Undefined behaviour




« previous

1

2

3

4

5

6

7

8

9

...

next »

 
 
 



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