wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

C Structures

Total questions: 10

Worksheet time: 9mins

Name
Class
Date
1.

Which of the following are themselves a collection of different data types?

a)

String

b)

Struct

c)

char

d)

all

2.

Which operator connects the structure name to its member name?

a)

-

b)

=

c)

.

d)

>>

3.

Which of the following cannot be a structure member?

a)

another structure

b)

array

c)

Function

d)

None

4.

Which of the following structure declaration will throw an error?

a)

struct temp{ } s;

main(){}

b)

struct temp{ };

struct temp s;

main(){ }

c)

struct temp s;

struct temp{ };

main(){ }

d)

None

5.

What is the output of this C code?

void main()

{

struct student

{

int no;

char name[20];

};

struct student s;

s.no = 8;

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

}

a)

Nothing

b)

Compile error

c)

8

d)

Junk

6.

Size of a union is determined by size of the.

a)

First member in the union

b)

Last member in the union

c)

C. Biggest member in the union

d)

Sum of the sizes of all members

7.

Assuming size of long int is 4 bytes, what will be the output for:


typedef long long int L = 24;

printf("Size of long long int is :");

printf("%d",sizeof(L));

a)

24

b)

4

c)

8

d)

Error

8.

What will be the output

a)

Name:

Subject:

Percentage: 86.50000

b)

Name:Raju

Subject:

Percentage: 86.50000

c)

Name: Raju

Subject: Maths

Percentage: 86.50000

d)

Error

9.

Memory allocated for structure members are always contigious

a)

True

b)

False

10.

What do you understand by:

void update(struct student *s);

a)

update is a function that takes an argument as pointer to structure variable and returns nothing

b)

update is a method that takes structure type variable as parameter

c)

Error, we cannot pass structure variable as pointer to a function

d)

update takes pointer argument but it cannot return void