Data Types


  1. Pick the right option
    Statement (i) A definition is also a declaration.
    Statement (ii) An identifier can be declared just once.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    An identifier can be declared many times must be defined just once.


  1. Which of the given statements are false.
    (i). extern int func;
    (ii). extern int func2(int,int);
    (iii). int func2(int,int);
    (iv). extern class foo;











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    No extern are allowed for class declarations.



  1. Pick the right option
    Statement (i) Global values are not initialized by the stream.
    Statement (ii) Local values are implicitly initialised to 0.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Global values are implicitly initialised to 0, but local values have to be initialised by the system.


  1. Can two functions declare variables(non static) with the same name.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    We can declare variables with the same name in two functions because their scope lies within the function.



  1. What is the output of this program?
    #include 
    using namespace std;
    void Output()
    {
    static int p = 1;
    int k;
    for(k=p; k<=3; k++)
    {
    p++;
    cout << p;
    }
    }
    int main()
    {
    Output();
    Output();
    Output();
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    The variable that is declared as static has a file scope.