# Round 1 Aptitude and C
# //BITSILICA round 2
1)Spiral matrix print from top right
#include
int main() {
int m,n;
printf("Enter Array Size m x n: ");
scanf("%d %d",&m,&n);
int arr[m][n];
printf("Enter array Elements: \n");
for(int i = 0; i < m; i++){
for(int j =0; j < n; j++){
scanf("%d",&arr[i][j]);
}
}
for(int i = 0; i < m; i++){
for(int j =0; j < n; j++){
printf("%d ",arr[i][j]);
}
printf("\n");
}
printf("\n");
// spiral
int top = 0;
int bottom = m-1;
int left = 0;
int right = n-1;
while(top <= bottom && left <= right){
for(int i = right; i >=left; i--){
printf("%d ",arr[top][i]);
}
top++;
for(int i = top; i <= bottom; i++){
printf("%d ",arr[i][left]);
}
left++;
if(top <= bottom){
for(int i = left; i <= right; i++){
printf("%d ",arr[bottom][i]);
}
bottom--;
}
if(left <= right){
for(int i = bottom; i >= top; i--){
printf("%d ",arr[i][right]);
}
right--;
}
}
return 0;
}
2) dynamically allocate memory for 2D array using calloc
3) How is a process created?
4) explain about memory segments?
5) Why 4 memory segments, why cant we store all in 1 segment itself?
6) do you know about LPC microcontroller?
7) How to connect SD card to an MC?
8) Real time usage of SPI
9) do you know about GDB
10) Explain about all variable qualifiers and their scope.
11) difference between malloc and calloc
12) Explain how interrupt works?
13) where is isr located?
14) what is interrupt latency?