Data Types

  1. What is the range of a signed char variable in C?
    1. 0 to 255
    2. -128 to 127
    3. 0 to 127
    4. -128 to 255
  1. View Hint | View Answer | Workspace | Discuss In Forum | Report

    char is a single byte variable. Signed char would include negative numbers as well

    Correct Option: B

    range of signed char variable is -128 to 127 because it is 1 byte long.
    2 to the power 8 is 256, range included 256 numbers, as it is signed, include negative integers starting from -128 to 127.

    Report

  1. Which of the following is the correct output for the program given below?
    #include <stdio.h>
    int main ( )
    {
    float floatvalue = 8.25;
    printf ("%d\n " , (int) floatvalue);
    return 0;
    }
    1. 0
    2. 0.0
    3. 8.0
    4. 8
  1. View Hint | View Answer | Workspace | Discuss In Forum | Report

    It prints '8'. because, we typecast the (int)floatvalue into integer. It converts the float value to the nearest integer value.

    Correct Option: D

    It prints '8'. because, we typecast the (int)floatvalue into integer. It converts the float value to the nearest integer value.

    Report

  1. Which of the following is valid range of long double ?
    1. 3.4E-4932 to 1.1E+4932
    2. 3.4E-4932 to 3.4E+4932
    3. 1.1E-4932 to 1.1E+4932
    4. 1.7E - 308 to 1.7E + 308
  1. View Hint | View Answer | Workspace | Discuss In Forum | Report

    1.7E-308 to 1.7E+308

    Correct Option: D

    1.7E-308 to 1.7E+308

    Report

  1. Which of the following is the correct datatype for the variable n in the statement given below?

    n = 35.29 ;
    1. float
    2. double
    3. long double
    4. Depends upon the memory model that you are using
  1. View Hint | View Answer | Workspace | Discuss In Forum | Report

    The 'float' is pretty enough to hold the data 23.45.

    Correct Option: A

    The 'float' is pretty enough to hold the data 23.45.

    Report

  1. Which of the following is the correct output for the program given below?
    #include <stdio.h>
    int main ( )
    {
    printf ("%d %d %d\n" , sizeof(2.19f), sizeof(2.19), sizeof (2.19l));
    return 0 ;
    }
    1. 4 4 4
    2. 4 8 8
    3. 4 8 10
    4. 4 8 12
  1. View Hint | View Answer | Workspace | Discuss In Forum | Report

    sizeof(2.19f) here '2.19f' specifies the float data type. Hence size of float is 4 bytes.

    sizeof(2.19) here '2.19' specifies the double data type. Hence size of float is 8 bytes.

    sizeof(2.19l) here '2.19l' specifies the long double data type. Hence size of float is 10 bytes.

    Correct Option: B

    sizeof(2.19f) here '2.19f' specifies the float data type. Hence size of float is 4 bytes.

    sizeof(2.19) here '2.19' specifies the double data type. Hence size of float is 8 bytes.

    sizeof(2.19l) here '2.19l' specifies the long double data type. Hence size of float is 10 bytes.

    Report