Home / C Programming / Declarations and Initializations :: General Questions

C Programming :: Declarations and Initializations

  1. What will be the output of the program?

    #include 
    int main()
     {   
         int X=40;    
         {        
             int X=20;       
             printf("%d ", X);    
         }     
         printf("%d\n", X);  
         return 0; 
     } 
    

     

  2. A.

    40 40

    B.

    20 40

    C.

    20

    D.

    Error

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. In the following program where is the variable a getting defined and where it is getting declared?

     #include
     int main() 
     {
         extern int a;    
         printf("%d\n", a);   
         return 0;
      } 
      int a=20; 
    

  4. A.

    extern int a is declaration, int a = 20 is the definition

    B.

    int a = 20 is declaration, extern int a is the definition

    C.

    int a = 20 is definition, a is not defined

    D.

    a is declared, a is not defined

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. When we mention the prototype of a function?

  6. A.
    Defining
    B.
    Declaring
    C.
    Prototyping
    D.
    Calling

    View Answer

    Workspace

    Discuss Discuss in Forum