All mock tests are FREE till 31 December — register to save your progress
Paper 2 CS · UNIT 03

Programming Languages and Computer Graphics – Previous Year Questions

229 questions from past UGC NET Paper 2 – Computer Science papers, each with the correct answer. Open any question for its explanation.

  1. Which of the statement is not true in regards to virtual memory? (i) The main objective for using virtual memory is to increase the effective capacity of the memory system. (ii) Size of the program can be as large as th…
    Answer: D. None of these
  2. For the following page reference string: 4, 3, 2, 1, 4, 3, 5, 4, 3, 2, 1, 5 — the number of page faults that occur using the Least Recently Used (LRU) page replacement algorithm with frame size 3 is:
    Answer: C. 10
  3. Given memory access time as p nanoseconds and an additional q nanoseconds for handling a page fault, what is the effective memory access time if a page fault occurs once for every 100 instructions?
    Answer: A. p + q/100 Paper 2 CS · November 2021
  4. Consider a machine with 16 GB of main memory and a 32-bit virtual address space, with page size 4 KB (frame size equals page size). If a process of size 34 KB is to be executed on this machine, what will be the size of…
    Answer: B. 2 KB
  5. (Same machine as above: 16 GB main memory, 32-bit virtual address space, 4 KB page size.) What is the size of the page table needed to handle the given virtual address space, given that each page table entry is of size…
    Answer: C. 2 MB
  6. (Same machine as above: 16 GB main memory, 32-bit virtual address space, 4 KB page size.) What is the minimum number of bits needed for the physical address?
    Answer: D. 34
  7. (Same machine as above: 16 GB main memory, 32-bit virtual address space, 4 KB page size.) The number of bits reserved for the frame offset is ____.
    Answer: A. 12
  8. (Same machine as above: 32-bit virtual address space, 4 KB page size.) Find the number of pages required for the given virtual address space.
    Answer: C. 2^20
  9. Consider a hypothetical machine with 3 pages of physical memory, 5 pages of virtual memory, and as the stream of page references by an application. If P and Q are the number of page faults the application would incur wi…
    Answer: D. (11,12)
  10. For the page reference string 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1 with 3 page frames (initially empty), which page replacement algorithm produces the minimum number of page faults?
    Answer: D. Optimal
  11. Which of the following is incorrect for virtual memory?
    Answer: B. More I/O is required
  12. A memory management system has 64 pages with a page size of 512 bytes. Physical memory consists of 32 page frames. The number of bits required in the logical and physical addresses are respectively:
    Answer: C. 15 and 14
  13. Consider the page-reference string: 0 1 2 3 0 1 4 0 1 2 3 4. If the FIFO page-replacement algorithm is used, find the number of page faults for (a) 3 page frames and (b) 4 page frames, respectively.
    Answer: D. 9, 10
  14. What would be the equivalent pointer expression for referring the array element ar[ m ][ n ][0]
    Answer: D. *(*(*(ar+m)+n)+0) Paper 2 CS · June 2025
  15. Which of the following technique is used for Clipping?
    Answer: C. Sutherland-Cohen Paper 2 CS · June 2025
  16. Match List I with List II
    Answer: C. A-III, B-II, C-IV, D-I Paper 2 CS · June 2025
  17. Match List I with List II
    Answer: B. A-IV, B-II, C-I, D-III Paper 2 CS · June 2025
  18. Only legal pointer operations: → A. pointer + number pointer → B. pointer - number number → C. pointer + pointer pointer → D. pointer - pointer pointer → E. pointer - pointer number
    Answer: D. A, E Only Paper 2 CS · June 2025
  19. Consider the conditional statement if (m == 20 − 10 || n > 10). The order of execution of the following operations is: A. == B. − C. || D. >
    Answer: C. B, D, A, C Paper 2 CS · December 2024
  20. Arrange the 2-D viewing transformation pipeline. A. Convert world-coordinates to viewing coordinates B. Map viewing coordinates to normalized viewing coordinates using window - viewpoint specifications C. Construct worl…
    Answer: C. C, A, B, D Paper 2 CS · December 2024
  21. 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
    Answer: B. A, B & C only Paper 2 CS · December 2024
  22. Match List I (functions) with List II (uses). List I: A. fseek(), B. ftell(), C. feof(), D. rewind(). List II: I. Gives the current position in the file; II. Sets the position to the beginning of the file; III. Sets the…
    Answer: B. A-III, B-I, C-IV, D-II Paper 2 CS · December 2024
  23. Which of the following statement is not True?
    Answer: C. The scope resolution operator (::) can be overloaded like normal operators Paper 2 CS · December 2024
  24. 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 deferenced in expres…
    Answer: B. (A) and (B) Only Paper 2 CS · June 2024 (Re-Exam)
  25. 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…
    Answer: D. (A), (B) Only Paper 2 CS · June 2024 (Re-Exam)
  26. #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 ",…
    Answer: A. ONE TWO TWO ONE Paper 2 CS · June 2024 (Re-Exam)
  27. #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?
    Answer: A. 5, 10 Paper 2 CS · June 2024 (Re-Exam)
  28. 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
    Answer: C. (C), (D), (B), (A) Paper 2 CS · June 2024 (Re-Exam)
  29. #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?
    Answer: B. 1,3 Paper 2 CS · June 2024 (Re-Exam)
  30. Which of the following is not an object Oriented Programming language ?
    Answer: D. SQL Plus Paper 2 CS · June 2024 (Cancelled)