UGC NET CS Practice Set 6
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 marksA Turing machine can be in how many configurations for a given input at any step?
- A.Exactly one (deterministic TM)
- B.Always more than one
- C.Zero configurations
- D.Unbounded number simultaneously
Correct answer: A
Explanation: A deterministic Turing machine (DTM) is in exactly one configuration at each step — the transition function maps each (state, symbol) pair to exactly one (state, symbol, direction). A nondeterministic TM may branch into multiple configurations, but a standard DTM has a single execution path.
Question 2
Computer Science · 2 marksThe pumping lemma is used to prove that a language is:
- A.Regular
- B.NOT regular (or NOT context-free)
- C.Decidable
- D.NP-complete
Correct answer: B
Explanation: The pumping lemma provides a necessary condition for regularity (or context-freeness). If a language violates the pumping lemma, it is NOT regular (or NOT context-free). However, satisfying the pumping lemma does NOT prove a language is regular — it is a one-directional tool.
Question 3
Computer Science · 2 marksIn three-address code, the statement x = y + z uses which form?
- A.Quadruple
- B.Triple
- C.It can be represented as quadruple, triple, or indirect triple
- D.Only assembly code
Correct answer: C
Explanation: Three-address code can be implemented using quadruples (op, arg1, arg2, result), triples (op, arg1, arg2 — result is implicit), or indirect triples. All three are valid representations; the choice depends on the compiler's design.
Question 4
Computer Science · 2 marksLoop unrolling is an optimization technique that:
- A.Reduces the number of iterations by replicating the loop body
- B.Moves loop-invariant computations outside the loop
- C.Eliminates dead code inside the loop
- D.Converts recursion to iteration
Correct answer: A
Explanation: Loop unrolling replicates the loop body multiple times within a single iteration, reducing loop overhead (fewer branch instructions, increment/comparison operations). Moving loop-invariant code outside is 'code motion', a different optimization.
Question 5
Computer Science · 2 marksThe CFL pumping lemma states that for a CFL L, there exists a constant n such that any string z ∈ L with |z| ≥ n can be decomposed as z = uvwxy where:
- A.|vx| ≥ 1, |vwx| ≤ n, and uvⁱwxⁱy ∈ L for all i ≥ 0
- B.|vw| ≥ 1 and uv²wx²y ∈ L
- C.|uvwxy| = n and vwx can be pumped
- D.|vy| ≤ n and uvwxy ∈ L for all decompositions
Correct answer: A
Explanation: The CFL pumping lemma states: for any CFL L, there exists n such that for any z ∈ L with |z| ≥ n, z = uvwxy where (1) |vx| ≥ 1, (2) |vwx| ≤ n, and (3) uvⁱwxⁱy ∈ L for all i ≥ 0. Both v and x are pumped together.
Question 6
Computer Science · 2 marksWhich reduction technique is used to prove NP-hardness?
- A.Turing reduction
- B.Polynomial-time many-one (Karp) reduction
- C.Logarithmic-space reduction
- D.Linear-time reduction
Correct answer: B
Explanation: To prove a problem is NP-hard, we show a polynomial-time many-one (Karp) reduction from a known NP-hard problem to it. If a known NP-complete problem (like SAT) can be reduced to problem X in polynomial time, then X is NP-hard.
Question 7
Computer Science · 2 marksIn the OSI model, which layer is responsible for end-to-end error recovery and flow control?
- A.Data Link Layer
- B.Network Layer
- C.Transport Layer
- D.Session Layer
Correct answer: C
Explanation: The Transport Layer (Layer 4) provides end-to-end communication services including reliable data transfer, error recovery (retransmission), flow control, and segmentation/reassembly. The Data Link Layer provides hop-to-hop error detection, not end-to-end.
Question 8
Computer Science · 2 marksA Class B IP address has how many bits for the network portion (excluding subnetting)?
- A.8
- B.16
- C.24
- D.14
Correct answer: B
Explanation: A Class B address starts with 10 in the first two bits, and uses 16 bits for the network ID and 16 bits for the host ID. This allows 2^14 = 16,384 networks (since 2 bits are the class identifier) with up to 65,534 hosts each.
Question 9
Computer Science · 2 marksIn TCP, the three-way handshake involves the exchange of:
- A.SYN, SYN-ACK, ACK
- B.SYN, ACK, FIN
- C.ACK, SYN, ACK
- D.FIN, ACK, RST
Correct answer: A
Explanation: TCP connection establishment uses a three-way handshake: (1) Client sends SYN (with initial sequence number), (2) Server replies with SYN-ACK (acknowledging client's SYN, sending its own SYN), (3) Client sends ACK (acknowledging server's SYN). The connection is now established.
Question 10
Computer Science · 2 marksA network has the IP address 192.168.10.0/26. How many usable host addresses are available per subnet?
- A.30
- B.62
- C.64
- D.126
Correct answer: B
Explanation: With /26, the host portion is 32 − 26 = 6 bits. Total addresses per subnet = 2^6 = 64. Subtracting the network address and broadcast address: 64 − 2 = 62 usable host addresses.
Question 11
Computer Science · 2 marksWhich routing algorithm uses distance vectors and can suffer from the count-to-infinity problem?
- A.Dijkstra's algorithm
- B.Bellman-Ford (Distance Vector) algorithm
- C.Link State algorithm
- D.Flooding
Correct answer: B
Explanation: The Bellman-Ford (Distance Vector) algorithm exchanges distance vectors between neighbors. It can suffer from the count-to-infinity problem when a link fails, causing routing loops. Solutions include split horizon, poison reverse, and hold-down timers.
Question 12
Computer Science · 2 marksDNS (Domain Name System) primarily uses which transport protocol?
- A.TCP only
- B.UDP primarily, TCP for zone transfers and large responses
- C.Neither TCP nor UDP
- D.ICMP
Correct answer: B
Explanation: DNS primarily uses UDP port 53 for standard queries (speed over reliability for small messages). TCP port 53 is used for zone transfers between DNS servers and when the response exceeds 512 bytes (or the EDNS0 buffer size).
Question 13
Computer Science · 2 marksIn the RSA public-key cryptosystem, the security is based on the difficulty of:
- A.The discrete logarithm problem
- B.Factoring large prime numbers
- C.Factoring the product of two large primes
- D.The knapsack problem
Correct answer: C
Explanation: RSA's security relies on the computational difficulty of factoring n = p × q, the product of two large prime numbers. Given the public key (e, n), finding the private key d requires knowing φ(n) = (p−1)(q−1), which requires factoring n.
Question 14
Computer Science · 2 marksARP (Address Resolution Protocol) is used to map:
- A.Domain names to IP addresses
- B.IP addresses to MAC addresses
- C.MAC addresses to IP addresses
- D.Port numbers to IP addresses
Correct answer: B
Explanation: ARP resolves IP addresses to MAC (hardware) addresses on a local network. When a host needs to send a frame to an IP address on its subnet, it broadcasts an ARP request; the owner of that IP replies with its MAC address.
Question 15
Computer Science · 2 marksThe maximum data rate of a noiseless channel with bandwidth B Hz and L signal levels is given by Nyquist's formula as:
- A.2B log₂(L) bps
- B.B log₂(1 + S/N) bps
- C.B × L bps
- D.2B × L bps
Correct answer: A
Explanation: Nyquist's formula for a noiseless channel: Maximum data rate = 2B log₂(L) bps, where B is bandwidth in Hz and L is the number of discrete signal levels. Shannon's formula (B log₂(1+S/N)) applies to noisy channels.
Question 16
Computer Science · 2 marksIn the sliding window protocol, if the window size is 7, the minimum number of bits needed for the sequence number is:
- A.3
- B.4
- C.7
- D.2
Correct answer: A
Explanation: For a Go-Back-N protocol with window size W, we need the sequence number space ≥ W + 1, so at least 8 values → 3 bits (2^3 = 8 ≥ 7+1). For Selective Repeat, the requirement is sequence space ≥ 2W, which would need 4 bits.
Question 17
Computer Science · 2 marksHTTPS operates at which layer of the OSI model?
- A.Transport Layer
- B.Between Transport and Application Layer (via TLS/SSL)
- C.Network Layer
- D.Data Link Layer
Correct answer: B
Explanation: HTTPS uses TLS/SSL, which operates between the Application Layer and the Transport Layer. TLS provides encryption, authentication, and integrity. In the TCP/IP model, it sits on top of TCP and below application protocols like HTTP.
Question 18
Computer Science · 2 marksA firewall that examines each packet independently based on source/destination IP and port is called a:
- A.Application gateway
- B.Packet filter firewall
- C.Stateful inspection firewall
- D.Proxy server
Correct answer: B
Explanation: A packet filter firewall examines each packet independently based on header fields (source/destination IP, port, protocol) without maintaining connection state. A stateful firewall tracks connection states. An application gateway operates at the application layer.
Question 19
Computer Science · 2 marksThe Diffie-Hellman key exchange algorithm is vulnerable to:
- A.Brute-force attack
- B.Man-in-the-middle attack
- C.Dictionary attack
- D.Replay attack
Correct answer: B
Explanation: Basic Diffie-Hellman does not authenticate the communicating parties, making it vulnerable to man-in-the-middle attacks. An attacker can intercept and establish separate shared secrets with each party. This is mitigated by using authenticated DH or digital signatures.
Question 20
Computer Science · 2 marksIn CSMA/CD, what happens when a collision is detected?
- A.The station continues transmitting
- B.The station sends a jam signal and uses binary exponential backoff before retransmitting
- C.The station waits for a fixed time period
- D.The frame is discarded permanently
Correct answer: B
Explanation: In CSMA/CD (used in Ethernet), upon detecting a collision, the station sends a 48-bit jam signal to ensure all stations detect the collision, then waits a random time chosen by binary exponential backoff (0 to 2^k − 1 slot times, k = attempt number) before retransmitting.
Question 21
Computer Science · 2 marksSMTP (Simple Mail Transfer Protocol) uses which port number by default?
- A.21
- B.25
- C.80
- D.443
Correct answer: B
Explanation: SMTP uses TCP port 25 for sending email between mail servers. Port 21 is FTP control, port 80 is HTTP, and port 443 is HTTPS. SMTP with TLS uses port 587 (submission) or 465 (SMTPS).
Question 22
Computer Science · 2 marksIn IPv4, the total header size (without options) is:
- A.16 bytes
- B.20 bytes
- C.32 bytes
- D.40 bytes
Correct answer: B
Explanation: The minimum IPv4 header size (without options) is 20 bytes (5 × 32-bit words). This includes version, IHL, total length, identification, flags, fragment offset, TTL, protocol, header checksum, source and destination IP addresses.
Question 23
Computer Science · 2 marksWhich protocol is used for secure remote login?
- A.Telnet
- B.SSH (Secure Shell)
- C.FTP
- D.SNMP
Correct answer: B
Explanation: SSH (Secure Shell) provides encrypted remote login, command execution, and file transfer. Telnet transmits data (including passwords) in plain text. SSH uses public-key cryptography for authentication and symmetric encryption for data transfer.
Question 24
Computer Science · 2 marksThe maximum transmission unit (MTU) for Ethernet is:
- A.576 bytes
- B.1500 bytes
- C.1518 bytes
- D.65535 bytes
Correct answer: B
Explanation: Standard Ethernet has an MTU of 1500 bytes (the maximum payload size of an Ethernet frame). The total frame size is up to 1518 bytes (14 bytes header + 1500 bytes payload + 4 bytes FCS). Jumbo frames can have MTU up to 9000 bytes.
Question 25
Computer Science · 2 marksIn digital signatures, the sender signs the message using:
- A.The receiver's public key
- B.The sender's private key
- C.The sender's public key
- D.A shared symmetric key
Correct answer: B
Explanation: In digital signatures, the sender signs (encrypts the hash of) the message with their private key. The receiver verifies the signature using the sender's public key. This provides authentication (proves the sender's identity) and non-repudiation.
Question 26
Computer Science · 2 marksThe A* search algorithm uses which evaluation function?
- A.f(n) = g(n) only
- B.f(n) = h(n) only
- C.f(n) = g(n) + h(n)
- D.f(n) = max(g(n), h(n))
Correct answer: C
Explanation: A* uses f(n) = g(n) + h(n), where g(n) is the actual cost from start to node n, and h(n) is the heuristic estimate from n to the goal. A* is optimal and complete when h(n) is admissible (never overestimates) and consistent.
Question 27
Computer Science · 2 marksIn a Bayesian network, two nodes X and Y are d-separated given evidence Z if:
- A.X and Y are always independent
- B.Every undirected path between X and Y is blocked by Z
- C.X is a parent of Y
- D.X and Y share the same parents
Correct answer: B
Explanation: D-separation in Bayesian networks determines conditional independence. X and Y are d-separated given Z if every undirected path between them is blocked. A path is blocked if it contains a chain/fork node in Z, or a collider NOT in Z (and none of its descendants are in Z).
Question 28
Computer Science · 2 marksWhich of the following is a characteristic of an expert system?
- A.It learns entirely from data without explicit rules
- B.It uses a knowledge base and inference engine to emulate human expert reasoning
- C.It always uses neural networks
- D.It cannot explain its reasoning
Correct answer: B
Explanation: Expert systems consist of a knowledge base (domain facts and rules, typically if-then rules) and an inference engine (forward/backward chaining). They can explain their reasoning chain (explanation facility), unlike black-box models.
Question 29
Computer Science · 2 marksIn fuzzy logic, a membership function assigns values in the range:
- A.{0, 1} only
- B.[0, 1] (continuous interval)
- C.(-∞, +∞)
- D.{-1, 0, 1}
Correct answer: B
Explanation: In fuzzy logic, a membership function maps each element to a degree of membership in the range [0, 1], where 0 means no membership and 1 means full membership. Values between 0 and 1 represent partial membership, unlike crisp (Boolean) logic.
Question 30
Computer Science · 2 marksA perceptron can learn which of the following functions?
- A.XOR
- B.AND
- C.Any non-linearly separable function
- D.All Boolean functions
Correct answer: B
Explanation: A single-layer perceptron can only learn linearly separable functions. AND and OR are linearly separable and can be learned. XOR is not linearly separable (proved by Minsky and Papert, 1969) and requires at least one hidden layer.