C Language - Structures,Unions

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

 
31.

What will be the output of the program ?

#include
struct course
{
int courseno;
char coursename[25];
};
int main()
{
struct course c[] = { {102, "Java"}, {103, "PHP"}, {104, "DotNet"} };
printf("%d ", c[1].courseno);
printf("%s\n", (*(c+2)).coursename);
return 0;
}

A. 103 DotNet B. 102 Java
C. 103 PHP D. 104 DotNet




32.

What would be the size of the following union declaration?

#include
union uTemp
{
double a;
int b[10];
char c;
}u;
(Assuming size of double = 8, size of int = 4, size of char = 1)

A. 4 B. 8
C. 40 D. 80




33.

What will be the output of the program given below in 16-bit platform ?

#include
int main()
{
enum value{VAL1=0, VAL2, VAL3, VAL4, VAL5} var;
printf("%d\n", sizeof(var));
return 0;
}

A. 1 B. 2
C. 4 D. 10




34.

What type of data is holded by variable u int this C code?

#include
union u_tag
{
int ival;
float fval;
char *sval;
} u;
The variable u here

A. Will be large enough to hold the largest of the three types; B. Will be large enough to hold the smallest of the three types;
C. Will be large enough to hold the all of the three types; D. None of the mentioned




35.

What will be the output of the program ?

#include
int main()
{
enum status {pass, fail, absent};
enum status stud1, stud2, stud3;
stud1 = pass;
stud2 = absent;
stud3 = fail;
printf("%d %d %d\n", stud1, stud2, stud3);
return 0;
}

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




36.

What is the output of this C code?

#include
struct
{
char *name;
union
{
char *sval;
} u;
} symtab[10];
the first character of the string sval by either of

A. *symtab[i].u.sval B. symtab[i].u.sval[0]
C. You cannot have union inside structure D. Both A & B




« previous

1

2

3

4

5

6

7

8

9

...

next »

 
 
 



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