Arrays and Strings MCQs

133 questionsC-ProgramPage 6 of 15

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 46hard
What will be the output of the program if the array begins at address 65486?
#include<stdio.h>
void main()
{
    int arr[] = {12, 14, 15, 23, 45};
    printf("%u, %u", arr, &arr);
}
Question 47hard
What will be the output of the program?
#include<stdio.h>
void main()
{
    float arr[] = {12.4, 2.3, 4.5, 6.7};
    printf("%d", sizeof(arr)/sizeof(arr[0]));
}
Question 48easy
Which of the following is correct way to define the function fun() in the below program?
#include<stdio.h>
void main()
{
    int a[3][4];
    fun(a);
}
Advertisement
Question 49hard
Which of the following statements are correct about the program below?
#include<stdio.h>
void main()
{
    int size, i;
    scanf("%d", &size);
    int arr[size];
    for(i=1; i<=size; i++)
    {
        scanf("%d", arr[i]);
        printf("%d", arr[i]);
    }
}
Question 50hard
Which of the following statements are correct about an array? 1. The array int num[26]; can store 26 elements. 2. The expression num[1] designates the very first element in the array. 3. It is necessary to initialize the array at the time of declaration. 4. The declaration num[SIZE] is allowed if SIZE is a macro.
Question 51medium
If the two strings are identical, then strcmp() function returns
Advertisement
Question 52medium
The library function used to find the last occurrence of a character in a string is
Question 53hard
Which of the following function is used to find the first occurrence of a given string in another string?
Question 54medium
Which of the following function is more appropriate for reading in a multi-word string?