Aspire's Library

A Place for Latest Exam wise Questions, Videos, Previous Year Papers,
Study Stuff for MCA Examinations

UGC NET Computer Science Previous Year Questions (PYQs)

UGC NET Computer Science C Programming Language PYQ


UGC NET Computer Science PYQ
int i, j;
for(i = 1; i < 5; i += 2)
    for(j = 1; j < i; j += 2)
        printf("%d", j);





Go to Discussion

UGC NET Computer Science UGC NET PYQ UGC NET Computer Science UGC NET Computer Science 26 June 2025 (Paper II) PYQ

Solution

For i = 1, inner loop condition j < i → 1 < 1 → false → no output.
For i = 3, inner loop runs with j = 1, prints 1, then j = 3 → condition fails.
Hence, final output is 1.

UGC NET Computer Science PYQ
Consider the operators used in C programming given below:
A. &&
B. +=
C. >>
D. >=
E. ?:
Choose among the following the correct order of precedence of the operators given above (higher to lower):





Go to Discussion

UGC NET Computer Science UGC NET PYQ UGC NET Computer Science UGC NET Computer Science 26 June 2025 (Paper II) PYQ

Solution

Operator precedence (highest → lowest) is: >> (shift) → >= (relational) → ?: (ternary) → += (assignment) → && (logical AND).

UGC NET Computer Science PYQ
void main() {
    int *i, a = 12, b = 2, c;
    c = (a = a + b, b = a / b, a = a * b, b = a - b);
    i = &c;
    printf("%d", -(*i));
}






Go to Discussion

UGC NET Computer Science UGC NET PYQ UGC NET Computer Science UGC NET Computer Science 26 June 2025 (Paper II) PYQ

Solution

Step-by-step explanation:
a = 12, b = 2
a = a + b → a = 14
b = a / b → b = 7
a = a * b → a = 98
b = a - b → b = 91
→ c = 91
Hence, -(*i) = -91
Output: 91 (negative of c printed as -(-91) → 91)

UGC NET Computer Science PYQ

int x = 128, y = 110;

do {

    if (x > y) x = x - y;

    else       y = y - x;

} while (x != y);

printf("%d", x);






Go to Discussion

UGC NET Computer Science UGC NET PYQ UGC NET Computer Science UGC NET Computer Science 26 June 2025 (Paper II) PYQ

Solution

Repeated subtraction implements Euclid’s algorithm; the loop ends with x = y = gcd(128,110) = 2.

UGC NET Computer Science PYQ
Only legal pointer operations:
A. pointer + number → pointer
B. pointer – number → number
C. pointer + pointer → pointer
D. pointer – pointer → pointer
E. pointer – pointer → number
Choose the most appropriate answer from the options given below:





Go to Discussion

UGC NET Computer Science UGC NET PYQ UGC NET Computer Science UGC NET Computer Science 26 June 2025 (Paper II) PYQ

Solution

pointer + number → pointer (A)
pointer - pointer → number (E)

UGC NET Computer Science PYQ
What would be the equivalent pointer expression for referring the array element ar[m][n][o]?
  1. *(*(*(ar) + m + n) + o)
  2. (*(*(*(ar + m) + n) + o))
  3. (*(*(ar + m) + n) + o)
  4. *(*(*(ar + m) + n) + o)





Go to Discussion

UGC NET Computer Science UGC NET PYQ UGC NET Computer Science UGC NET Computer Science 26 June 2025 (Paper II) PYQ

Solution

Consider ar as a 3-dimensional array declared as:

data_type ar[a][b][c];

Here, the array element ar[m][n][o] can be represented in pointer form as:

*(*(*(ar + m) + n) + o)

Step-by-step understanding:

  • ar is a pointer to the first 2D array ar[0].
  • ar + m moves the pointer to the mth 2D array → ar[m].
  • *(ar + m) gives the address of the first 1D array inside ar[m].
  • *(ar + m) + n moves to the nth 1D array → ar[m][n].
  • *(*(ar + m) + n) gives the address of the first element of that 1D array.
  • *(*(*(ar + m) + n) + o) finally gives the element ar[m][n][o].

✅ Final Answer: *(*(*(ar + m) + n) + o)



UGC NET Computer Science


Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More

UGC NET Computer Science


Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More

Ask Your Question or Put Your Review.

loading...