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 marksPeephole optimization examines:
- A.The entire program at once
- B.A small sliding window of consecutive instructions
- C.Only loop structures
- 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 marksThe NAT (Network Address Translation) operates at which OSI layer?
- A.Data Link Layer
- B.Network Layer (and Transport Layer for port translation)
- C.Application Layer
- 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 marksIn the context of genetic algorithms, 'crossover' refers to:
- A.Randomly changing bits in a chromosome
- B.Combining parts of two parent chromosomes to produce offspring
- C.Selecting the fittest individuals
- 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 marksThe number of non-isomorphic simple graphs with 4 vertices is:
- A.8
- B.11
- C.16
- 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 marksIn software reliability models, the mean time between failures (MTBF) is related to availability by:
- A.Availability = MTBF / (MTBF + MTTR)
- B.Availability = MTTR / MTBF
- C.Availability = 1 − MTBF
- 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 marksConsider 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:
- A.ε (abdc is the terminal string)
- B.d (abdcd is the terminal string)
- C.This derivation is invalid
- 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 marksThe concept of 'data independence' in DBMS means:
- A.Data is stored independently on separate disks
- B.Changes to the data storage structure do not require changes to application programs
- C.Data cannot be shared between applications
- 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 marksAn activation record (stack frame) in a programming language runtime typically does NOT contain:
- A.Local variables
- B.Return address
- C.Global symbol table
- 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 marksIn IPv6, the address size is:
- A.32 bits
- B.64 bits
- C.128 bits
- 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 marksThe Hamming distance between the binary codes 10110101 and 10011010 is:
- A.3
- B.5
- C.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 marksThe CRC (Cyclic Redundancy Check) method can detect:
- A.Only single-bit errors
- B.All single-bit errors, all double-bit errors, all odd-number-of-bit errors, and burst errors shorter than the CRC polynomial degree
- C.Only even-parity errors
- 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 marksThe dead code elimination optimization removes:
- A.Code that takes too long to execute
- B.Code whose results are never used or unreachable code
- C.All function calls
- 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 marksIn the relational model, the Cartesian product of two relations R(A,B) with 5 tuples and S(C,D) with 3 tuples has:
- A.8 tuples with 2 attributes
- B.15 tuples with 4 attributes
- C.15 tuples with 2 attributes
- 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 marksIn operating systems, the term 'context switch' refers to:
- A.Switching from user mode to kernel mode only
- B.Saving the state of the current process and loading the state of the next process
- C.Switching between memory pages
- 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 marksIn 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:
- A.11 gate delays
- B.8 gate delays
- C.12 gate delays
- 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 marksA JK flip-flop with J=1, K=1 acts as a:
- A.Set flip-flop
- B.Reset flip-flop
- C.Toggle flip-flop
- 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 marksIn a carry lookahead adder (CLA) with 4 bits, the carry C₃ is computed using:
- A.Sequential ripple from C₀ through C₁ and C₂
- B.Generate (G) and Propagate (P) signals computed in parallel
- C.A lookup table stored in ROM
- 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 marksThe addressing mode where the operand is part of the instruction itself is called:
- A.Direct addressing
- B.Immediate addressing
- C.Register addressing
- 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 marksIn a 2-way set-associative cache, the replacement of a cache block upon a miss is decided:
- A.By the index bits alone
- B.By a replacement policy (e.g., LRU) within the set
- C.Randomly across the entire cache
- 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 marksIn Booth's algorithm for multiplication, the recoding of the multiplier 0110 produces the Booth-encoded sequence:
- A.+1 −1 +1 0 (from MSB to LSB)
- B.0 +1 0 −1 (from LSB to MSB with implicit trailing 0)
- C.+1 0 −1 0 (scanning LSB to MSB)
- 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 marksThe TLB (Translation Lookaside Buffer) is used to speed up:
- A.Disk access
- B.Virtual-to-physical address translation
- C.Cache access
- 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 marksAmdahl's Law states that the speedup of a program using multiple processors is limited by:
- A.The number of processors available
- B.The sequential (non-parallelizable) fraction of the program
- C.The memory bandwidth
- 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 marksIn an interrupt-driven I/O system, when an interrupt occurs, the CPU:
- A.Ignores it and continues the current program
- B.Saves its state and transfers control to the interrupt service routine
- C.Immediately powers off
- 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 marksThe primary advantage of Harvard architecture over Von Neumann architecture is:
- A.Lower cost
- B.Simultaneous instruction and data memory access
- C.Simpler design
- 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 marksWrite-back and write-through are policies related to:
- A.Cache replacement
- B.Handling cache writes — when to update main memory
- C.Cache line size selection
- 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 marksIn a lazy evaluation strategy, an expression is evaluated:
- A.Before it is bound to a variable
- B.Only when its value is actually needed
- C.Multiple times for correctness
- 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 marksRuntime polymorphism in C++ is achieved through:
- A.Function overloading
- B.Virtual functions and dynamic dispatch
- C.Templates
- 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 marksThe Phong shading model interpolates:
- A.Colors across the polygon surface (Gouraud shading)
- B.Surface normal vectors across the polygon, computing illumination at each pixel
- C.Only depth values
- 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 marksThe homogeneous coordinate representation of a 2D point (x, y) is:
- A.(x, y, 0)
- B.(x, y, 1)
- C.(x, y, x+y)
- 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 marksWhich of the following is NOT a type of projection in computer graphics?
- A.Isometric projection
- B.Cabinet projection
- C.Hyperbolic projection
- 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.