wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

STUCTURES

Total questions: 25

Worksheet time: 25mins

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

11.

How do you initialize an array in C?

a)

int arr[3] = (1,2,3);

b)

int arr(3) = {1,2,3};

c)

int arr[3] = {1,2,3}

d)

int arr(3) = (1,2,3)

12.

What is the output of C Program.?

int main()

{

int a[] = {1,2,3,4};

int b[4] = {5,6,7,8};

printf("%d,%d", a[0], b[0]);

}

a)

1

b)

2

c)

4

d)

Error

13.

What is the output of C Program.?

int main() {

int a[] = {1,2,3,4};

int b[4] = {5,6,7,8};

printf("%d,%d", a[0], b[0]);

}

a)

1,5

b)

2,6

c)

0,0

d)

Error

14.

What is the output of C Program.?

int main()

{

char grade[] = {'A','B','C'}; printf("GRADE=%c, ", *grade); printf("GRADE=%d", grade);

}

a)

GRADE=some address of array, GRADE=A

b)

GRADE=A, GRADE=some address of array

c)

GRADE=A, GRADE=A

d)

Compiler error

15.

What is the output of C program.?

int main() {

char grade[] = {'A','B','C'}; printf("GRADE=%d, ", *grade); printf("GRADE=%d", grade[0]);

}

a)

A A

b)

65 A

c)

65 65

d)

None

16.

What is the output of C program.?

int main()

{

float marks[3] = {90.5, 92.5, 96.5};

int a=0;

while(a<3)

{

printf("%.2f,", marks[a]); a++;

}

}

a)

90.5 92.5 96.5

b)

90.50 92.50 96.50

c)

0.00 0.00 0.00

d)

Compiler error

17.

What is the output of C program with arrays and pointers.?

int main() {

int a[3] = {20,30,40};

int *p[3];

p=&a;

printf("%d", *p[0]); }

a)

20

b)

address of element 20

c)

Garbage value

d)

Compiler error

18.

In the C language, the constant is defined _______.

a)

Before main

b)

After main

c)

Anywhere, but starting on a new line

d)

None

19.

Who invented C Language.?

a)

Charles Babbage

b)

Grahambel

c)

Dennis Ritchie

d)

Steve Jobs

20.

C Language is a successor to which language.?

a)

FORTRAN

b)

D Language

c)

BASIC

d)

B Language

21.

C is a which level language.?

a)

Low Level

b)

High Level

c)

Low + High

d)

none

22.

C language was invented in which laboratories.?

a)

Uniliver Labs

b)

IBM Labs

c)

AT&T Bell Labs

d)

Verizon Labs

23.

A C program is a combination of.?

a)

Statements

b)

Function

c)

variables

d)

all

24.

An Identifier may contain.?

a)

Letters a-z, A-Z in Basic character set.

Unicode alphabet characters other languages

b)

Underscore _ symbol

c)

Numbers 0 to 9

Unicode Numbers in other languages

d)

All the above

25.

Find an integer constant.

a)

3.145

b)

34

c)

"125"

d)

None of the above