Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

DSA - Unit 1 Quiz

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is the & in pointers?

a)

Dereferences the memory address into an object

b)

References an object into a memory address

c)

Makes a new copy of the object as a memory address

d)

None of the above.

2.

How do you make a pointer point to an existing variable?

int y = 0;

a)


int *x = y;

b)

int &x = *y;

c)

int *x = &y;

d)

int x = y;

3.

Which operator connects the structure name to its member name?

a)

-

b)

.

c)

<-

d)

both . and <-

4.

Difference Between array and calloc()

a)

array: Size is fixed

calloc () : fixed size

b)


array: Size is fixed & static

calloc () : fixed size & dynamic

c)

array: Size is fixed & dynamic

calloc () : fixed size & dynamic

d)


array: Size is fixed & static

calloc () : fixed size can be altered & dynamic

5.

How can we change the size of memory during run-time?

a)

malloc()

b)

calloc()

c)

realloc()

d)

free()

6.

Dynamic memory allocation occurs

a)

when a new variable is created by the compiler

b)

when a new variable is created at runtime

c)

when a pointer fails to dereference the right variable

d)

when a pointer is assigned an incorrect address

7.

What do the following declaration signify?

char *arr[10];

a)

arr is a array of characters.

b)

arr is a array of function pointer.

c)

arr is a array of 10 character pointers.

d)

arr is a pointer to array of characters.

8.

In a C Program if

int a = 5;

Int *ptr = &a;

then the printf statement with

&a, a, *ptr , ptr represent

a)

adrress, Value, Value, Adress

b)

address, value, value, value

c)

all address

d)

all values

9.

Number of bytes in memory taken by the below structure is?

struct test

{

int k;

char c;

};

a)

Multiple of integer size

b)

Depends on the platform

c)

Integer size+character size

d)


Multiple of word size

10.

What is the size of a C structure?

a)

C structure is always 128 bytes

b)

Size of C structure is the total bytes of all elements of structure

c)

Size of C structure is the size of largest element

d)

None of the mentioned