Consider the following ANSI C program.
#include <stdio.h>
int main(){
int arr[4][5];
int i, j;
for (i=0; i<4; i++){
for (j=0; j<5; j++){
arr[i][j] = 10*i + j;
}
}
printf("%d", *(arr[1] + 9));
return 0;
} What is the output of the above program?
Let's analyze the given ANSI C program step-by-step to determine the output.
#include <stdio.h>
int main(){
int arr[4][5];
int i, j;
for (i=0; i<4; i++){
for (j=0; j<5; j++){
arr[i][j] = 10*i + j;
}
}
printf("%d", *(arr[1] + 9));
return 0;
}This code initializes a 2D array arr with 4 rows and 5 columns. The array is filled using nested loops. Let's break this down:
arr[i][j] = 10*i + j; fills the array.arr[1] looks like: [10, 11, 12, 13, 14].arr[2] and arr[3] are filled, but those are not used in this particular question.The critical part of the question is the statement printf("%d", *(arr[1] + 9));.
arr[1] points to the start of the second row.arr[1] + 9 moves 9 positions ahead starting from arr[1][0]. This 2D array in C is stored in a row-major order:arr[1][0] (0th offset), arr[1][1] (1st offset), ..., arr[1][4] (4th offset)arr[2][0] (5th offset), arr[2][1] (6th offset), ..., arr[2][4] (9th offset)arr[2][4] or *(arr[1] + 9) gives value 24.Therefore, the program prints 24.
Suppose in a multiprogramming environment, the following C program segment is executed. A process goes into the I/O queue whenever an I/O related operation is performed. Assume that there will always be a context switch whenever a process requests an I/O, and also whenever the process returns from an I/O. The number of times the process will enter the ready queue during its lifetime (not counting the time the process enters the ready queue when it is run initially) is _________ (Answer in integer).

Arrange the following data types available in C language according to their size (smallest to largest):
A. signed long int
B. long double
C. unsigned char
D. unsigned int
Choose the correct answer from the options given below:
What is printed by the following ANSI C program?
#include<stdio.h>
int main(int argc, char argv[])
{
int a[3][3][3] = {
{1, 2, 3, 4, 5, 6, 7, 8, 9},
{10, 11, 12, 13, 14, 15, 16, 17, 18},
{19, 20, 21, 22, 23, 24, 25, 26, 27}};
int i = 0, j = 0, k = 0;
for( i = 0; i < 3; i++){
for(k = 0; k < 3; k++)
printf("%d ", a[i][j][k]);
printf("\n");
}
return 0;
}