Tag: programming languages

Questions Related to programming languages

  1. It is just a fancy keyword, No purpose here

  2. Prevents the compiler from assigning the function as an rvalue

  3. Prevents the compiler from assigning the function as an lvalue

  4. It makes sure that the return value is a const and is not changed by anyone else


Correct Option: C
  1. Nothing is wrong. You are wrong.

  2. Loops are not allowed inside the function scope, Since it degrades performance

  3. My friend tried to return a pointer to a local function variable , which is invalid once the function call compltes.

  4. The value i is not properly initialised, SO it may contain some garbage .


Correct Option: C
  1. const int* ptr

  2. const* int ptr

  3. There is no such declaration like that

  4. const int* const ptr


Correct Option: D
  1. They tell the C++ compiler that they are functions compiled by a C compiler , So that they can be used in C++

  2. they mean that the function are declared somewhere and defined somewhere

  3. They improve performance

  4. They are used with extern variables.


Correct Option: A