OA. free
Free
Qualcomm Embedded Systems & Hardware Embedded Systems & Hardware Medium

Embedded Systems & Hardware

Qualcomm technical mcq question, verified with a worked answer. Free to practise - no sign-up.

int function(int UNO())
{
    UNO[5];          //line 1
    return 0;
}
Choose one option.
Show answer & explanation
Answer: A. It will show compile time error

The function parameter int UNO() declares UNO as a function pointer (a function that takes no arguments and returns int), not an array. The statement UNO[5] attempts to subscript a function pointer as if it were an array, which is invalid syntax. The compiler will reject this with a compile-time error because you cannot use array subscript notation on a function type.

Step-by-step Derivation:
Step-by-step analysis:

  1. int function(int UNO()) declares a function that accepts a parameter UNO, which is itself a function (returning int, taking no parameters).
  2. Inside the function body, UNO[5] attempts to use subscript notation [] on UNO.
  3. Since UNO is a function type (not an array or pointer-to-array), applying the subscript operator is a syntax error.
  4. The C compiler will reject this code at compile time with an error like "subscripted value is neither array nor pointer" or similar.
  5. Options B, C, D (numerical values) are not reachable because compilation fails before execution.
  6. Therefore, the answer is A: compile time error.