C Arrays Questions and Answers

Practice Mode
Showing 10 of 50 questions
Q21
to initialize a 5 element array all having value 1 is given by
  • A int num [5] = {1};
  • B int num [4] = {1, 1, 1, 1, 1};
  • C int num [5] = {1, 1, 1, 1, 1};
  • D int num [ ] = {1};
Answer: Option C
Q22
To initialize a 5 element array all having value 0 is given by
  • A int num [5] = {0};
  • B int num [5] = {1, 1, 1, 1, 1};
  • C options a and b
  • D int num [ ] = ( 1 )
Answer: Option C
Q23
The declaration float f[ ] [ 3] = {{1, 0}, {2.0}, {3, 0}} represents
  • A a one - by-three array
  • B a three by-one-array
  • C a three - by-three array
  • D a one-by-one-array
Answer: Option C
Q24
A char array with the string value "aeiou" can be initialized as
  • A char s [ ] = {'a', 'e' 'i', 'o', 'u'};
  • B char s [ ] = "aeiou ";
  • C char s [ ] = {'a', 'e', 'i', 'o','u', '\0'};
  • D options b and c
Answer: Option D
Q25
If the size of an array is less than the number of initializers,
  • A the extra values are neglected
  • B it is an error
  • C the size is automatically increased
  • D the size is neglected
Answer: Option B
Q26
Identify the correct statement.
  • A Float array can be read as a whole.
  • B intger array can be read as a whole
  • C Char array can be read as a whole.
  • D Double array can be read as a whole.
Answer: Option C
Q27
Identify the correct statement.
  • A Float array can be displayed by using single printf () without using a loop.
  • B integer array can be displayed by using single printf () without using a loop.
  • C Char array can be displayed by using single printf () without using a loop.
  • D Double array can be displayed by using single printf () without using a loop.
Answer: Option C
Q28
Missing elements of partly initialized arrays, are
  • A set to zero
  • B set to one
  • C not defined
  • D invalid
Answer: Option A
Q29
The declaration of array main () { int a [10]; - - - }
  • A reserves the space required for 11 elements
  • B reserves space for 9 elements
  • C does not initialize any element
  • D initializes the values of all elements to 0
Answer: Option C
Q30
The value within the [ ] in an array declaration specifies
  • A subscript value
  • B index value
  • C size of an array
  • D value of the array element
Answer: Option C
Questions and Answers for Competitive Exams Various Entrance Test