c-programming-mcqs - Set (5)

Correct Answer: Orange && Worng Answer: Red

1. By default a function returns a value of type

  • (A). Int
  • (B). Char
  • (C). Void
  • (D). None of these
  • View Answer

    Explanation: Not Avilable

    2. Which of the following are a collection of different data typed ?

  • (A). Array
  • (B). Structure
  • (C). Char
  • (D). All of the above
  • View Answer

    Explanation: Not Avilable

    3. Which of the following can never be sent by call by value ?

  • (A). Variable
  • (B). Array
  • (C). Structure
  • (D). Both (a) and (c)
  • View Answer

    Explanation: Not Avilable

    4. Collection of similar data type is _______

  • (A). Array
  • (B). Structure
  • (C). Vector
  • (D). None of the above
  • View Answer

    Explanation: Not Avilable

    5. Which function is used to release the memory allotted in dynamic memory allocation ?

  • (A). Malloc()
  • (B). Free()
  • (C). Calloc()
  • (D). Delecte
  • View Answer

    Explanation: Malloc() function in C is used to dynamically allocate a block of memory with specified size.

    6. Member of union use :

  • (A). Different storage locations
  • (B). Same storage locations
  • (C). No storage locations
  • (D). None of these
  • View Answer

    Explanation: Unions provide an efficient way of using the same memory location for multiple-purpose.

    7. Which of the following is example of call by value ?

  • (A). Num(*a, *b)
  • (B). Num(a,b)
  • (C). Num(&a,&b)
  • (D). None of the above
  • View Answer

    Explanation: Not Avilable

    8. How many elements can be store in the array A[35] ?

  • (A). 36
  • (B). 37
  • (C). 35
  • (D). 34
  • View Answer

    Explanation: Not Avilable

    9. An array is a collection of :

  • (A). Different data types scattered throughout memory
  • (B). The same data type scattered throughout memory
  • (C). the same data type placed next to each other in memory
  • (D). Different data types placed next to each other in memory
  • View Answer

    Explanation: Not Avilable

    10. If int S[5] is a one-dimensional array of integers, which of the following refers to the third element in the array ?

  • (A). *(S+2)
  • (B). *(S+3)
  • (C). S+3
  • (D). S+2
  • View Answer

    Explanation: Not Avilable

    11. Which you pass an array as an argument to a function, what actually gets passed ?

  • (A). Address of the array
  • (B). Values of the elements of the array
  • (C). Address of the first element of the array
  • (D). Number of elements of the array
  • View Answer

    Explanation: When we pass an array as a funtion argument, it will pass only base address i.e. address of first element of array.

    12. What is the difference between the 5’s in these two expressions? int num[5]; num[5]=11; select the correct answer.

  • (A). First is particular element, second is type
  • (B). First is array size, second is particular element
  • (C). First is particular elements, second is array size
  • (D). Both specify array size
  • View Answer

    Explanation: Not Avilable

    13. What will happen if you assign a value to an element of an array whose subscript exceeds the size of the array?

  • (A). The element will be to 0
  • (B). Nothing its done all the time
  • (C). Other data may be overwritten
  • (D). Error message from the compiler
  • View Answer

    Explanation: The program may crash if some important data gets overwritten.

    14. Given the statement maruti. engine. bolts=25; which of the following is true ?

  • (A). Structure bolts is nested within structure engine
  • (B). Structure engine is nested within structure maruti
  • (C). Structure maruti is nested within structure engine
  • (D). Structure maruti is nested within structure bolts
  • View Answer

    Explanation: Not Avilable

    15. An array elements are always stored in _________ memory locations.

  • (A). Sequential
  • (B). Random
  • (C). Sequential and Random
  • (D). None of the above
  • View Answer

    Explanation: Not Avilable