1. Question: What will be output of the following c program?
    #include<stdio.h>
    static num=5;
    extern int num;
    int main(){
        printf("%d",num);
        return 0;
    }
    int num =25;

    A
    0

    B
    5

    C
    25

    D
    Compilation error

    E
    None of these

    Note: Two or more global variables can have same name but we can initialize only one of them.
    1. Report
  2. Question: What will be output of the following c program?
    #include<stdio.h>
    static num;
    int main(){
        printf("%d",num);
        return 0;
    }
    int num =25;

    A
    0

    B
    1

    C
    25

    D
    Compilation error

    E
    None of these

    Note: Two or more global variables can have same name but we can initialize only one of them.
    1. Report
  3. Question: What will be output of the following c program?
    #include<stdio.h>
    int xyz=10;
    int main(){
        int xyz=20;
        printf("%d",xyz);
        return 0;
    }

    A
    10

    B
    20

    C
    30

    D
    Compilation error

    E
    None of these

    Note: Two variables can have same name in different scope.
    1. Report
  4. Question: What will be output of the following c program?
    #include<stdio.h>
    int main(){
        int xyz=20;
        int xyz;
        printf("%d",xyz);
        return 0;
    }

    A
    20

    B
    0

    C
    Garbage

    D
    Compilation error

    E
    None of these

    Note: Two local variables cannot have same name in same scope.
    1. Report
  5. Question: What will be output of the following c program?
    #include<stdio.h>
    int main(){
        int xyz=20;{
             int xyz=40;
        }
        printf("%d",xyz);
        return 0;
    }

    A
    20

    B
    40

    C
    0

    D
    Compilation error

    E
    None of these

    Note: Two variables can have same name in different scope.
    1. Report
  6. Question: What will be output of the following c program?
    #include<stdio.h>
    int main(){
        int main = 80;
        printf("%d",main);
        return 0;
    }

    A
    80

    B
    0

    C
    Garbage value

    D
    Compilation error

    E
    None of these

    Note: Variable name can be main.
    1. Report
  7. Question: What will be output of the following c program?
    #include<stdio.h>
    int main(){
        struct a{
             int a;
        };
        struct a b={10};
        printf(\"%d\",b.a);
        return 0;
    }

    A
    0

    B
    10

    C
    Garbage value

    D
    Compilation error

    E
    None of these

    Note: Two variables can have same name in different scope.
    1. Report
  8. 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
    Only (i),(ii) and are correct declaration

    E
    All four are correct declaration

    Note: Syntax of enum data type is: enum [<tag_name>]{ <enum_constanat_name> [=<integer_ value>], … } [<var_name>,…] Note: [] : Represents optional . <>: Represents any valid c identifier
    1. Report
  9. 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;
    }
    Choose all that apply:

    A
    0 0

    B
    65536 -10

    C
    0 65536

    D
    65536 0

    E
    Compilation error

    Note: Turbo C++ 3.0: 0 0 Turbo C ++4.5: 0 0 Linux GCC: 0 0 Visual C++: 0 0 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
    1. Report
  10. Question: Which of the following is not modifier of data type in c?

    A
    extern

    B
    interrupt

    C
    huge

    D
    register

    E
    All of these are modifiers of data type

    Note: Not available
    1. Report
Copyright © 2024. Powered by Intellect Software Ltd