A PHP Error was encountered

Severity: Warning

Message: A non-numeric value encountered

Filename: controllers/home.php

Line Number: 222

A PHP Error was encountered

Severity: Warning

Message: A non-numeric value encountered

Filename: controllers/home.php

Line Number: 228

Structures, Unions, Enums - C Programming Questions and Answers
Home / C Programming / Structures, Unions, Enums :: Yes / No Questions

C Programming :: Structures, Unions, Enums

  1. If the following structure is written to a file using fwrite(), can fread() read it back successfully?

    
     struct emp
     {   
        char *n;    
        int age;
     };
     struct emp e={"Freshergate};
     FILE *fp; 
     fwrite(&e, sizeof(e), 1, fp); 
    

     

  2. A.

    Yes

    B.

    No

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. size of union is size of the longest element in the union

  4. A.
    Yes
    B.
    No

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. The elements of union are always accessed using & operator

  6. A.
    Yes
    B.
    No

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. Will the following code work?

     #include
     #include 
    
     struct emp 
     {   
        int len;  
        char name[1];
     };
     int main() 
     {   
        char newname[] = "Rahul";      
        struct emp *p = (struct emp *) malloc(sizeof(struct emp) -1 +                     strlen(newname)+1); 
        p->len = strlen(newname);       
        strcpy(p -> name, newname);     
        printf("%d %s\n", p->len, p->name);  
        return 0; 
    } 
    

  8. A.

    Yes

    B.

    No

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. A pointer union CANNOT be created

  10. A.
    Yes
    B.
    No

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. Is there easy way to print enumeration values symbolically?

  12. A.
    Yes
    B.
    No

    View Answer

    Workspace

    Discuss Discuss in Forum


  13. By default structure variable will be of auto storage class

  14. A.
    Yes
    B.
    No

    View Answer

    Workspace

    Discuss Discuss in Forum


  15. Is it necessary that the size of all elements in a union should be same?

  16. A.
    Yes
    B.
    No

    View Answer

    Workspace

    Discuss Discuss in Forum


  17. Can we have an array of bit fields?

  18. A.
    Yes
    B.
    No

    View Answer

    Workspace

    Discuss Discuss in Forum


  19. Will the following declaration work?

     typedef struct s
      {  
         int a;  
         float b;
      }s; 

     

  20. A.

    Yes

    B.

    No

    View Answer

    Workspace

    Discuss Discuss in Forum