WorksheetsC-Lab10
Total questions: 10
Worksheet time: 5mins
Which library is needed for Dynamic memory allocation?
malloc.h
memory.h
stdlib.h
calloc.h
The default address stored in a pointer is :
Hexadecimal
integer
long long integer
double
If ptr is a pointer variable pointing to an array, then
"printf("%d",*(ptr++)) ;"
statement will print :
Next location address
Next location index value
Next location value
Compile time error
malloc() stands for :
malicious location
memory allocation
multiple allocation
multi-alternate locations
calloc() function takes :
One parameter
Two parameters
Two parameters but one is optional
Zero parameters
Dynamically allocated memory is released by :
release()
dealloc()
free()
Compiler automatically
Passing address to a function as parameters is called
Default function call
Call by value
Call by reference
Call by pointers
The code to swap the values of two variables using pointers is given : TRUE / FALSE ?
temp = &ptr1 ;
&ptr1 = &ptr2 ;
&ptr2 = temp ;
TRUE
FALSE
From the given code, find the output :
char a[3] = {'a', '5' , '$'};
ptr=a;
for(i=1;i<=3;i++)
printf("%ld", a++);
a 5 $
124563 124564 124565
124563 124567 124571
Junk : 125845658 -25648569 -2564875
Given the code, what will be the output:
a=5; b=2;c=0;
ptr1 = &a; ptr2 = &b; ptr3 = &c;
ptr3 = *ptr1 * *ptr2;
printf(%d", *ptr3);
Compiler Error : Usage of double pointer without declaring
Compiler Error : Addresses cannot be multiplied
10
Compiler Error : Operator * followed by value
