Search Header Logo

C Union Enum Bitfields Macros 31May2023

Authored by A M Abirami

Computers

University

Used 4+ times

C Union Enum Bitfields Macros 31May2023
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What is the size of union u? (runs in GDB compiler)

union u{

int x;

float y;

char z[10];

};

10

8

12

18

2.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

#include <stdio.h>

union u {

int x;

float y;

char z[10];

};

int main()

{

u.x = 2;

printf("%d\n",u.x);

return 0;

}

2

compile time error

undefined output

run time error

3.

FILL IN THE BLANK QUESTION

1 min • 1 pt

#include <stdio.h>

union u{

int x;

float y;

char z[10];

};

int main()

{

union u uu;

uu.x = 2;

printf("%d\n",uu.x);

return 0;

}

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

#include <stdio.h>

union u{

int x;

float y;

char z[10];

};

int main()

{

union u uu;

uu.x = 65;

printf("%c\n",uu.z[0]);

return 0;

}

65

A

AA

Undefined

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

#include <stdio.h>

struct s {

int x:5;

float y:6

};

int main()

{

struct s ss;

return 0;

}

Compile time error

Run time error

No output

6.

FILL IN THE BLANK QUESTION

1 min • 1 pt

struct s{

int x:5;

float y;

};

When sizeof(struct s) is used, ________ bytes is allocated;

7.

FILL IN THE BLANK QUESTION

1 min • 1 pt

struct s{

int x:5;

};

When sizeof(struct s) is used, ________ bytes is allocated;

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?