|Programming Languages and Computer Graphics PYQs

UGC NET Computer Science Programming Languages and Computer Graphics Previous Year Questions (PYQs)

Practise 42 Programming Languages and Computer Graphics questions asked in UGC NET Computer Science from 2020–2025. Questions cover Language design, Programming paradigms, C and C++ constructs, Java, Storage management and Web technologies. Every question is shown with its options and the correct answer, free to read.

42 PYQs2020–2025Answers includedFree

Practise Programming Languages and Computer Graphics as timed sets

Focused 10-question sets with instant scoring, explanations, and weak-area analysis.

Start practice

All 42 Programming Languages and Computer Graphics PYQs

Ordered newest exam first. Each question links back to the full paper it came from.

  1. Which statement is not true about global variables?

    1. AValues of global variables sent to a called function may be changed inadvertently by that function.
    2. BFunctions lose their independence and isolation when they use global variables.
    3. CIt is not immediately apparent to a reader which values are sent to a called function.
    4. DA function that uses global variables does not suffer from reusability.

    Answer: (D) A function that uses global variables does not suffer from reusability.

    Explanation

    Sign in to read the full explanation
  2. The light given off by a phosphor during exposure to an electron beam is known as

    1. AFluorescence
    2. BPhosphorescence
    3. CPersistence
    4. DRetracing

    Answer: (A) Fluorescence

    Explanation

    Sign in to read the full explanation
  3. Match C file functions with their uses.

    List-IList-II
    A. fseek()
    B. ftell()
    C. feof()
    D. rewind()
    I. Current file position
    II. Beginning of file
    III. Desired file position
    IV. End-of-file test
    1. AA-II, B-III, C-I, D-IV
    2. BA-III, B-I, C-IV, D-II
    3. CA-III, B-I, C-II, D-IV
    4. DA-II, B-IV, C-III, D-I

    Answer: (B) A-III, B-I, C-IV, D-II

    Explanation

    Sign in to read the full explanation
  4. Arrange the 2-D viewing transformation pipeline.

    A. Convert world coordinates to viewing coordinates.
    B. Map viewing coordinates to normalized viewing coordinates using window–viewport specifications.
    C. Construct the world-coordinate scene using modelling-coordinate transformations.
    D. Map normalized viewport coordinates to device coordinates.

    1. AD, C, B, A
    2. BD, C, A, B
    3. CC, A, B, D
    4. DB, C, A, D

    Answer: (C) C, A, B, D

    Explanation

    Sign in to read the full explanation
  5. Consider the conditional statement if (m == 20 - 10 || n > 10). What is the order of execution of the following operations?

    A. ==
    B. -
    C. ||
    D. >

    1. AD, B, A, C
    2. BB, D, C, A
    3. CB, D, A, C
    4. DA, B, D, C

    Answer: (C) B, D, A, C

    Explanation

    Sign in to read the full explanation
  6. Which of the following statements is not true?

    1. AA data member of a class can be declared static and is normally used to maintain values common to the entire class.
    2. BA friend function can be invoked like a normal function without the help of any object.
    3. CThe scope-resolution operator (::) can be overloaded like normal operators.
    4. DMultiple inheritance may duplicate inherited members from a grandparent base class; this may be avoided by making the common base class virtual.

    Answer: (C) The scope-resolution operator (::) can be overloaded like normal operators.

    Explanation

    Sign in to read the full explanation
  7. The major adverse side effects of scan conversion are:

    A. Staircase appearance
    B. Unequal brightness of slanted lines
    C. Picket-fence problem
    D. Rasterization
    E. Pre-filtering and post-filtering

    1. AA and B only
    2. BA, B and C only
    3. CB, C and D only
    4. DC, D and E only

    Answer: (B) A, B and C only

    Explanation

    Sign in to read the full explanation
  8. Consider:

    int x = 10, y = 15;
    x = ((x = y) ? (y + x) : (y - x));

    What is the value of x after execution?

    1. A5
    2. B25
    3. C15
    4. D30

    Answer: (D) 30

    Explanation

    Sign in to read the full explanation
  9. Which of the following statements about
    pointers in C are TRUE.
    A. Pointers can be used to access array elements
    B. Pointers can store the address of another
    pointer
    C. Pointers are automatically dereferenced in
    expression
    D. Pointers cannot be used to access structure
    members

    1. A(A) and (C) Only
    2. B(A) and (B) Only
    3. C(B) and (C) Only
    4. D(C) and (D) Only

    Answer: (B) (A) and (B) Only

    Explanation

    Sign in to read the full explanation
  10. Consider the function in C code :

    Cal(a, b) {
    if( b!=1 ) {
    if( a!=1 ) {
    printf("*");
    Cal(a/2,b);
    }
    else {
    b=b-1;
    Cal(10,b);
    }
    }
    }
    How many times * is going to be printed, if the
    function is called with Cal(10, 10); ?
    
    1. A25
    2. B23
    3. C24
    4. D27

    Answer: (D) 27

    Explanation

    Sign in to read the full explanation
  11. Which of the following is correct way to declare a
    functional pointer in C ?

    1. Aint *func (int, int);
    2. Bint (*func) (int, int);
    3. Cint (func*) (int, int);
    4. Dint func (int, int);

    Answer: (B) int (*func) (int, int);

    Explanation

    Sign in to read the full explanation
  12. Consider the following C program :

    #include<stdio.h>
    int main() {
    int x[] = {2,4,6,8,10};
    int a, b=0, *y=x+4;
    for( a=0; a<5; a++) {
    b = b +(*y-a) - *(y-a);
    }
    printf("%d\n",b);
    return 0;
    }
    What will be the output of the above C program
    ?
    
    1. A4
    2. B6
    3. C8
    4. D10

    Answer: (D) 10

    Explanation

    Sign in to read the full explanation
  13. Which of the following are TRUE about
    constructors in C++ ?
    A. A constructor can be overloaded.
    B. A constructor does not have a return type.
    C. A constructor must be declared as a friend
    function.
    D. A constructor is called when an object is
    destroyed.

    1. A(B), (C), (D) Only
    2. B(B), (C) Only
    3. C(A), (B), (C) Only
    4. D(A), (B) Only

    Answer: (D) (A), (B) Only

    Explanation

    Sign in to read the full explanation
  14. #include<stdio.h>
    void f1(char *x, char *y) {
    char *t1;
    t1 = x;
    x = y;
    y = t1;
    }
    void f2(char **x, char **y) {
    char *t1;
    t1 = *x;
    *x = *y;
    *y = t1;
    }
    int main() {
    char *a = "ONE", *b = "TWO";
    f1(a, b);
    printf("%s %s ", a, b);
    f2(&a, &b);
    printf("%s %s", a, b);
    return 0;
    }
    

    What is the output of the program?

    1. AONE TWO TWO ONE
    2. BTWO ONE ONE TWO
    3. CONE TWO ONE TWO
    4. DTWO ONE TWO ONE

    Answer: (A) ONE TWO TWO ONE

    Explanation

    Sign in to read the full explanation
  15. Which of the following C++ statements correctly
    declares an abstract class ?

    1. Aclass A { virtual void show ()=0 ; };
    2. Bclass A { void show ()=0 ; };
    3. Cclass A { void show() { } ; } ;
    4. Dclass A { show ()=0; };

    Answer: (A) class A { virtual void show ()=0 ; };

    Explanation

    Sign in to read the full explanation
  16. Match List-I with List-II.

    List-I (computing systems)List-II (working/output)
    (A) Half Adder(I) Has n input and 2ⁿ output
    (B) Decoder(II) CPU Storage Unit
    (C) Register(III) Used to store program at runtime
    (D) Main memory(IV) 2-bit addition circuit
    1. A(A)-(II), (B)-(III), (C)-(IV), (D)-(I)
    2. B(A)-(IV), (B)-(II), (C)-(III), (D)-(I)
    3. C(A)-(IV), (B)-(I), (C)-(II), (D)-(III)
    4. D(A)-(II), (B)-(IV), (C)-(III), (D)-(I)

    Answer: (C) (A)-(IV), (B)-(I), (C)-(II), (D)-(III)

    Explanation

    Sign in to read the full explanation
  17. Consider the following statements regarding
    combinational and sequential circuits.
    A. Output of combinational circuits depends on
    the only current input.
    B. Output of combinational circuit depends on
    the both current input and previous output.
    C. Output of sequential circuit depends on the
    current input.
    D. Output of sequential circuit depends on both
    current input and previous output.

    1. A(A) and (C) Only
    2. B(A) and (D) Only
    3. C(B) and (D) Only
    4. D(B) and (C) Only

    Answer: (B) (A) and (D) Only

    Explanation

    Sign in to read the full explanation
  18. #include<iostream.h>
    using namespace std;
    void swap(int &x, int &y)
    {
    int temp=x;
    x=y;
    y=temp;
    }
    int main()
    {
    int a=5, b=10;
    swap(a,b);
    swap(a,b);
    cout<<a<<" "<<b;
    return 0;
    }
    What will be the output of the above code?
    
    1. A5, 10
    2. B10, 5
    3. C5, 5
    4. D10, 10

    Answer: (A) 5, 10

    Explanation

    Sign in to read the full explanation
  19. What is the output of the code given below :

    #include<iostream.h>
    using namespace std;
    class Base {
    public:
    Base(){
    cout<<"Base Const";
    }
    virtual ~Base() {
    cout<<"Base dest";
    }
    };
    class Derived : public Base {
    public:
    Derived() {
    cout<<"Derived Const";
    }
    ~Derived() {
    cout<<"Derived dest";
    }
    };
    int main() {
    Base *b = new Derived();
    delete b;
    return 0;
    }
    
    1. ABase Const Derived Const Derived dest Base dest
    2. BBase Const Derived Const Base dest Derived dest
    3. CDerived Const Base Const Base dest Derived dest
    4. DBase Const Derived Const Base dest

    Answer: (A) Base Const Derived Const Derived dest Base dest

    Explanation

    Sign in to read the full explanation
  20. Consider the following C code:

    #include<stdio.h>
    int temp =0;
    int fun(int x, int y)
    {
    int z; temp++;
    if(y==3) return (x*x*x);
    else {
    z=fun(x,y/3);
    return (z*z*z);
    }
    }
    int main() {
    fun(4,81);
    printf("%d",temp);
    }
    what will be the output of the following code :
    
    1. A3
    2. B4
    3. C5
    4. D6

    Answer: (B) 4

    Explanation

    Sign in to read the full explanation
  21. Arrange the following steps of file handling in C
    in the correct order :
    A. Close the file
    B. Read from or write to the file
    C. Open the file
    D. Check for error

    1. A(A), (C), (D), (B)
    2. B(D), (B), (C), (A)
    3. C(C), (D), (B), (A)
    4. D(B), (D), (A), (C)

    Answer: (C) (C), (D), (B), (A)

    Explanation

    Sign in to read the full explanation
  22. What will be the output of the following C code?

    #include<stdio.h>
    void main()
    {
    int arr[5] = {10,20,30,40,50};
    int *p = (int*) (&arr +1);
    printf("%d%d", *(arr+1), *(p-1));
    }
    
    1. A10 50
    2. B20 50
    3. C30 40
    4. D20 40

    Answer: (B) 20 50

    Explanation

    Sign in to read the full explanation
  23. #include<stdio.h>
    void main()
    {
    int arr[ ] = {1, 2, 3, 4, 5};
    int *p = arr;
    printf("%d", *p++);
    printf("%d", *(p+1));
    }
    Find the output of the above code?
    
    1. A1,2
    2. B1,3
    3. C2,3
    4. D1,4

    Answer: (B) 1,3

    Explanation

    Sign in to read the full explanation
  24. A program that is used by other routines to accomplish a particular task, is called :

    1. AMicro program
    2. BMicro operation
    3. CRoutine
    4. DSubroutine

    Answer: (D) Subroutine

    Explanation

    Sign in to read the full explanation
  25. Consider a triangle PQR with coordinates as P(0,0), Q(2,2) and R(10,4). If this triangle is to be magnified to four times its size while keeping R(10, 4) fixed, then the coordinates of the magnified triangle are :

    1. A(—20, —12), Q(—20, —4) and R(10, 4)
    2. B(—30, —12), Q(—22, —4) and R(10, 4)
    3. C(—25, —10), Q(22, —4) and R(10, 4)
    4. D(30, —12), Q(—22, 4) and R(10, 4)

    Answer: (B) (—30, —12), Q(—22, —4) and R(10, 4)

    Explanation

    Sign in to read the full explanation
  26. Practise Programming Languages and Computer Graphics in a timed set
  27. Which of the following statements is TRUE ?

    1. AVirtual functions do not implement polymorphism
    2. BVirtual functions do not permit calling of derived class functions using a base class pointer
    3. CWe can never build an object from a class containing a pure virtual function
    4. DPure virtual functions can never have a body

    Answer: (C) We can never build an object from a class containing a pure virtual function

    Explanation

    Sign in to read the full explanation
  28. What is the output of the following program ? #include<stdio.h> int main( ) { int i=3; while (i— —) { int i=10; i=} printf("%d", i); } printf("%d", i); }

    1. A990
    2. B9990
    3. C999-1
    4. D99-1

    Answer: (C) 999-1

    Explanation

    Sign in to read the full explanation
  29. A system bus in which each data item is transferred during a time slice known in advance to both units source and destination is called :

    1. AMIMD
    2. BDMA
    3. Casynchronous bus
    4. Dsynchronous bus

    Answer: (D) synchronous bus

    Explanation

    Sign in to read the full explanation
  30. Which of the following are tautology ?
    A. @3PAQ)3(23Q)
    B. (€3Q)Q)>PvQ) (CQ) (VAP) 3Q)((PV>P)R)
    D. (Q4(PAAP))3(R(PA=P)) Choose the correct answer from the options given below :

    1. A(A) Only
    2. B(B) Only
    3. C(A) and(B) Only
    4. D(©) and (D) Only

    Answer: (C) (A) and(B) Only

    Explanation

    Sign in to read the full explanation
  31. Consider the three points P1(1, 2, 0), P2(3, 6, 20) and P3(2, 4, 6) and a view point C(0, 0, —10). Choose the correct options.
    A. P1 obscure P2, if viewed from
    C.
    B. 2 obscure P1, if viewed from
    C.
    C. P3 does not obscure P1, if viewed from
    C.
    D. P2 does not obscure P3, if viewed from
    C. Choose the correct answer from the options given below :

    1. A(A), (B) and (© Only
    2. B(A), (© and (D) Only
    3. C(B), (©) and (D) Only
    4. D(A), (B) and (D) Only

    Answer: (B) (A), (© and (D) Only

    Explanation

    Sign in to read the full explanation
  32. Find the number of tuples by applying the operation Xb x05 aye"

    X (S, Si, C)Y (S, P, D)

    (J, 1, M)

    (B, 2, N)

    (R, 3, H)

    (T, 4, G)

    (J, S₁, CA)

    (B, P₁, AB)

    (R, D₁, DC)

    (A, H₁, MD)

    1. A1
    2. B3
    3. C4
    4. D6

    Answer: (C) 4

    Explanation

    Sign in to read the full explanation
  33. Match List-I with List-II.

    Source matching promptSource values
    See question stemSee answer choices
    1. A(A), (B)-V), ©)-(, (P)-CI)
    2. B(A), (B)-(D, (C)-@), (D)-(IV)
    3. C(A)-(HD), (B)-@D, (C)-CV), (B)-)
    4. D(A)-(), (B)-(V), (C)-@D), (D)-@)

    Answer: (A) (A), (B)-V), ©)-(, (P)-CI)

    Explanation

    Sign in to read the full explanation
  34. Match List-I with List-II.

    Source matching promptSource values
    See question stemSee answer choices
    1. A(A), (B)-(), (©-€V), (D)-()
    2. B(A)-(), (B)-CV), (©-(), (P)-@)
    3. C(A)-(, (B)-()), (©-€V), (D)-()
    4. D(A)-(1D), (B)-(), (C)-(IV), (D)-

    Answer: (A) (A), (B)-(), (©-€V), (D)-()

    Explanation

    Sign in to read the full explanation
  35. In HTML, the <map> tag is used for

    1. Adefining a path between two nodes in an image
    2. Bdefining clickable regions in an image
    3. Chighlighting an area in an image
    4. Ddefining the site map of a website

    Answer: (B) defining clickable regions in an image

    Explanation

    Sign in to read the full explanation
  36. A compiler uses 1-byte chars, 2-byte shorts, 4-byte ints, and 8-byte doubles. Every primitive must begin at an address that is a multiple of its size; fields cannot be reordered. How much space is consumed by an array A[10] of this structure?

    struct { short s; char c; short t; char d; double r; int i; }

    1. A150 bytes
    2. B320 bytes
    3. C240 bytes
    4. D200 bytes

    Answer: (C) 240 bytes

    Explanation

    Sign in to read the full explanation
  37. Consider the recursive Java function:

    public static float f(long m, long n) {
    float result = (float)m / (float)n;
    if (m < 0 || n < 0) return 0.0f;
    else result -= f(m + 2, n * 3);
    return result;
    }

    Which real value best approximates f(1, 3)?

    1. A0.2
    2. B0.4
    3. C0.6
    4. D0.8

    Answer: (A) 0.2

    Explanation

    Sign in to read the full explanation
  38. Which statements regarding XML are true?
    A. XML is a set of tags designed to tell browsers how to display a web page.
    B. XML defines syntax for representing data, while the data meaning depends on the application.
    C. <Letter>, <LETTER>, and <letter> are different XML tags.

    1. A(A) and (B) only
    2. B(A) and (C) only
    3. C(B) and (C) only
    4. D(A), (B), and (C)

    Answer: (C) (B) and (C) only

    Explanation

    Sign in to read the full explanation
  39. In 3D computer graphics, which statements are correct?
    A. Under perspective projection, parallel lines generally do not remain parallel, except lines parallel to the view plane.
    B. The perspective step uses a division by the depth coordinate after homogeneous transformation.
    C. Perspective transformation is linear.

    1. A(A) and (B) only
    2. B(A) and (C) only
    3. C(B) and (C) only
    4. D(A), (B), and (C)

    Answer: (A) (A) and (B) only

    Explanation

    Sign in to read the full explanation
  40. For Gouraud and Phong shading, which statements are true?
    A. Gouraud shading requires more computation than Phong shading.
    B. Gouraud shading interpolates vertex colours across a polygon.
    C. Phong shading interpolates vertex normals across a polygon.

    1. A(A) and (B) only
    2. B(A) and (C) only
    3. C(B) and (C) only
    4. D(A), (B), and (C)

    Answer: (C) (B) and (C) only

    Explanation

    Sign in to read the full explanation
  41. Match List-I with List-II. List I gives 3x3 matrices representing 2D transformations and
    List-II shows the corresponding transformation diagrams.

    List I (Matrix) List II (Transformation Diagram)
    2 00
    A. |0 2 0
    001 MO ,
    Shear — x (2).a

    List IList II
    Items are listed in the question stem.Match each item to its stated description or complexity.
    1. A0 2
      (B) jo 1 2 seale (2, 2).a
      00 1L
      (788)
      a
      05 —0.866 0
      (C) |0.866 0.5 0
      0 0 1 rotate(60°).
      (II)
      a
      120
      @) jo 1 0 a
      001 (Iv)
      translate (2, 2).a Choose the correct answer from the options given below:
      1. A-IV, B-II, C-III, D-I (2) A-IV. B-II, C-II, D-I
    2. BOCR review required
    3. CA-II, B-II, C-IV, D-I (4) A-II, B-IV, C-II, D-I
    4. DOCR review required

    Answer: (D) OCR review required

    Explanation

    Sign in to read the full explanation
  42. Given below are different properties of 3D projections from A-D. Identify the correct order on
    the basis of property true of (i) a perspective projection only, (ii) an orthographic projection
    only, (iii) both orthographic and projective transformations and (iv) neither orthographic nor
    projective transformation, respectively.
    A. B. C. D. Straight lines are mapped to straight lines.
    Distances and angles are (in general) preserved.
    Far away objects appear the same size as closer ones.

    Requires homogeneous coordinates in order for it to be encoded into a linear
    transformation.

    1. AOCR review required
    2. BOCR review required
    3. CD, C. B.A (2) B,C,D.A
      D,C, A,B (4) C,D,BA
    4. DOCR review required

    Answer: (C) D, C. B.A (2) B,C,D.A
    D,C, A,B (4) C,D,BA

    Explanation

    Sign in to read the full explanation
  43. Given below are two statements:

    Statement I: Bezier curves are curves that interpolate all of their control points.
    Statement II: A cubic bezier curve has four control points.

    In the light of the above statements, choose the correct answer from the options given below

    1. ABoth Statement I and Statement II are true
    2. BBoth Statement I and Statement II are false
    3. CStatement I is correct but Statement II is false
    4. DStatement I is incorrect but Statement II is true.

    Answer: (D) Statement I is incorrect but Statement II is true.

    Explanation

    Sign in to read the full explanation

Frequently asked questions

How many Programming Languages and Computer Graphics questions have been asked in UGC NET Computer Science?

42 Programming Languages and Computer Graphics questions appear in the UGC NET Computer Science papers held between 2020–2025, and all of them are on this page with their answer key.

Are the answers on this page free?

Yes. Every question, its options, and the correct answer are free to read with no account. Signing in additionally unlocks the detailed explanation under each question.

Is Programming Languages and Computer Graphics an important topic for UGC NET Computer Science?

Programming Languages and Computer Graphics appears in every recent UGC NET Computer Science paper, across all 4 sittings covered here. Its share of the paper makes it worth revising thoroughly rather than sampling.

How should I practise Programming Languages and Computer Graphics after reading these questions?

Attempt the Programming Languages and Computer Graphics topic-wise sets, which put the same questions into a timed interface with instant scoring and weak-area analysis afterwards.

More Computer Science PYQs by topic

More Computer Science practice

Ready for a full paper?

Attempt Paper 1 + Paper 2 (Computer Science) together in a single timed session.

Full Mock Tests →