C-structures , bitfields,union and File Handling

C-structures , bitfields,union and File Handling

University

20 Qs

quiz-placeholder

Similar activities

Python 1.0

Python 1.0

10th Grade - University

20 Qs

C programming

C programming

University

20 Qs

C Operators

C Operators

University - Professional Development

15 Qs

C-technical Quiz 1

C-technical Quiz 1

University

15 Qs

C++ Programming - MCQs

C++ Programming - MCQs

University

20 Qs

Basics of Python Programming Unit-1

Basics of Python Programming Unit-1

University - Professional Development

20 Qs

Day -1

Day -1

University

15 Qs

OCP 1Z0-819 - Chapter4

OCP 1Z0-819 - Chapter4

University

20 Qs

C-structures , bitfields,union and File Handling

C-structures , bitfields,union and File Handling

Assessment

Quiz

Professional Development

University

Hard

Created by

Shaik Imam

Used 3+ times

FREE Resource

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Can the following C code be compiled successfully?

    #include <stdio.h>

    struct p

    {

        int k;

        char c;

        float f;

    };

    int main()

    {

        struct p x = {.c = 97, .f = 3, .k = 1};

        printf("%f\n", x.f);

    }

Depends on the standard

No

Depends on the platform

Yes

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following C code?

    #include <stdio.h>

    struct student

    {

        int no;

        char name[20];

    };

    void main()

    {

        student s;

        s.no = 8;

        printf("%d",s.no);

    }

Nothing

8

Compile time error

Junk

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What would be the size of the following union declaration? (Assuming size of double = 8, size of int = 4, size of char = 1)

    #include <stdio.h>

    union uTemp

    {

        double a;

        int b[10];

        char c;

    }u;

4

8

40

80

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following C code

#include <stdio.h>

union temp

{

int a;

float b;

char c;

};

int main()

{

union temp s = {1,2.5,’A’};

printf("%c",s.c);

return 0;

}

'1'

Compilation error

'A'

Nothing

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following C code? (Assuming size of char = 1, int = 4, double = 8)

    #include <stdio.h>

    union utemp

    {

        int a;

        double b;

        char c;

    }u;

    int main()

    {

        u.c = 'A';

        u.a = 1;

        printf("%zu", sizeof(u));

    }

8

4

1

13

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of this program? 

#include <stdio.h>

int main()

{

typedef struct tag {

char str[10];

int a;

} tag;

tag h1, h2 = { "IHelp", 10 };

h1 = h2;

h1.str[1] = 'h';

printf("%s, %d", h1.str, h1.a);

return 0;

}

Error

IHelp 10

Ihelp 10

No Error ,No output

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of this program?

#include <stdio.h>

int main()

{

union test {

int i;

int j;

};

union test var = 10;

printf("%d, %d\n", var.i, var.j);

}

10,10

garbage values

Nothing

Compilation Error

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?