Arrays and Strings MCQs
Practice free Arrays and Strings multiple-choice questions with instant answer feedback and step-by-step solutions. Click an option to check yourself, reveal the full explanation, and work through all 133 questions — no login required.
Question 37hard
Size of the array need not be specified, when
Question 38hard
Consider the following type definition.
What will sizeof(myArray) be ? (Assume one character occupies 1 byte)
typedef char x[10];
x myArray[5];What will sizeof(myArray) be ? (Assume one character occupies 1 byte)
Question 39hard
What will be printed after execution of the following code?
void main()
{
int arr[10] = {1,2,3,4,5};
printf("%d", arr[5]);
}Advertisement
Question 40medium
What will be the output of the following program?
void main()
{
char str1[] = "abcd";
char str2[] = "abcd";
if(str1==str2)
printf("Equal");
else
printf("Unequal");
}Question 41hard
What will be the output of the following code?
void main()
{
int a[10];
printf("%d %d", a[-1], a[12]);
}Question 42hard
What does the following declaration mean? int (*ptr)[10];
Advertisement
Question 43medium
Array passed as an argument to a function is interpreted as
Question 44hard
What will be the output of the program if the array begins at 65472 and each integer occupies 2 bytes?
#include<stdio.h>
void main()
{
int a[3][4] = {1, 2, 3, 4, 4, 3, 2, 1, 7, 8, 9, 0};
printf("%u, %u", a+1, &a+1);
}Question 45hard
What will be the output of the program?
#include<stdio.h>
int main()
{
int arr[1] = {10};
printf("%d", 0[arr]);
return 0;
}