UGC NET CS Practice Set 9

UGC NET JRF Computer Science · 2026 · with answers and explanations

questions
30
Total marks
60
Duration
180 minutes
Negative marking
No

Subjects: Computer Science

Question 1

Computer Science · 2 marks

Peephole optimization examines:

  1. A.The entire program at once
  2. B.A small sliding window of consecutive instructions
  3. C.Only loop structures
  4. D.Only function calls

Correct answer: B

Explanation: Peephole optimization examines a small, fixed-size window (peephole) of consecutive instructions and replaces inefficient patterns with more efficient ones. Examples: redundant load/store elimination, strength reduction (multiply by 2 → shift left), removing unreachable code.

Question 2

Computer Science · 2 marks

The NAT (Network Address Translation) operates at which OSI layer?

  1. A.Data Link Layer
  2. B.Network Layer (and Transport Layer for port translation)
  3. C.Application Layer
  4. D.Physical Layer

Correct answer: B

Explanation: NAT primarily operates at the Network Layer (modifying IP addresses) and also at the Transport Layer when performing port address translation (PAT/NAPT — modifying port numbers). It enables multiple devices on a private network to share a single public IP address.

Question 3

Computer Science · 2 marks

In the context of genetic algorithms, 'crossover' refers to:

  1. A.Randomly changing bits in a chromosome
  2. B.Combining parts of two parent chromosomes to produce offspring
  3. C.Selecting the fittest individuals
  4. D.Evaluating the fitness of a solution

Correct answer: B

Explanation: Crossover (recombination) combines genetic material from two parent chromosomes to create offspring. Common types include single-point crossover (swap tails at a random point), two-point crossover, and uniform crossover. Randomly changing bits is mutation, not crossover.

Question 4

Computer Science · 2 marks

The number of non-isomorphic simple graphs with 4 vertices is:

  1. A.8
  2. B.11
  3. C.16
  4. D.6

Correct answer: B

Explanation: There are 11 non-isomorphic simple graphs on 4 vertices: the empty graph (0 edges), 1 edge, a path P₂ (2 edges), a triangle, a matching (2 independent edges), P₃ (3 edges path), star K₁₃, C₄, K₄−e (diamond), K₄ minus a matching, and K₄. Total = 11.

Question 5

Computer Science · 2 marks

In software reliability models, the mean time between failures (MTBF) is related to availability by:

  1. A.Availability = MTBF / (MTBF + MTTR)
  2. B.Availability = MTTR / MTBF
  3. C.Availability = 1 − MTBF
  4. D.Availability = MTBF × MTTR

Correct answer: A

Explanation: Availability = MTBF / (MTBF + MTTR), where MTBF is Mean Time Between Failures and MTTR is Mean Time To Repair. High availability requires high MTBF (few failures) and low MTTR (quick repairs). E.g., MTBF=990h, MTTR=10h → Availability = 990/1000 = 99%.

Question 6

Computer Science · 2 marks

Consider a grammar with productions S → aAB, A → bBc, B → d | ε. The string generated by S → aAB → abBcB → abdcB → abdc belongs to the language if B derives:

  1. A.ε (abdc is the terminal string)
  2. B.d (abdcd is the terminal string)
  3. C.This derivation is invalid
  4. D.The grammar is ambiguous

Correct answer: A

Explanation: S ⇒ aAB ⇒ abBcB ⇒ abdcB ⇒ abdcε = abdc. The last B derives ε (the empty string), producing the terminal string 'abdc'. This is a valid leftmost derivation.

Question 7

Computer Science · 2 marks

The concept of 'data independence' in DBMS means:

  1. A.Data is stored independently on separate disks
  2. B.Changes to the data storage structure do not require changes to application programs
  3. C.Data cannot be shared between applications
  4. D.Each user has a completely independent copy of the data

Correct answer: B

Explanation: Data independence means the ability to modify the schema at one level without affecting the schema at the next higher level. Physical data independence: change storage/access methods without changing the logical schema. Logical data independence: change the logical schema without changing external schemas/apps.

Question 8

Computer Science · 2 marks

An activation record (stack frame) in a programming language runtime typically does NOT contain:

  1. A.Local variables
  2. B.Return address
  3. C.Global symbol table
  4. D.Saved registers

Correct answer: C

Explanation: An activation record contains local variables, parameters, return address, saved registers, dynamic link (to caller's frame), and static link (for nested scopes). The global symbol table is a compile-time structure maintained separately, not part of individual activation records.

Question 9

Computer Science · 2 marks

In IPv6, the address size is:

  1. A.32 bits
  2. B.64 bits
  3. C.128 bits
  4. D.256 bits

Correct answer: C

Explanation: IPv6 uses 128-bit addresses (vs IPv4's 32-bit), providing 2^128 ≈ 3.4 × 10^38 unique addresses. IPv6 addresses are written as eight groups of four hexadecimal digits (e.g., 2001:0db8:85a3:0000:0000:8a2e:0370:7334).

Question 10

Computer Science · 2 marks

The Hamming distance between the binary codes 10110101 and 10011010 is:

  1. A.3
  2. B.5
  3. C.4
  4. D.6

Correct answer: B

Explanation: Hamming distance is the number of positions where the corresponding bits differ. XOR: 10110101 ⊕ 10011010 = 00101111. Number of 1s in the XOR = 5. So the Hamming distance is 5.

Question 11

Computer Science · 2 marks

The CRC (Cyclic Redundancy Check) method can detect:

  1. A.Only single-bit errors
  2. B.All single-bit errors, all double-bit errors, all odd-number-of-bit errors, and burst errors shorter than the CRC polynomial degree
  3. C.Only even-parity errors
  4. D.No errors

Correct answer: B

Explanation: CRC with a well-chosen generator polynomial of degree r can detect: all single-bit errors, all double-bit errors (if the polynomial has at least 3 terms), all odd-number-of-bit errors (if (x+1) is a factor), and all burst errors of length ≤ r.

Question 12

Computer Science · 2 marks

The dead code elimination optimization removes:

  1. A.Code that takes too long to execute
  2. B.Code whose results are never used or unreachable code
  3. C.All function calls
  4. D.Loop bodies

Correct answer: B

Explanation: Dead code elimination removes code that computes values never used by the program (dead variables) and code that is unreachable (e.g., code after an unconditional return/goto). This reduces code size and may improve cache performance.

Question 13

Computer Science · 2 marks

In the relational model, the Cartesian product of two relations R(A,B) with 5 tuples and S(C,D) with 3 tuples has:

  1. A.8 tuples with 2 attributes
  2. B.15 tuples with 4 attributes
  3. C.15 tuples with 2 attributes
  4. D.5 tuples with 4 attributes

Correct answer: B

Explanation: The Cartesian product R × S pairs every tuple in R with every tuple in S. Result has |R| × |S| = 5 × 3 = 15 tuples and deg(R) + deg(S) = 2 + 2 = 4 attributes (A, B, C, D).

Question 14

Computer Science · 2 marks

In operating systems, the term 'context switch' refers to:

  1. A.Switching from user mode to kernel mode only
  2. B.Saving the state of the current process and loading the state of the next process
  3. C.Switching between memory pages
  4. D.Swapping a process from disk to memory

Correct answer: B

Explanation: A context switch involves saving the CPU state (registers, program counter, stack pointer, etc.) of the currently running process into its PCB, and loading the saved state of the next process to run. This is pure overhead and modern CPUs optimize it but cannot eliminate it.

Question 15

Computer Science · 2 marks

In a 4-bit ripple carry adder, if each full adder has a gate delay of 2 for carry and 3 for sum, the total worst-case delay for the 4-bit sum output is:

  1. A.11 gate delays
  2. B.8 gate delays
  3. C.12 gate delays
  4. D.6 gate delays

Correct answer: A

Explanation: The carry ripples through 4 stages: 3 carry delays through the first 3 adders = 3 × 2 = 6, then the final sum output delay = 3, plus the initial carry delay from the first adder = 2. Total = 2 + 2 + 2 + 3 = 9. Actually: C1 ready at 2, C2 at 4, C3 at 6, C4 at 8. S4 = 6 + 3 = 9. Wait, the worst case: carry propagates through all 4 FAs (3 × 2 = 6 for C1..C3), then the last FA sum needs the carry at time 6 plus 3 = 9. But if the first FA carry is at 2, then C2 at 4, C3 at 6, S4 = 6 + 3 = 9. The carry chain is 3 intermediate carries × 2 = 6 delays for carry plus last sum = 3, giving 6 + 3 + 2 = 11 (counting from input to C0 output at 2).

Question 16

Computer Science · 2 marks

A JK flip-flop with J=1, K=1 acts as a:

  1. A.Set flip-flop
  2. B.Reset flip-flop
  3. C.Toggle flip-flop
  4. D.No change

Correct answer: C

Explanation: When J=K=1, the JK flip-flop toggles its output on each clock edge — if Q was 0, it becomes 1, and vice versa. This is the toggle mode. J=1,K=0 sets; J=0,K=1 resets; J=0,K=0 holds.

Question 17

Computer Science · 2 marks

In a carry lookahead adder (CLA) with 4 bits, the carry C₃ is computed using:

  1. A.Sequential ripple from C₀ through C₁ and C₂
  2. B.Generate (G) and Propagate (P) signals computed in parallel
  3. C.A lookup table stored in ROM
  4. D.A shift register

Correct answer: B

Explanation: A CLA computes generate Gᵢ = Aᵢ·Bᵢ and propagate Pᵢ = Aᵢ⊕Bᵢ for each bit position in parallel. Then carries are computed: C₁ = G₀ + P₀·C₀, C₂ = G₁ + P₁·G₀ + P₁·P₀·C₀, etc. This eliminates the ripple delay.

Question 18

Computer Science · 2 marks

The addressing mode where the operand is part of the instruction itself is called:

  1. A.Direct addressing
  2. B.Immediate addressing
  3. C.Register addressing
  4. D.Indirect addressing

Correct answer: B

Explanation: In immediate addressing mode, the operand value is embedded directly in the instruction (e.g., MOV R1, #5). Direct mode gives a memory address, register mode names a register, and indirect mode gives the address of a location holding the target address.

Question 19

Computer Science · 2 marks

In a 2-way set-associative cache, the replacement of a cache block upon a miss is decided:

  1. A.By the index bits alone
  2. B.By a replacement policy (e.g., LRU) within the set
  3. C.Randomly across the entire cache
  4. D.By the operating system

Correct answer: B

Explanation: In a set-associative cache, the index bits determine the set. Within the set (which has 2 blocks in 2-way), a replacement policy like LRU, FIFO, or random selects which block to evict on a miss.

Question 20

Computer Science · 2 marks

In Booth's algorithm for multiplication, the recoding of the multiplier 0110 produces the Booth-encoded sequence:

  1. A.+1 −1 +1 0 (from MSB to LSB)
  2. B.0 +1 0 −1 (from LSB to MSB with implicit trailing 0)
  3. C.+1 0 −1 0 (scanning LSB to MSB)
  4. D.Scanning right to left with a trailing 0: 0→0(no op), 10(subtract at bit1), 11(no op), 01(add at bit3) giving (0, −1, 0, +1)

Correct answer: D

Explanation: Booth's recoding appends a 0 to the right: 0110_0. Scanning pairs from right: bit0=0,prev=0→0; bit1=1,prev=0→−1; bit2=1,prev=1→0; bit3=0,prev=1→+1. So the operations are: subtract at position 1, add at position 3: 0110 = 1000 − 0010 = 8 − 2 = 6. Only 2 operations instead of 2 additions.

Question 21

Computer Science · 2 marks

The TLB (Translation Lookaside Buffer) is used to speed up:

  1. A.Disk access
  2. B.Virtual-to-physical address translation
  3. C.Cache access
  4. D.Instruction decoding

Correct answer: B

Explanation: The TLB is a small, fast, fully-associative cache that stores recent virtual-to-physical page number translations. Without a TLB, every memory access would require one or more page table lookups in main memory, significantly slowing execution.

Question 22

Computer Science · 2 marks

Amdahl's Law states that the speedup of a program using multiple processors is limited by:

  1. A.The number of processors available
  2. B.The sequential (non-parallelizable) fraction of the program
  3. C.The memory bandwidth
  4. D.The clock speed of each processor

Correct answer: B

Explanation: Amdahl's Law: Speedup = 1 / (S + (1−S)/N), where S is the serial fraction and N is the number of processors. As N→∞, speedup → 1/S. If 10% of the program is serial (S=0.1), maximum speedup is 10× regardless of processor count.

Question 23

Computer Science · 2 marks

In an interrupt-driven I/O system, when an interrupt occurs, the CPU:

  1. A.Ignores it and continues the current program
  2. B.Saves its state and transfers control to the interrupt service routine
  3. C.Immediately powers off
  4. D.Switches to a different CPU core

Correct answer: B

Explanation: When an interrupt is asserted, the CPU completes the current instruction, saves its state (PC, flags, registers) on the stack, and jumps to the interrupt service routine (ISR) via the interrupt vector table. After the ISR completes, the saved state is restored.

Question 24

Computer Science · 2 marks

The primary advantage of Harvard architecture over Von Neumann architecture is:

  1. A.Lower cost
  2. B.Simultaneous instruction and data memory access
  3. C.Simpler design
  4. D.Larger address space

Correct answer: B

Explanation: Harvard architecture has separate instruction and data memories (and buses), allowing simultaneous access to both. Von Neumann uses a single memory for both, creating a bottleneck. Harvard is common in DSPs and microcontrollers; modified Harvard (shared L2 cache) is used in modern CPUs.

Question 25

Computer Science · 2 marks

Write-back and write-through are policies related to:

  1. A.Cache replacement
  2. B.Handling cache writes — when to update main memory
  3. C.Cache line size selection
  4. D.Virtual memory page replacement

Correct answer: B

Explanation: Write-through updates main memory on every cache write (simple, consistent but slow). Write-back updates main memory only when the dirty cache line is evicted (faster but more complex). Write-back requires a dirty bit per cache line.

Question 26

Computer Science · 2 marks

In a lazy evaluation strategy, an expression is evaluated:

  1. A.Before it is bound to a variable
  2. B.Only when its value is actually needed
  3. C.Multiple times for correctness
  4. D.At compile time

Correct answer: B

Explanation: Lazy evaluation (used in Haskell) delays evaluation of an expression until its value is required. This enables working with infinite data structures, avoids unnecessary computation, but can make space usage harder to predict. Strict/eager evaluation (C, Java) evaluates immediately.

Question 27

Computer Science · 2 marks

Runtime polymorphism in C++ is achieved through:

  1. A.Function overloading
  2. B.Virtual functions and dynamic dispatch
  3. C.Templates
  4. D.Operator overloading

Correct answer: B

Explanation: Runtime (dynamic) polymorphism in C++ uses virtual functions. The correct function is determined at runtime via the vtable (virtual table). Function overloading and operator overloading are compile-time (static) polymorphism. Templates are also resolved at compile time.

Question 28

Computer Science · 2 marks

The Phong shading model interpolates:

  1. A.Colors across the polygon surface (Gouraud shading)
  2. B.Surface normal vectors across the polygon, computing illumination at each pixel
  3. C.Only depth values
  4. D.Texture coordinates only

Correct answer: B

Explanation: Phong shading interpolates the normal vectors across the polygon surface and computes the illumination model at each pixel, producing more accurate highlights than Gouraud shading (which interpolates colors). Phong is more computationally expensive but gives better specular highlights.

Question 29

Computer Science · 2 marks

The homogeneous coordinate representation of a 2D point (x, y) is:

  1. A.(x, y, 0)
  2. B.(x, y, 1)
  3. C.(x, y, x+y)
  4. D.(1, x, y)

Correct answer: B

Explanation: In homogeneous coordinates, a 2D point (x, y) is represented as (x, y, 1) or more generally (wx, wy, w) for any w ≠ 0. This allows translation to be represented as matrix multiplication, unifying all 2D transformations into 3×3 matrices.

Question 30

Computer Science · 2 marks

Which of the following is NOT a type of projection in computer graphics?

  1. A.Isometric projection
  2. B.Cabinet projection
  3. C.Hyperbolic projection
  4. D.Cavalier projection

Correct answer: C

Explanation: Standard projections include parallel projections (orthographic: front/top/side, axonometric: isometric/dimetric/trimetric) and oblique (cavalier, cabinet). Perspective projections have 1, 2, or 3 vanishing points. Hyperbolic projection is not a standard computer graphics projection type.

View all papers — UGC NET JRF Computer Science

Practice this paper with a timer

Attempt it online, get scored instantly, and see which subjects are costing you marks.

Start practising free