1. Question: Which of the following is not modifier of data type in c?

    A
    extern

    B
    interrupt

    C
    huge

    D
    register

    E
    All are modifiers of data type

    Note: na
    1. Report
  2. Question: What will be output when you will execute following c code?
    #include<stdio.h>
    int main(){
        double num=5.2;
        int  var=5;
        printf(\"%d\\t\",sizeof(!num));
        printf(\"%d\\t\",sizeof(var=15/2));
        printf(\"%d\",var);
        return 0;
    }

    A
    4 2 7

    B
    4 4 5

    C
    2 2 5

    D
    2 4 7

    E
    8 2 7

    Note: sizeof(Expr) operator always returns the an integer value which represents the size of the final value of the expression expr. Consider on the following expression: !num =!5.2 =0 0 is int type integer constant and it size is 2 by in TURBO C 3.0 compiler and 4 in the TURBO C 4.5 and Linux GCC compilers. Consider on the following expression: var = 15/2 => var = 7 => 7 7 is int type integer constant. Any expression which is evaluated inside the sizeof operator its scope always will be within the sizeof operator. So value of variable var will remain 5 in the printf statement.
    1. Report
  3. Question: What will be output when you will execute following c code?
    #include<stdio.h>
    int main(){
        const int *p;
        int a=10;
        p=&a;
        printf("%d",*p);
        return 0;
    }

    A
    0

    B
    10

    C
    Garbage value

    D
    Any memory address

    E
    Error: Cannot modify const object

    Note: In the following declaration const int *p; p can keep address of constant integer.
    1. Report
  4. Question: Consider on following declaration: (i)short i=10; (ii) static i=10; (iii) unsigned i=10; (iv) const i=10; Choose correct one:

    A
    Only (iv) is incorrect

    B
    Only (ii) and (iv) are incorrect

    C
    Only (ii),(iii) and (iv) are correct

    D
    Only (iii) is correct

    E
    All are correct declaration

    Note: Default data type of above all declaration is int.
    1. Report
  5. Question: What will be output when you will execute following c code?
    #include<stdio.h>
    int main(){
        int a= sizeof(signed) +sizeof(unsigned);
        int b=sizeof(const)+sizeof(volatile);
        printf("%d",a+++b);
        return 0;
    }

    A
    10

    B
    9

    C
    8

    D
    Error: Cannot find size of modifiers

    E
    Error: Undefined operator +++

    Note: Default data type of signed, unsigned, const and volatile is int. In turbo c 3.0 size of int is two byte. So, a = 4 and b =4 Now, a+++b = a++ + b = 4 + 4 //due to post increment operator. =8 Note: In turbo c 4.5 and Linux gcc compiler size of int is 4 byte so your out will be 16
    1. Report
  6. Question: What will be output when you will execute following c code?
    #include<stdio.h>
    int main(){
        int a= sizeof(signed) +sizeof(unsigned);
        int b=sizeof(const)+sizeof(volatile);
        printf("%d",a+++b);
        return 0;
    }

    A
    10

    B
    9

    C
    8

    D
    Error: Cannot find size of modifiers

    E
    Error: Undefined operator +++

    Note: Turbo C++ 3.0: 8 Turbo C ++4.5: 8 Linux GCC: 16 Visual C++: 16 Default data type of signed, unsigned, const and volatile is int. In turbo c 3.0 size of int is two byte. So, a = 4 and b =4 Now, a+++b = a++ + b = 4 + 4 //due to post increment operator. =8 Note: In turbo c 4.5 and Linux gcc compiler size of int is 4 byte so your out will be 16
    1. Report
  7. Question: What will be output when you will execute following c code?
    #include<stdio.h>
    int main(){
        signed x,a;
        unsigned y,b;
        a=(signed)10u;
        b=(unsigned)-10;
        y = (signed)10u + (unsigned)-10;
        x = y;
        printf("%d  %u\t",a,b);
        if(x==y)
             printf("%d %d",x,y);
        else if(x!=y)
             printf("%u  %u",x,y);
        return 0;
    }

    A
    10 -10 0 0

    B
    10 -10 65516 -10

    C
    10 -10 10 -10

    D
    10 65526 0 0

    E
    Compilation error

    Note: Turbo C++ 3.0: 10 65526 0 0 Turbo C ++4.5: 10 65526 0 0 Linux GCC: 10 4294967286 0 0 Visual C++: 10 4294967286 0 0 a=(signed)10u; signed value of 10u is +10 so, a=10 b=(unsigned)-10; unsigned value of -10 is : MAX_VALUE_OF_UNSIGNED_INT – 10 + 1 In turbo c 3.0 complier max value of unsigned int is 65535 So, b = 65526 y = (signed)10u + (unsigned)-10; = 10 + 65526 = 65536 = 0 (Since 65536 is beyond the range of unsigned int. zero is its corresponding cyclic vlaue) X = y = 0
    1. Report
  8. Question: Which of the following is integral data type?

    A
    void

    B
    char

    C
    float

    D
    double

    E
    None of these

    Note: In c char is integral data type. It stores the ASCII value of any character constant.
    1. Report
  9. Question: What will be output when you will execute following c code?
    #include<stdio.h>
    int main(){
        volatile int a=11;
        printf("%d",a);
        return 0;
    }

    A
    11

    B
    Garbage

    C
    -2

    D
    We cannot predict

    E
    Compilation error

    Note: We cannot predict the value of volatile variable because its value can be changed by any microprocessor interrupt.
    1. Report
  10. Question: What is the range of signed int data type in that compiler in which size of int is two byte?

    A
    -255 to 255

    B
    -32767 to 32767

    C
    -32768 to 32768

    D
    -32767 to 32768

    E
    -32768 to 32767

    Note: Note: Size of int is always equal to word length of micro preprocessor in which your compiler has based.
    1. Report
Copyright © 2024. Powered by Intellect Software Ltd