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 28easy
Which function is used to convert a string to an integer in C?
Question 29easy
What does the fgets function in C do when it encounters a newline character?
Question 30medium
How can you check if two strings are equal in C?
Advertisement
Question 31easy
What is right way to Initialize array?
Question 32hard
What will be the output of the program?
#include<stdio.h>
void main()
{
int a[5] = {5, 1, 15, 20, 25};
int i, j, m;
i = ++a[1];
j = a[1]++;
m = a[i++];
printf("%d, %d, %d", i, j, m);
}Question 33hard
What will be the output of following program code?
#include <stdio.h>
int main(void)
{
char p;
char buf[10] = {1, 2, 3, 4, 5, 6, 9, 8};
p = (buf + 1)[5];
printf("%d", p);
return 0;
}Advertisement
Question 34hard
An array elements are always stored in ________ memory locations.
Question 35hard
Let x be an array. Which of the following operations are illegal? I. ++x II. x+1 III. x++ IV. x*2
Question 36easy
What is the maximum number of dimensions an array in C may have?