You are not logged in.

#1 2015-09-16 05:14:59

husnain
User RankUser RankUser RankUser RankUser RankUser Rank
Administrator
From: Chichawatni,Pakistan
Registered: 2014-10-03
Posts: 8,129
Website

C Language Arrays And Strings Program Quiz:

C Programming Quizzes C Language Arrays And Strings

Directions:
Which of the following statements are correct about the program below?

Question:
#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 ]);
    }
}

Option A):
The code is erroneous since the statement declaring array is invalid
Option B):
The code is erroneous since the subscript for array used in for loop is in the range 1 to size
Option C):
The code is erroneous since the values of array are getting scanned through the loop
Option D):
The code is correct and runs successfully

Correct Answer is Option A):
The code is erroneous since the statement declaring array is invalid


You cannot discover the new oceans unless you have the courage to lose the sight of the shore.

2015-09-16 05:14:59

Advertisement
Ads By Google

Re: C Language Arrays And Strings Program Quiz:



Board footer