Basic C Programming MCQ Questions and Answers

Practice Mode
Showing 10 of 198 questions
Q71
Consider the array definition int num [10] = (3, 3, 3); Pick the correct answers.
  • A num[9] is the last element of the array num
  • B The value of num [8] is 3
  • C The value of num [3] is 3
  • D None of the above
Answer: Option A
Q72
Consider the following type definition typedef char x[10]; x myArray [5]; What will sizeof(my Array) be? Assume one character occupied 1 byte)
  • A 15 bytes
  • B 10 bytes
  • C 50 bytes
  • D 30 bytes
Answer: Option C
Q73
While passing an array as an actual argument, the function call must have the array name
  • A with empty brackets
  • B with its size
  • C alone
  • D none of the above
Answer: Option C
Q74
The following program main () { Static int a[] = {7, 8, 9} printf ("%d", 2[a]) + a[2]));}
  • A results in bus error
  • B results in segmentation violation error
  • C will not compile successfully
  • D none of the above
Answer: Option D
Q75
The parameter passing mechanism for an array is
  • A call by value
  • B call by value-result
  • C call by reference
  • D none of these
Answer: Option A
Q76
Consider the statement int val[2] [4] = {1, 2, 3, 4, 5, 6, 7, 8,}; 4 will be the value o
  • A val [1] [4]
  • B val [0] [4]
  • C val [1] [1]
  • D none of the above
Answer: Option D
Q77
The maximum number of dimension an array can have C is
  • A 3
  • B 4
  • C 5
  • D compiler dependent
Answer: Option D
Q78
The following program fragment int m, n, b = m n = 8; char wer [80]; sprintf (wer, "%d%d%d", m n, b); puts (wer);
  • A prints the string 8 8 8
  • B prints the string 888
  • C prints the null string
  • D none of the above
Answer: Option C
Q79
Under which of the following conditions, the size of an one-dimensional array need not be specified?
  • A when initialization is a part of definition
  • B when it is a declaration
  • C when it is a formal parameter
  • D when it is an actual argument
Answer: Option
Q80
If a two dimensional array is used as a formal parameter, then
  • A both the subscripts may be left empty
  • B the first (row) subscript may be left empty
  • C the first subscript must be left empty
  • D both the subscripts must be left empty
Answer: Option B
Questions and Answers for Competitive Exams Various Entrance Test