WorksheetsDSA - Unit 1 Quiz
Total questions: 10
Worksheet time: 5mins
What is the & in pointers?
Dereferences the memory address into an object
References an object into a memory address
Makes a new copy of the object as a memory address
None of the above.
How do you make a pointer point to an existing variable?
int y = 0;
int *x = y;
int &x = *y;
int *x = &y;
int x = y;
Which operator connects the structure name to its member name?
-
.
<-
both . and <-
Difference Between array and calloc()
array: Size is fixed
calloc () : fixed size
array: Size is fixed & static
calloc () : fixed size & dynamic
array: Size is fixed & dynamic
calloc () : fixed size & dynamic
array: Size is fixed & static
calloc () : fixed size can be altered & dynamic
How can we change the size of memory during run-time?
malloc()
calloc()
realloc()
free()
Dynamic memory allocation occurs
when a new variable is created by the compiler
when a new variable is created at runtime
when a pointer fails to dereference the right variable
when a pointer is assigned an incorrect address
What do the following declaration signify?
char *arr[10];
arr is a array of characters.
arr is a array of function pointer.
arr is a array of 10 character pointers.
arr is a pointer to array of characters.
In a C Program if
int a = 5;
Int *ptr = &a;
then the printf statement with
&a, a, *ptr , ptr represent
adrress, Value, Value, Adress
address, value, value, value
all address
all values
Number of bytes in memory taken by the below structure is?
struct test
{
int k;
char c;
};
Multiple of integer size
Depends on the platform
Integer size+character size
Multiple of word size
What is the size of a C structure?
C structure is always 128 bytes
Size of C structure is the total bytes of all elements of structure
Size of C structure is the size of largest element
None of the mentioned
