Data Structures
CSE · Quiz · Spring 25
Section H
Read the questions as text
Read off the PDF by AI, so it may have mistakes. The PDF is the original.
Quiz 01 (Section H)
Time: 30 min
1.
#include<stdio.h>
int main()
{
int a = 3;
int *b;
b=&a;
int **c;
c=&b;
int ***d;
d=&c;
int p = ***d;
int q = **d;
int r = *b;
printf("%d\n", p+q+r+a);
}
a) If the starting addresse of a,b,c,d are 201, 161, 131, 101 respectively, what will be the output of this code? Marks: 04
[Figure: Diagram showing pointer variables d, c, b, a pointing to each other with memory addresses]
2. Difference between Call by value and Call by Reference with example. Marks 04
3. What is Structure?
#include<stdio.h>
struct s
{
int a;
int b;
};
void change(int x)
{
x=x-5;
printf("%d\n", x);
}
int main()
{
struct s a1={1,2};
change(a1.a);
printf("%d\n", a1.a);
}
What will be the output of this program? Marks: 04
4. As a wise programmer, you do not want to waste any memory by declaring an array statically, so you remember your favorite teacher Sadia Jannat recalling about dynamic memory allocation, your task is to just allocate memory dynamically for 12 floating point numbers using any of your preferred functions. Write a line that only allocates memory dynamically for 12 numbers. Marks 03