1. Question: Which of the following range is a valid long double (Turbo C in 16 bit DOS OS) ?

    A
    3.4E-4932 to 1.1E+4932

    B
    3.4E-4932 to 3.4E+4932

    C
    1.1E-4932 to 1.1E+4932

    D
    1.7E-4932 to 1.7E+4932

    Note: Not available
    1. Report
  2. Question: Which statement will you add in the following program to work it correctly? #include<stdio.h> int main() { printf("%f\n", log(36.0)); return 0; }

    A
    #include<conio.h>

    B
    #include<math.h>

    C
    #include<stdlib.h>

    D
    #include<dos.h>

    Note: Not available
    1. Report
  3. Question: We want to round off x, a float, to an int value, The correct way to do is

    A
    y = (int)(x + 0.5)

    B
    y = int(x + 0.5)

    C
    y = (int)x + 0.5

    D
    y = (int)((int)x + 0.5)

    Note: Not available
    1. Report
  4. Question: The binary equivalent of 5.375 is

    A
    101.101110111

    B
    101.011

    C
    101011

    D
    None of above

    Note: Not available
    1. Report
  5. Question: A float occupies 4 bytes. If the hexadecimal equivalent of these 4 bytes are A, B, C and D, then when this float is stored in memory in which of the following order do these bytes gets stored?

    A
    ABCD

    B
    DCBA

    C
    0xABCD

    D
    Depends on big endian or little endian architecture

    Note: Not available
    1. Report
  6. Question: What will you do to treat the constant 3.14 as a float?

    A
    use float(3.14f)

    B
    use 3.14f

    C
    use f(3.14)

    D
    use (f)(3.14)

    Note: Not available
    1. Report
  7. Question: Which of the following statement obtains the remainder on dividing 5.5 by 1.3 ?

    A
    rem = (5.5 % 1.3)

    B
    rem = modf(5.5, 1.3)

    C
    rem = fmod(5.5, 1.3)

    D
    Error: we can't divide

    Note: Not available
    1. Report
  8. Question: What will be output when you will execute following c code?
    #include<stdio.h>
    int main(){
        printf("%d\t",sizeof(6.5));
        printf("%d\t",sizeof(90000));
        printf("%d",sizeof('A'));
        return 0;
    }

    A
    4 2 1

    B
    8 2 1

    C
    4 4 1

    D
    8 4 2

    Note: By default data type of numeric constants is: 6.5 : double 90000: long int 'A': char In C size of data type varies from compiler to compiler. In TURBO C 3.0 (16 bit compilers) size of: double is 8 byte Long int is 4 byte Character constant is 2 byte (size of char data type is one byte) In TURBO C 4.5 or Linux GCC compilers (32 bit compilers) size of: double is 8 byte long int is 8 byte Character constant is 2 byte
    1. Report
  9. Question: Consider on following declaring of enum. (i) enum cricket {Gambhir,Smith,Sehwag}c; (ii) enum cricket {Gambhir,Smith,Sehwag}; (iii)enum {Gambhir,Smith=-5,Sehwag}c; (iv)enum c {Gambhir,Smith,Sehwag}; Choose correct one:

    A
    Only (i) is correct declaration

    B
    Only (i) and (ii) is correct declaration

    C
    Only (i) and (iii) are correct declaration

    D
    All four are correct declaration

    E
    Only (i),(ii) and are correct declaration

    Note: <b> Syntax of enum data type is:</b> <blockquote class="quote"> enum [<tag_name>]{ <enum_constanat_name> [=<integer_ value>], … } [<var_name>,…] </blockquote> <b>Note:</b> [] : Represents optional . <>: Represents any valid c identifierAuthor:
    1. Report
  10. Question: What will be output when you will execute following c code?
    #include<stdio.h>
    int main(){
        signed x;
        unsigned y;
        x = 10 +- 10u + 10u +- 10;
        y = x;
        if(x==y)
             printf("%d %d",x,y);
        else if(x!=y)
             printf("%u  %u",x,y);
        return 0;
    }

    A
    0 0

    B
    65536 -10

    C
    0 65536

    D
    65536 0

    E
    Compilation error

    Note: Consider on the expression: x = 10 +- 10u + 10u +- 10; 10: It is signed integer constant. 10u: It is unsigned integer constant. X: It is signed integer variable. In any binary operation of dissimilar data type for example: a + b Lower data type operand always automatically type casted into the operand of higher data type before performing the operation and result will be higher data type. As we know operators enjoy higher precedence than binary operators. So our expression is: x = 10 + (-10u) + 10u + (-10); = 10 + -10 + 10 + (-10); = 0 Note: Signed is higher data type than unsigned int. So, Corresponding signed value of unsigned 10u is +10 [/b]Author:[/b]
    1. Report
Copyright © 2024. Powered by Intellect Software Ltd