You are on page 1of 3

TUTORIAL QUESTIONS ON ARRAYS

(1) What will be output when you will execute the following program?

#include<stdio.h>
union A{
char p;
float const * const q;
};
int main(){
union A arr[10];
printf("%d",sizeof arr);
return 0;
}

(2) What will be output when you will execute the following program?

#include<stdio.h>
union A{
char character;
int ascii;
};
int main(){
union A arr[2]={{65},{'a'}};
printf("%c %c",arr[0],arr[1]);
return 0;
}

(3) What will be output when you will execute the following program?

#include<stdio.h>
typedef struct stu{
char * name;
int roll;
}s;
int main(){
s arr[2]={{"raja",10},{"rani",11}};
printf("%s %d",arr[0]);
return 0;
}
(4) What will be output when you will execute the following program?

#include<stdio.h>
struct A{
int p;
float q;
long double *r;
};
int main(){
struct A arr[10];
printf("%d",sizeof arr);

return 0;
}

(5) What will be output if you will execute following c code?

#include<stdio.h>
void main(){
char arr[7]="Network";
printf("%s",arr);

(6) What will be output if you will execute following c code?

#include<stdio.h>
void main(){
char arr[11]="The African Queen";
printf("%s",arr);

(7) What will be output if you will execute following c code?

#include<stdio.h>
void main(){
char arr[20]="MysticRiver";
printf("%d",sizeof(arr));
}
(8) What will be output if you will execute following c code?

#include<stdio.h>
#define var 3
void main(){
char *cricket[var+~0]={"clarke","kallis"};
char *ptr=cricket[1+~0];
printf("%c",*++ptr);
}

(9) What will be output if you will execute following c code?

#include<stdio.h>
#define var 3
void main(){
char data[2][3][2]={0,1,2,3,4,5,6,7,8,9,10,11};
printf("%o",data[0][2][1]);
}

You might also like