15799_eep28

Embed Size (px)

Citation preview

  • 7/30/2019 15799_eep28

    1/20

    1. Which of the following is false for switch statement in C++?

    a. It uses labels instead of blocks

    b. we need to put break statement at the end of the group of statement of a

    condition

    c. we can put range for case such as case 1..3

    d. None of above

    ANS:C

    2. In case of pass by reference

  • 7/30/2019 15799_eep28

    2/20

    a. The values of those variables are passed to the function so that it can

    manipulate them

    b. The location of variable in memory is passed to the function so that it can use

    the same memory area for its processing

    c. The function declaration should contain ampersand (& in its type

    declaration

    d. All of above

    ANS: B

  • 7/30/2019 15799_eep28

    3/20

    3. What will be the output of the following arithmetic expression ?

    5+3*2%10-8*6

    a) -37

    b) -42c) -32

    d) -28

    ans:A

  • 7/30/2019 15799_eep28

    4/20

    4. What will be the output of the following statement ?

    int a=10; printf("%d &i",a,10);

    a) error

    b) 10c) 10 10

    d) none of these

    ANS:D

  • 7/30/2019 15799_eep28

    5/20

    5. What will be the output of the following statement ?

    printf("%X%x%ci%x",11,10,'s',12);

    a) error

    b) basicc) Bas94c

    d) none of these

    ANS:B

  • 7/30/2019 15799_eep28

    6/20

    6. What will be the output of the following statements ?

    int a = 4, b = 7,c; c = a = = b; printf("%i",c);

    a) 0

    b) errorc) 1

    d) garbage value

    ANS:A

  • 7/30/2019 15799_eep28

    7/20

    7.What will be the output of the following statement ?printf( 3 + "goodbye");

    a) goodbye

    b) odbyec) bye

    d) dbye

    ANS:(D)

  • 7/30/2019 15799_eep28

    8/20

    8.What will be the output of the following statements ?int a = 5, b = 2, c = 10, i = a>b

    void main()

    { printf("hello"); main(); }

    a) 1

    b) 2

    c) infinite number of times

    d) none of these

    ANS: C

  • 7/30/2019 15799_eep28

    9/20

    9. What will be the output of the following program ?

    #include

    void main()

    { int a = 2;

    switch(a){ case 1:

    printf("goodbye"); break;

    case 2:

    continue;

    case 3:

    printf("bye");

    }

    }

    a) errorb) goodbye

    c) bye

    d) byegoodbye

    ans:A

    10 . What will be the output of the following statements ?

  • 7/30/2019 15799_eep28

    10/20

    int i = 1,j; j=i--- -2; printf("%d",j);

    a) error

    b) 2

    c) 3

    d) -3

    ANS:C (3)

    11. What will be the output of following program ?

    #include

  • 7/30/2019 15799_eep28

    11/20

    main()

    {

    int x,y = 10;

    x = y * NULL;

    printf("%d",x);

    }

    a) error

    b) 0

    c) 10

    d) garbage value

    ANS: (B). 0

    12.

    What will be the output of the following statements ?

  • 7/30/2019 15799_eep28

    12/20

    int i = 3;

    printf("%d%d",i,i++);

    a) 34

    b) 43

    c) 44d) 33

    (b):4,3

    13.

    void main()

    {

  • 7/30/2019 15799_eep28

    13/20

  • 7/30/2019 15799_eep28

    14/20

    printf("\n%d", sizeof(str));

    }

    1) 7

    2) 63) 5

    4) error

    ans(2)

    1. 15. Evaluate !(1 && !(0 || 1))

    a. True

    b. False

  • 7/30/2019 15799_eep28

    15/20

    c. Unevaluated table

    d. None of the above

    Ans:a

    16. Which of the following function sets first n characters of a string to

    a given character?

    A. strinit() B. strnset()

    C. strset() D. strcset()

  • 7/30/2019 15799_eep28

    16/20

    ans :B

    17. main( ) {

    printf ( "%c", "abcdefgh"[4] ) ;

    }

    A. e

    B.abcde

  • 7/30/2019 15799_eep28

    17/20

    C.efgh

    D.Error

    ANS:A

    18. Find the output.

    main( ) {printf ( "\n%d%d", sizeof ( 3 ), sizeof ( "3" ), sizeof ( 3 ) ) ;}

    A. 12

    B.123C.1234

    D. Error

  • 7/30/2019 15799_eep28

    18/20

    ANS:a

    19.Find the output.

    #include

    #include

    int main()

    {char str[] = "Programming";

    printf("%s ",&str[2]);

  • 7/30/2019 15799_eep28

    19/20

    printf("%s ",str);

    printf("%s ",&str);

    return(0);

    }

    1. ogramming Programming Programming

    2. ogramming Programming < Garbage Value >

    3. Programming ogramming Programming

    4. Program Compiled with Syntax Errors

    ANS:1

    20: char txt [20] = "Hello world!\0";How many bytes are allocated by the definition above?A. 11 bytesB. 12 bytes

    C.13 bytes

    D. 20 bytes

  • 7/30/2019 15799_eep28

    20/20

    ANS:D