UGC NET CS Practice Set 10

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

questions
33
Total marks
66
Duration
180 minutes
Negative marking
No

Subjects: Computer Science

Question 1

Computer Science · 2 marks

The DDA (Digital Differential Analyzer) line drawing algorithm uses:

  1. A.Only integer arithmetic
  2. B.Floating-point arithmetic with rounding
  3. C.Trigonometric functions
  4. D.Matrix multiplication

Correct answer: B

Explanation: DDA increments x or y by 1 (whichever has the larger range) and calculates the other coordinate by adding the slope (or its reciprocal), which is a floating-point operation. The result is rounded to the nearest integer for pixel plotting. Bresenham's algorithm avoids this by using only integer arithmetic.

Question 2

Computer Science · 2 marks

In the Liang-Barsky line clipping algorithm, the parameter t is used to represent:

  1. A.The color of the line
  2. B.A parametric value along the line (0 ≤ t ≤ 1)
  3. C.The thickness of the line
  4. D.The angle of the line

Correct answer: B

Explanation: Liang-Barsky uses the parametric form of the line: P(t) = P1 + t(P2 − P1), where 0 ≤ t ≤ 1. It computes t values for intersections with each clip boundary and determines the visible segment by finding the maximum entering t and minimum leaving t. It is more efficient than Cohen-Sutherland for most cases.

Question 3

Computer Science · 2 marks

Gouraud shading differs from flat shading in that it:

  1. A.Uses a single normal per polygon
  2. B.Interpolates vertex colors across the polygon surface
  3. C.Requires a Z-buffer
  4. D.Only works with triangles

Correct answer: B

Explanation: Flat shading uses one normal per polygon face, giving a faceted appearance. Gouraud shading computes illumination at each vertex and interpolates the resulting colors across the polygon using bilinear interpolation during scan conversion. This produces a smoother appearance but can miss specular highlights.

Question 4

Computer Science · 2 marks

In Bezier curves, the curve always passes through:

  1. A.All control points
  2. B.The first and last control points only
  3. C.The midpoint of the control polygon
  4. D.None of the control points

Correct answer: B

Explanation: A Bezier curve of degree n defined by n+1 control points always passes through the first (P₀) and last (Pₙ) control points. The intermediate control points influence the shape but the curve generally does not pass through them. The curve lies within the convex hull of the control points.

Question 5

Computer Science · 2 marks

Which of the following is true about abstract classes in object-oriented programming?

  1. A.They can be instantiated directly
  2. B.They contain at least one pure virtual (abstract) method and cannot be instantiated
  3. C.They cannot have concrete methods
  4. D.They do not support inheritance

Correct answer: B

Explanation: An abstract class contains at least one pure virtual function (in C++) or abstract method (in Java). It cannot be instantiated directly but can have concrete (implemented) methods. Subclasses must implement the abstract methods to be instantiable.

Question 6

Computer Science · 2 marks

Type coercion in programming languages refers to:

  1. A.Explicit type conversion by the programmer
  2. B.Implicit type conversion performed automatically by the compiler
  3. C.Conversion from object to primitive type
  4. D.Type checking at runtime

Correct answer: B

Explanation: Type coercion is automatic (implicit) type conversion performed by the compiler or interpreter (e.g., int to float in mixed expressions). Explicit type conversion (casting) is done by the programmer. Coercion can sometimes cause unexpected behavior or precision loss.

Question 7

Computer Science · 2 marks

In the λ-calculus, the expression (λx. x) is called:

  1. A.The identity function
  2. B.The successor function
  3. C.The constant function
  4. D.An invalid expression

Correct answer: A

Explanation: (λx. x) takes an argument x and returns x unchanged — the identity function. It is the simplest lambda abstraction. The constant function would be (λx. λy. x), and the successor function in Church numerals is (λn. λf. λx. f (n f x)).

Question 8

Computer Science · 2 marks

The call stack in a program grows when a function:

  1. A.Returns a value
  2. B.Is called (a new activation record is pushed)
  3. C.Declares a global variable
  4. D.Uses heap memory

Correct answer: B

Explanation: Each function call pushes a new activation record (stack frame) onto the call stack, containing local variables, parameters, return address, and saved registers. The stack shrinks when the function returns and its frame is popped. Deep recursion can cause stack overflow.

Question 9

Computer Science · 2 marks

In a pass-by-value-result (copy-in/copy-out) parameter passing mechanism, the actual parameter is:

  1. A.Never modified
  2. B.Copied into the formal at call time and copied back at return time
  3. C.Passed as a pointer
  4. D.Evaluated each time it is referenced

Correct answer: B

Explanation: In call by value-result (copy-in/copy-out), the actual parameter's value is copied to the formal parameter at call time (like call by value), and the final value of the formal is copied back to the actual at return time. It can differ from call by reference when aliasing is involved.

Question 10

Computer Science · 2 marks

The perspective projection of a 3D point onto a 2D plane involves dividing by the:

  1. A.X coordinate
  2. B.Y coordinate
  3. C.Z coordinate (depth)
  4. D.Sum of all coordinates

Correct answer: C

Explanation: In perspective projection with the center of projection at the origin and the projection plane at z = d, a 3D point (x, y, z) projects to (x·d/z, y·d/z). The division by z creates the foreshortening effect — distant objects appear smaller.

Question 11

Computer Science · 2 marks

In an ER diagram, a weak entity is one that:

  1. A.Has a primary key independent of other entities
  2. B.Cannot be uniquely identified without the primary key of its owner entity
  3. C.Has no attributes
  4. D.Cannot participate in relationships

Correct answer: B

Explanation: A weak entity depends on a strong (owner) entity for its identification. It has a partial key (discriminator) that, together with the primary key of the owner entity, forms its composite key. In ER diagrams, weak entities are shown with double rectangles.

Question 12

Computer Science · 2 marks

A deadlock involving only two processes P1 and P2 requires that:

  1. A.P1 holds a resource needed by P2, and P2 holds a resource needed by P1
  2. B.Both processes are in the ready state
  3. C.Both processes share the same code
  4. D.Preemption is allowed

Correct answer: A

Explanation: A two-process deadlock requires a circular wait: P1 holds resource R1 and requests R2 (held by P2), while P2 holds R2 and requests R1 (held by P1). Neither can proceed. All four Coffman conditions must hold.

Question 13

Computer Science · 2 marks

The Peterson's solution for mutual exclusion works correctly for:

  1. A.Any number of processes
  2. B.Two processes only
  3. C.Single-processor systems only
  4. D.Distributed systems

Correct answer: B

Explanation: Peterson's algorithm provides mutual exclusion for two processes using shared variables (flag[0], flag[1], turn). It satisfies mutual exclusion, progress, and bounded waiting. For n processes, extensions like the filter lock or bakery algorithm are needed.

Question 14

Computer Science · 2 marks

The multilevel feedback queue scheduling algorithm:

  1. A.Uses a single queue with fixed priority
  2. B.Uses multiple queues with the ability to move processes between queues based on behavior
  3. C.Is identical to FCFS
  4. D.Does not support preemption

Correct answer: B

Explanation: The multilevel feedback queue has multiple queues with different priorities and possibly different scheduling algorithms. Processes can move between queues based on their CPU burst behavior: CPU-intensive processes are demoted to lower-priority queues. This adapts to process characteristics automatically.

Question 15

Computer Science · 2 marks

In a system using segmentation with paging, a logical address consists of:

  1. A.Segment number and offset only
  2. B.Segment number, page number within the segment, and page offset
  3. C.Page number and frame number
  4. D.Only a virtual page number

Correct answer: B

Explanation: In segmented paging, the address has three parts: segment number (indexes the segment table to find the page table for that segment), page number (indexes that page table to find the physical frame), and offset within the page. This combines the logical view of segmentation with the physical efficiency of paging.

Question 16

Computer Science · 2 marks

The inode in Unix/Linux file systems stores:

  1. A.Only the file name
  2. B.File metadata (size, permissions, timestamps) and pointers to data blocks
  3. C.Only the file content
  4. D.The directory structure

Correct answer: B

Explanation: An inode stores all metadata about a file: size, owner, group, permissions, timestamps (created, modified, accessed), link count, and pointers to the actual data blocks (direct, single/double/triple indirect pointers). The file name is stored in the directory entry, not the inode.

Question 17

Computer Science · 2 marks

A semaphore initialized to 1 is called a:

  1. A.Counting semaphore
  2. B.Binary semaphore (mutex)
  3. C.Barrier
  4. D.Monitor

Correct answer: B

Explanation: A semaphore initialized to 1 acts as a binary semaphore (or mutex), allowing only one process/thread into the critical section. wait() decrements to 0 (lock), signal() increments back to 1 (unlock). A counting semaphore initialized to n allows up to n concurrent accesses.

Question 18

Computer Science · 2 marks

The page replacement algorithm that replaces the page that will not be used for the longest time in the future is:

  1. A.FIFO
  2. B.LRU
  3. C.Optimal (OPT / Belady's)
  4. D.Clock

Correct answer: C

Explanation: The Optimal (OPT/MIN/Belady's) algorithm replaces the page that will not be used for the longest time in the future. It produces the minimum possible number of page faults but requires future knowledge, making it impractical. It serves as a benchmark for comparing other algorithms.

Question 19

Computer Science · 2 marks

In test-driven development (TDD), the cycle is:

  1. A.Write code → Write tests → Refactor
  2. B.Write a failing test → Write minimum code to pass → Refactor
  3. C.Design → Implement → Deploy
  4. D.Plan → Develop → Review

Correct answer: B

Explanation: TDD follows the Red-Green-Refactor cycle: (1) Red — write a test that fails, (2) Green — write the minimum code to make the test pass, (3) Refactor — improve the code while keeping tests green. This ensures all code is covered by tests.

Question 20

Computer Science · 2 marks

Risk management in software engineering involves:

  1. A.Ignoring potential problems until they occur
  2. B.Identifying, analyzing, prioritizing, and mitigating risks throughout the project
  3. C.Only managing financial risks
  4. D.Delegating all risks to the client

Correct answer: B

Explanation: Risk management involves: (1) Risk identification — listing potential risks, (2) Risk analysis — assessing probability and impact, (3) Risk prioritization — ranking by severity, (4) Risk mitigation — developing strategies (avoidance, transfer, reduction, acceptance), and (5) Risk monitoring — tracking throughout the project.

Question 21

Computer Science · 2 marks

The term 'technical debt' in software engineering refers to:

  1. A.The cost of hardware upgrades
  2. B.The implied cost of additional rework caused by choosing a quick/easy solution now instead of a better approach
  3. C.The salary cost of the development team
  4. D.The licensing cost of third-party software

Correct answer: B

Explanation: Technical debt is the accumulated cost of shortcuts, quick fixes, and suboptimal design decisions. Like financial debt, it accrues 'interest' — future development becomes slower and more expensive. Refactoring 'pays down' the debt.

Question 22

Computer Science · 2 marks

A support vector machine (SVM) finds the:

  1. A.Hyperplane that minimizes training error without considering margins
  2. B.Maximum-margin hyperplane that separates classes
  3. C.Mean of all data points
  4. D.K nearest neighbors

Correct answer: B

Explanation: SVM finds the hyperplane that maximizes the margin (distance) between the nearest data points of different classes (support vectors). For non-linearly separable data, the kernel trick maps data to a higher-dimensional space. SVMs have strong theoretical foundations (structural risk minimization).

Question 23

Computer Science · 2 marks

In a multi-layer perceptron, the vanishing gradient problem occurs primarily with:

  1. A.ReLU activation functions
  2. B.Sigmoid and tanh activation functions in deep networks
  3. C.Linear activation functions
  4. D.Softmax output layers

Correct answer: B

Explanation: The vanishing gradient problem occurs when gradients become exponentially small as they are backpropagated through many layers with sigmoid or tanh activations (whose derivatives are < 1). This makes early layers learn very slowly. ReLU (f(x)=max(0,x)) mitigates this because its derivative is 1 for positive inputs.

Question 24

Computer Science · 2 marks

In planning (AI), the STRIPS representation of an action includes:

  1. A.Only the action name
  2. B.Preconditions, add effects, and delete effects
  3. C.Neural network weights
  4. D.Only postconditions

Correct answer: B

Explanation: In STRIPS (Stanford Research Institute Problem Solver), an action is defined by: (1) Preconditions — conditions that must be true to apply the action, (2) Add list — facts that become true after the action, (3) Delete list — facts that become false. This enables forward and backward state-space search.

Question 25

Computer Science · 2 marks

The term 'feature engineering' in machine learning refers to:

  1. A.Selecting hardware features for the computing platform
  2. B.The process of creating, selecting, and transforming input variables to improve model performance
  3. C.Engineering the loss function
  4. D.Designing the neural network architecture

Correct answer: B

Explanation: Feature engineering involves creating new features from raw data (e.g., extracting day of week from a timestamp), selecting relevant features (removing noise), and transforming features (normalization, encoding). Good features are often more important than the choice of algorithm.

Question 26

Computer Science · 2 marks

The minimax value at a terminal node in a game tree represents:

  1. A.The number of moves to reach the node
  2. B.The utility/payoff of that game state for the maximizing player
  3. C.The probability of reaching that state
  4. D.The depth of the node

Correct answer: B

Explanation: Terminal nodes in a game tree are assigned utility values representing the payoff for the maximizing player (e.g., +1 for win, 0 for draw, −1 for loss in chess). The minimax algorithm propagates these values up: MAX nodes take the maximum of children, MIN nodes take the minimum.

Question 27

Computer Science · 2 marks

Uniform cost search expands the node with the:

  1. A.Lowest heuristic value
  2. B.Lowest path cost from the start node
  3. C.Highest depth
  4. D.Lowest branching factor

Correct answer: B

Explanation: Uniform cost search (UCS) expands the node with the lowest cumulative path cost g(n) from the start node. It is optimal and complete for non-negative costs. It is equivalent to Dijkstra's algorithm and to A* with h(n)=0. BFS is a special case when all step costs are equal.

Question 28

Computer Science · 2 marks

In an embedded system with a limited instruction set, the instruction 'SWAP R1, R2' can be simulated using XOR operations as:

  1. A.R1 = R1 XOR R2; R2 = R1 XOR R2; R1 = R1 XOR R2
  2. B.R1 = R1 AND R2; R2 = R1 OR R2; R1 = R1 AND R2
  3. C.R1 = R1 + R2; R2 = R1 − R2; R1 = R1 − R2
  4. D.R1 = NOT R1; R2 = NOT R2

Correct answer: A

Explanation: The XOR swap works because XOR is self-inverse: (1) R1 ← R1⊕R2, (2) R2 ← R1⊕R2 = (R1⊕R2)⊕R2 = R1, (3) R1 ← R1⊕R2 = (R1⊕R2)⊕R1 = R2. No temporary variable needed. Note: option C (addition/subtraction) also works but can overflow.

Question 29

Computer Science · 2 marks

A lossy page replacement policy is one where:

  1. A.Page data is lost during replacement
  2. B.More page faults can occur when given more frames (Belady's anomaly)
  3. C.Pages are never written back to disk
  4. D.All pages are pinned in memory

Correct answer: B

Explanation: This is describing FIFO, which is subject to Belady's anomaly — a counterintuitive situation where increasing the number of page frames can increase the number of page faults. Stack algorithms (LRU, Optimal) are immune to this anomaly because their page sets are nested.

Question 30

Computer Science · 2 marks

The readers-writers problem in OS is a classic synchronization problem where:

  1. A.Only one reader or one writer can access the resource at a time
  2. B.Multiple readers can access simultaneously, but writers need exclusive access
  3. C.Readers and writers always alternate
  4. D.Only writers can access the resource

Correct answer: B

Explanation: In the readers-writers problem, multiple readers can read simultaneously (read operations don't conflict). However, a writer needs exclusive access — no other readers or writers may be active. Solutions must prevent starvation: the first readers-writers problem may starve writers, the second may starve readers.

Question 31

Computer Science · 2 marks

The strongest normal form that can always be achieved without losing information (lossless decomposition) is:

  1. A.2NF
  2. B.3NF
  3. C.BCNF
  4. D.4NF

Correct answer: C

Explanation: BCNF decomposition always produces a lossless join but may not preserve all functional dependencies. 3NF decomposition can always achieve both lossless join AND dependency preservation. BCNF is stronger (every FD has a superkey on the left). 4NF addresses multi-valued dependencies.

Question 32

Computer Science · 2 marks

In SQL, the COALESCE function returns:

  1. A.The maximum value from a list
  2. B.The first non-NULL value from a list of expressions
  3. C.The sum of all values
  4. D.NULL if any value is NULL

Correct answer: B

Explanation: COALESCE(expr1, expr2, ..., exprN) evaluates the expressions left to right and returns the first non-NULL value. It is equivalent to a searched CASE expression. Common use: COALESCE(phone, email, 'N/A') provides a fallback chain.

Question 33

Computer Science · 2 marks

The Lossless Join (Non-Additive Join) decomposition of a relation R into R1 and R2 is guaranteed if:

  1. A.R1 ∩ R2 → R1 or R1 ∩ R2 → R2 holds
  2. B.R1 ∪ R2 = R
  3. C.R1 and R2 have no common attributes
  4. D.The decomposition preserves all functional dependencies

Correct answer: A

Explanation: A decomposition of R into R1 and R2 is lossless if and only if the common attributes (R1 ∩ R2) form a superkey for either R1 or R2. This is the necessary and sufficient condition. R1 ∪ R2 = R is necessary but not sufficient.

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