UGC NET · PAPER 2
UGC NET Paper 2 Computer Science – Unit 3: Programming Languages and Computer Graphics PYQ (December 2023)
Q9. Consider a triangle PQR with coordinates 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:
- P(−20,−12), Q(−20,−4) and R(10,4)
- P(−30,−12), Q(−22,−4) and R(10,4)
- P(−25,−10), Q(22,−4) and R(10,4)
- P(30,−12), Q(−22,4) and R(10,4)
Q10. Which of the following statements is TRUE?
- Virtual functions do not implement polymorphism
- Virtual functions do not permit calling of derived class functions using a base class pointer
- We can never build an object from a class containing a pure virtual function
- A pure virtual function can never have a body
Q11. 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);
}- 990
- 9990
- 999-1
- 99-1
Q12. The hue of a colour is related to its:
- Luminance
- Saturation
- Incandescence
- Wavelength
Q16. What is the output of the following program?
#include <stdio.h>
#define SQR(x) (x*x)
int main() {
int a, b = 3;
a = SQR(b+2);
printf("%d", a);
return 0;
}- 25
- 11
- Garbage value
- 24
Q47. Consider the three points P1(1, 2, 0), P2(3, 6, 20) and P3(2, 4, 6) and a viewpoint C(0, 0, −10). Choose the correct options.
(A) P1 obscures P2 if viewed from C.
(B) P2 obscures 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:
(A) P1 obscures P2 if viewed from C.
(B) P2 obscures 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:
- (A), (B) and (C) Only
- (A), (C) and (D) Only
- (B), (C) and (D) Only
- (A), (B) and (D) Only
Q48. Which of the statements are CORRECT?
(A) Constructors are invoked automatically when objects are created.
(B) Constructors do not have return types, not even void, and therefore cannot return values.
(C) Constructors cannot be inherited, though a derived class can call the base class constructors.
(D) Constructors can be declared as virtual.
Choose the correct answer from the options given below:
(A) Constructors are invoked automatically when objects are created.
(B) Constructors do not have return types, not even void, and therefore cannot return values.
(C) Constructors cannot be inherited, though a derived class can call the base class constructors.
(D) Constructors can be declared as virtual.
Choose the correct answer from the options given below:
- (A), (B) and (D) Only
- (A), (B) and (C) Only
- (B), (C) and (D) Only
- (A), (C) and (D) Only
Q68. Match List I with List II
| List I | List II |
|---|---|
| (a) Bresenham | (I) Hidden surface removal |
| (b) Cohen-Sutherland algorithm | (II) Line drawing |
| (c) Sutherland-Hodgeman algorithm | (III) Line clipping |
| (d) Z-Buffer algorithm | (IV) Polygon clipping |
- (a)-(III), (b)-(II), (c)-(IV), (d)-(I)
- (a)-(II), (b)-(III), (c)-(I), (d)-(IV)
- (a)-(II), (b)-(III), (c)-(IV), (d)-(I)
- (a)-(II), (b)-(IV), (c)-(III), (d)-(I)
Q78. Consider the following code segment:
(a) printf("%d", ptr[i]);
(b) printf("%d", ptr[i+1]);
(c) printf("%d", ptr[-i]);
(d) printf("%d", ptr[-i+1]);
int arr[] = {0,1,2,3,4};
int i = 1, *ptr;
ptr = arr + 2;Arrange the following printf statements in increasing order of their output:(a) printf("%d", ptr[i]);
(b) printf("%d", ptr[i+1]);
(c) printf("%d", ptr[-i]);
(d) printf("%d", ptr[-i+1]);
- (c), (a), (b), (d)
- (c), (d), (a), (b)
- (d), (a), (b), (c)
- (a), (b), (d), (c)
Q87. Statement (I): A friend function and the member functions of a friend class can directly access private and protected data.
Statement (II): A friend function can access private data through the member functions of the base class.
In the light of the above statements, choose the most appropriate answer from the options given below:
Statement (II): A friend function can access private data through the member functions of the base class.
In the light of the above statements, choose the most appropriate answer from the options given below:
- Both Statement I and Statement II are correct
- Both Statement I and Statement II are incorrect
- Statement I is correct but Statement II is incorrect
- Statement I is incorrect but Statement II is correct