You are not logged in.

#1 2015-09-16 05:15:26

hasnain
Administrator
From: Chichawatni
Registered: 2014-10-13
Posts: 8,355
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


Failure is the first step towards seccess.

2015-09-16 05:15:26

Advertisement
Ads By Google

Re: C Language Arrays And Strings Program Quiz:



\n

Board footer