wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C

Total questions: 20

Worksheet time: 12mins

Name
Class
Date
1.

Which of the function cannot be a structure member?

a)

Another structure

b)

Function

c)

Array

d)

None

2.

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

a)

String

b)

Struct

c)

char

d)

all

3.

Which operator connects the structure name to its member name?

a)

-

b)

=

c)

.

d)

>>

4.

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

5.

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

6.

Memory allocated for structure members are always contigious

a)

True

b)

False

7.

Union is a keyword of C

4 lines
8.

In a C Program if

int a = 5;

Int *ptr = &a;

then the printf statement with

&a, a, *ptr , ptr

a)

adrress, Value, Value, Adress

b)

address, value, value, value

c)

all address

d)

All values

9.

Code to change the 3rd array value to 50 using pointers

int main(){

int a[] = {10,20,30};

int *p = a;

----------------------;

}

a)

p+3 = 50

b)

*(p+3) = 50

c)

*p+2 = 50

d)

*(p+2) = 50

10.

The format identifier ‘%i’ is also used for _____ data type.

a)

char

b)

int

c)

float

d)

double

11.

What is the default return type if it is not specified in function definition?

a)

void

b)

int

c)

double

d)

short int

12.

Which type of variables can have the same name in a different function?

a)

Global variables

b)

Static variables

c)

Function arguments

d)

Both static variables and Function arguments

13.

Who is know as founder of C language

a)

Dennis Ritchie

b)

Bjarne Stroustroup

c)

Tim Berner Lee

d)

Rasmus Ledorf

14.

Which of these is not a correct variable data type?

a)

int

b)

float

c)

real

d)

char

15.

C is a

a)

Low level language

b)

Assembly language

c)

Medium level language

d)

High level language

16.

The starting point of C execution at

a)

==

b)

main()

c)

function()

d)

!=

17.

Why do you need to import stdio.h a header file?

a)

Just a waste of time

b)

To run the code

c)

It helps in compilation to binary coded file

d)

To perform input and output operations

18.

What are malloc() and calloc()

a)

Dynamic memory allocation

b)

static memory allocation

c)

run time memory allocation

d)

none of these

19.

which of the following is a correct identifier in C++ ?

a)

VAR_1234

b)

$var_name

c)

7VARNAME

d)

7var_name

20.

Which of the following approach is used in C++ ?

a)

left - right

b)

right - left

c)

bottom - top

d)

top - bottom