logo

CuriousTab

CuriousTab

Discussion


Home C Programming Declarations and Initializations Comments

  • Question
  • Which of the following is not user defined data type?

    1 :
    struct book
    {
        char name[10];
        float price;
        int pages;
    };
    2 :
    long int l = 2.35;
    3 :
    enum day {Sun, Mon, Tue, Wed};


  • Options
  • A. 1
  • B. 2
  • C. 3
  • D. Both 1 and 2

  • Correct Answer


  • Explanation
    C data types classification are

    1. Primary data types
      1. int
      2. char
      3. float
      4. double
      5. void
    2. Secondary data types (or) User-defined data type
      1. Array
      2. Pointer
      3. Structure
      4. Union
      5. Enum

    So, clearly long int l = 2.35; is not User-defined data type.
    (i.e.long int l = 2.35; is the answer.)


    Declarations and Initializations problems


    Search Results


    • 1. Is there any difference between following declarations?

      1 : extern int fun();
      2 : int fun();

    • Options
    • A. Both are identical
    • B. No difference, except extern int fun(); is probably in another file
    • C. int fun(); is overrided with extern int fun();
    • D. None of these
    • Discuss
    • 2. When we mention the prototype of a function?

    • Options
    • A. Defining
    • B. Declaring
    • C. Prototyping
    • D. Calling
    • Discuss
    • 3. In the following program where is the variable a getting defined and where it is getting declared?
      #include<stdio.h>
      int main()
      {
          extern int a;
          printf("%d\n", a);
          return 0;
      }
      int a=20;
      

    • Options
    • 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
    • Discuss
    • 4. Which of the following statements should be used to obtain a remainder after dividing 3.14 by 2.1?

    • Options
    • A. rem = 3.14 % 2.1;
    • B. rem = modf(3.14, 2.1);
    • C. rem = fmod(3.14, 2.1);
    • D. Remainder cannot be obtain in floating point division.
    • Discuss
    • 5. Is the following statement a declaration or definition?
      extern int i;

    • Options
    • A. Declaration
    • B. Definition
    • C. Function
    • D. Error
    • Discuss


    Comments

    Avatar
    Prakhar
    good content


Enter a new Comment