Learn with Anil · TGPSC HMWSSB Manager (Engineering) PYQsPractise online →Subscribe ₹149

TGPSC HMWSSB Manager Programming in C, C++ & Java previous year questions with answers

Every Programming in C, C++ & Java question asked in the TGPSC HMWSSB Manager (Engineering) papers on this site, grouped by topic. Answers come from TSPSC's final key; each has a short explanation (free here for a sample, all of them in the practice app).

Practise Programming in C, C++ & Java online

C Programming

  1. Manager 2015 Paper 2 (CS & IT) · Q95 · Programming in C, C++ & Java · C Programming

    Consider the following sequence of C language statements.

    typedef int * IntegerPointer
    IntegerPointer A,B;
    A= (IntegerPointer) malloc(sizeof(int));
    B= (IntegerPointer) malloc(sizeof(int));
    *A = 5;
    *B = 17;
    free (A);
    A=B;
    free (B);

    The above situation wherein A contains a pointer pointing to the location that B's pointer used to point to is known as

    1. dangling pointer
    2. side effect
    3. null pointer
    4. free pointer
    Show answer

    Answer: (1) dangling pointer

    Explanation: open it in the practice app. It needs the ₹149 All-in-One Pass: one payment for every exam on the site.

  2. Manager 2015 Paper 2 (CS & IT) · Q101 · Programming in C, C++ & Java · C Programming

    What is the output of following C language code?

    #include <stdio.h>
    int main ( )
    {
    static int i = 1;
    tun (i);
    tun (i);
    tun (i);
    printf("%d", i);
    }
    tun (int i)
    {
    i++;
    }
    1. 1
    2. 2
    3. 3
    4. 4
    Show answer

    Answer: (1) 1

    Explanation: open it in the practice app. It needs the ₹149 All-in-One Pass: one payment for every exam on the site.

  3. Manager 2015 Paper 2 (CS & IT) · Q107 · Programming in C, C++ & Java · C Programming

    Consider the following C program:

    main()
    {
        int x=5;
        printf("%d,%d,%d\n",x,x<<2,x>>2);
    }

    What could be the output of the above program?

    1. 5,20,5
    2. 4,4,1
    3. 5,20,1
    4. 20,20,5
    Show answer

    Answer: (3) 5,20,1

    Explanation: open it in the practice app. It needs the ₹149 All-in-One Pass: one payment for every exam on the site.

  4. Manager 2015 Paper 2 (CS & IT) · Q108 · Programming in C, C++ & Java · C Programming

    According to the precedence defined in the C language, arrange the operators ., ||, <, = in the ascending order of precedence.

    1. ., ||, <, =
    2. =, <, ||, .
    3. =, ||, <, .
    4. <, ||, =, .
    Show answer

    Answer: (3) =, ||, <, .

    Explanation: open it in the practice app. It needs the ₹149 All-in-One Pass: one payment for every exam on the site.

  5. Manager 2015 Paper 2 (CS & IT) · Q109 · Programming in C, C++ & Java · C Programming

    What is the output of the following programming C language code?

    for (i=1;i<5;++i)
    if(i==3) continue;
    else
    printf("%d", i);
    1. 1 2 4 5
    2. 1 2 4
    3. 2 4 5
    4. 3 3 3
    Show answer

    Answer: (2) 1 2 4

    Explanation: open it in the practice app. It needs the ₹149 All-in-One Pass: one payment for every exam on the site.

  6. Manager 2015 Paper 2 (CS & IT) · Q110 · Programming in C, C++ & Java · C Programming

    If n has the value 3, then the statement a[++n]=n++ results in _____

    1. a[5]=3
    2. a[5]=4
    3. a[4]=4
    4. a[4]=3
    Show answer

    Answer: (1) a[5]=3

    Explanation: open it in the practice app. It needs the ₹149 All-in-One Pass: one payment for every exam on the site.

  7. Manager 2015 Paper 2 (CS & IT) · Q111 · Programming in C, C++ & Java · C Programming

    Aliasing in the context of programming languages refers to

    1. Multiple variables having the same memory location
    2. Multiple variables having the same value
    3. Multiple variables having the same identifier
    4. Multiple use of the same variable
    Show answer

    Answer: (1) Multiple variables having the same memory location

    Explanation: open it in the practice app. It needs the ₹149 All-in-One Pass: one payment for every exam on the site.

  8. Manager 2015 Paper 2 (CS & IT) · Q115 · Programming in C, C++ & Java · C Programming

    Consider the following C program

    int x;
    main()
    {
        int x=0;
        {
            int x=10;
            x++;
            change_x(x);
            x++;
            modify_x();
            printf("%d ",x);
        }
        x++;
        change_x(x);
        printf("%d ",x);
        modify_x();
        printf("%d\n",x);
    }
    modify_x()
    {
        return (x+=10);
    }
    change_x()
    {
        return(x+=1);
    }

    What would be the output of the above program?

    1. 23 14 24
    2. 23 1 1
    3. 13 1 1
    4. 12 1 1
    Show answer

    Answer: (4) 12 1 1

    Explanation: open it in the practice app. It needs the ₹149 All-in-One Pass: one payment for every exam on the site.

  9. Manager 2015 Paper 2 (CS & IT) · Q140 · Programming in C, C++ & Java · C Programming

    Consider the following C declaration

    int (*f)();

    Which of the following statements correctly interprets the above declaration?

    1. f is a function which returns an integer
    2. f is a function which returns a pointer to an integer
    3. f is a function to pointer which returns an integer
    4. f is pointer to a function which returns an integer
    Show answer

    Answer: (4) f is pointer to a function which returns an integer

    Explanation: open it in the practice app. It needs the ₹149 All-in-One Pass: one payment for every exam on the site.

Object-Oriented Programming

  1. Manager 2015 Paper 2 (CS & IT) · Q127 · Programming in C, C++ & Java · Object-Oriented Programming

    Which one of the following statements is correct?

    1. Abstraction is the classification of objects, grouped according to their significant similarities
    2. Abstraction is the classification of objects, grouped according to their significant differences
    3. Abstraction is the classification of objects, grouped according to their names
    4. Abstraction is hiding information inside a class so that it can only be known in an abstract manner
    Show answer

    Answer: (4) Abstraction is hiding information inside a class so that it can only be known in an abstract manner

    Explanation: open it in the practice app. It needs the ₹149 All-in-One Pass: one payment for every exam on the site.