-- advertisement --

Variables

  1. Which of the following special symbol is allowed in a variable name ?
    1. * (star)
    2. |(vertical line)
    3. - (dash)
    4. _ (underscore)
  1. View Hint | View Answer | Workspace | Discuss In Forum | Report

    _ (underscore)

    Correct Option: D

    _ (underscore)

    Report

  1. By default a real number is treated as a
    1. float
    2. double
    3. long double
    4. Depends on the compiler you are using
  1. View Hint | View Answer | Workspace | Discuss In Forum | Report

    A real number is treated as double.

    Correct Option: B

    A real number is treated as double.

    Report

-- advertisement --


  1. Which of the following definition is correct ?
    1. int length ;
    2. char int ;
    3. int long ;
    4. float double ;
  1. View Hint | View Answer | Workspace | Discuss In Forum | Report

    Following are the reserved keywords in C and can not be used as a variable name
    auto
    else
    long
    switch
    break
    enum
    register
    typedef
    case
    extern
    return
    union
    char
    float
    short
    unsigned
    const
    for
    signed
    void
    continue
    goto
    sizeof
    volatile
    default
    if
    static
    while
    do
    int
    struct
    _Packed
    double

    Correct Option: A

    Following are the reserved keywords in C and can not be used as a variable name
    auto
    else
    long
    switch
    break
    enum
    register
    typedef
    case
    extern
    return
    union
    char
    float
    short
    unsigned
    const
    for
    signed
    void
    continue
    goto
    sizeof
    volatile
    default
    if
    static
    while
    do
    int
    struct
    _Packed
    double

    Report

  1. Which of the following is not a user-defined data type ?
    1. struct employ
      {
      char name[10];
      float salary;
      int workingdays;
      };
    2. long int k = 65.5;
    3. enum day {Sun, Mon, Tue, Wed};
    4. union xyz
      {
      int k;
      char ch[5];
      };
  1. View Hint | View Answer | Workspace | Discuss In Forum | Report

    structure, enum and union are user defined data.

    Correct Option: B

    structure, enum and union are user defined data.
    So correct answer is

    long int k = 65.5;

    Report

  1. Which of the following operations are INCORRECT ?
    1. int a = 15; a = a%5;
    2. short int b = 53; b = b%15;
    3. long int c = 125L; c = c % 14;
    4. float d = 6.128; d = d%7;
  1. View Hint | View Answer | Workspace | Discuss In Forum | Report

    The modulus (%) operator can only be used on integer types.

    Correct Option: D

    The modulus (%) operator can only be used on integer types.

    Report

-- advertisement --

-- advertisement --