NCA-ADS domain - 7% of the exam

Advanced Data Structures

Advanced Data Structures is 7% of the NCA-ADS exam. These are the objectives it covers, each with practice questions, with every answer explained.

The domain in numbers

26
Practice questions
3
Objectives
10
Medium
16
Hard

Where people go wrong

  • Swapping eigenvector centrality, Katz and PageRank

    The wrong answers offer a neighbouring link-based centrality in place of the one described. Eigenvector centrality is offered for directed graphs with dangling pages, where it has no teleportation term and can fail to converge. Katz is offered where a damping factor is required, though Katz adds a constant baseline and attenuates path contributions. PageRank uses a damping or teleportation factor to redistribute the rank of dangling nodes, and Katz is the fix when eigenvector scores collapse to zero.

    See it in a sample question
  • Offering neighbour-based scores for a path-based measure

    Degree, eigenvector centrality and PageRank are offered for questions about shortest paths. Degree counts direct neighbours, so a node with many neighbours inside one community can score high without bridging anything. Eigenvector centrality rewards links to important nodes. Betweenness counts how often a node lies on the shortest path between other pairs, which measures bridging. Closeness is the reciprocal of the average shortest-path distance to all reachable nodes, so it measures how few hops separate a node from the rest.

    See it in a sample question
  • Dropping edge weights and direction when building the graph

    The wrong answers discard information the scenario depends on. Breadth-first search finds shortest paths by hop count and ignores edge weights, so it cannot return minimum total travel time, whereas single-source shortest path sums the positive weights. An undirected build collapses 'follows' and 'is followed by', so follower counts are lost. A directed Graph keeps edge orientation, and in-degree then counts the edges pointing at an account.

    See it in a sample question
  • Running a lag or rolling window across store boundaries

    The wrong answers apply a lag or moving average to the whole DataFrame. A global shift gives the first 7 rows of one store the values of the previous store, and an ungrouped rolling window spans the boundary between adjacent stores. Sorting by date alone interleaves stores on the same day. Grouping by store_id first confines each 7-period shift or rolling mean to one store's rows, so no values cross store boundaries.

    See it in a sample question
  • Deriving calendar parts from the raw timestamp integer

    The wrong answers pull the hour or weekday out of the numeric timestamp or out of text. A datetime is stored as an integer count of nanoseconds since the epoch, so taking it modulo 24 gives a meaningless residue, and epoch seconds modulo seven do not match weekdays because a day spans 86400 seconds. A per-row Python function bypasses vectorised GPU execution. The dt accessor, with hour or dayofweek, returns the integer in one vectorised pass.

    See it in a sample question

Objectives in this domain

Sample questions from this domain

Free sampleAdvanced Data Structureshard

An analyst scores vertices in a directed web-link graph where a page should rank highly when it is linked to by other high-ranking pages, and the algorithm must tolerate dangling pages with no outbound links by redistributing rank through a teleportation factor. Which cuGraph algorithm matches this description?

  • APageRank, because it models a random surfer that follows links and teleports with a damping factor, giving high scores to pages linked from other high-scoring pages and handling dangling pages by redistributing their rank. Correct
  • BKatz centrality, because it sums weighted contributions from neighbours and so handles dangling pages through its attenuation factor in the same way.
  • CEigenvector centrality, because the principal eigenvector assigns high scores to vertices linked from high-scoring vertices and inherently handles dangling vertices.
  • DBetweenness centrality, because it counts shortest paths through each page and thereby ranks pages linked from important pages while absorbing dangling vertices.
PageRank uses a random-walk model with a teleportation damping factor to rank vertices by inbound links from high-scoring vertices and to handle dangling vertices. The scenario names the defining traits of PageRank: recursive importance from high-scoring linkers and a teleportation factor that redistributes rank from dangling vertices to keep the random walk well defined. Eigenvector centrality lacks teleportation and can degenerate on such directed graphs.

Why A is correct: Correct: PageRank's random-surfer model with a damping or teleportation factor rewards pages linked from high-scoring pages and explicitly redistributes the rank of dangling pages, matching every stated requirement.

Why B is wrong: Tempting because Katz also propagates influence from neighbours through an attenuation factor, but it uses a fixed base score and decaying path weights rather than a random-walk teleportation factor, so it does not model dangling-page redistribution the way described.

Why C is wrong: Tempting because eigenvector centrality also rewards being linked from important vertices, but on directed graphs with dangling vertices it can fail to converge or yield degenerate scores, which is the exact problem teleportation was introduced to fix.

Why D is wrong: Tempting because betweenness is a well-known centrality, but it measures how often a vertex lies on shortest paths, not whether high-scoring vertices link to it, and it has no teleportation mechanism for dangling pages.

Free sampleAdvanced Data Structureshard

A social-network analyst needs to identify the accounts that act as bridges between otherwise disconnected communities - accounts whose removal would most fragment the network into isolated clusters. Which centrality measure directly quantifies this bridging role?

  • ADegree centrality
  • BEigenvector centrality
  • CBetweenness centrality Correct
  • DPageRank centrality
Select the correct centrality measure to identify structural bridge nodes in a community-partitioned network. Betweenness centrality is defined as the fraction of all-pairs shortest paths that pass through a given node. Nodes sitting on many cross-community shortest paths accumulate large betweenness scores, making them the primary candidates whose removal would sever inter-community connectivity. Degree and eigenvector centrality reward connection count or neighbour prestige rather than structural bridging. PageRank uses a damped random walk on directed edges and does not isolate the bridging property. In cuGraph, betweenness centrality is available via cugraph.betweenness_centrality, operating on a cuGraph Graph object and returning a cuDF DataFrame of scores.

Why A is wrong: Degree centrality counts a node's direct connections, so highly connected hubs score well. A node can have many neighbours within a single community and score high on degree while providing no bridging function between separate groups.

Why B is wrong: Eigenvector centrality scores a node by the importance of its neighbours rather than their raw count. It rewards connection to influential nodes, not structural bridging, so an isolated bridge node between two small clusters would score poorly.

Why C is correct: Betweenness centrality counts how often a node appears on the shortest path between every other pair of nodes. Nodes that lie on paths crossing community boundaries accumulate high betweenness scores, directly measuring the bridging role.

Why D is wrong: PageRank models a random-walk process and assigns higher scores to nodes receiving links from already-important nodes. It was designed for directed web-link graphs and does not directly measure the fraction of shortest paths passing through a node.

Free sampleAdvanced Data Structureshard

An analyst loads a follower network into cuGraph where edge direction matters: an edge from src to dst means src follows dst. She builds the graph object from a cuDF edge list and intends to rank accounts by how many other accounts follow them. To get this semantics correct, how should she construct the cuGraph Graph and which degree should she read?

  • AConstruct an undirected Graph from the edge list, then read total degree, because cuGraph treats follower relationships symmetrically once the edges are loaded.
  • BConstruct a directed Graph and read out-degree, because out-degree summarises how influential a node is and therefore reflects its follower count.
  • CConstruct an undirected Graph and read in-degree, because converting to undirected first guarantees the in-degree and out-degree values are populated consistently.
  • DConstruct a directed Graph and read in-degree, because with edges oriented src follows dst, an account's in-degree counts the edges pointing at it, which equals its number of followers. Correct
Building a directed cuGraph Graph preserves edge orientation, so in-degree counts incoming edges and equals follower count under a src-follows-dst convention. Edge direction encodes the follower relationship. A directed graph keeps src and dst distinct, and in-degree tallies edges terminating at a vertex, which under src-follows-dst is precisely the count of accounts that follow it. An undirected build erases that distinction.

Why A is wrong: Tempting because undirected graphs are simpler and total degree is a single number, but an undirected build discards direction, so 'follows' and 'is followed by' collapse together and the follower-count semantics are lost.

Why B is wrong: Tempting because out-degree is a real directed measure, but with edges oriented src follows dst, out-degree counts who a node follows, not who follows it, so it answers the wrong question.

Why C is wrong: Tempting because it pairs an in-degree read with a definite-sounding rule, but undirected graphs do not distinguish in-degree from out-degree, so the construction choice contradicts the measure requested and the follower count is not recovered.

Why D is correct: Correct: a directed cuGraph Graph preserves edge orientation, and in-degree counts incoming edges, which under the src-follows-dst convention is exactly the number of followers an account has.

Free sampleAdvanced Data Structuresmedium

An engineer has a cuDF DataFrame of per-store daily sales sorted by store_id and sale_date, and wants a trailing 7-day moving average of daily_sales for each store that never blends one store's readings into another store's window. Which approach produces the correct per-store rolling feature on the GPU?

  • AApply a 7-period rolling mean directly to the daily_sales column of the whole sorted DataFrame without grouping, since the prior sort keeps each store's rows contiguous.
  • BResample the data to a 7-day frequency and take the mean of each bucket, which yields the trailing average for every store at once.
  • CSort the data by sale_date alone and apply a 7-period rolling mean, relying on the date order to keep each store's window separate.
  • DGroup the DataFrame by store_id and apply a 7-period rolling mean to daily_sales within each group, so every window is bounded inside a single store's rows. Correct
A per-group rolling window in cuDF requires grouping by the entity key first so each trailing window stays bounded within one series. A rolling window slides across consecutive rows regardless of any logical entity boundary, so applying it to a concatenated multi-store frame leaks neighbouring stores into the window edges; grouping by store_id first confines each window to a single store's ordered rows.

Why A is wrong: Contiguous sorting is tempting because each store's rows sit together, but an ungrouped rolling window still spans the boundary between adjacent stores, contaminating the first six windows of every store after the first.

Why B is wrong: Resampling looks relevant because it aggregates over time, but it produces one non-overlapping value per 7-day block rather than a trailing window that advances one day at a time, and it does not isolate stores.

Why C is wrong: Sorting by date alone interleaves rows from different stores on the same day, so a rolling window mixes multiple stores together, which is the exact contamination the engineer wants to avoid.

Why D is correct: Grouping by store_id first restricts every rolling window to one store's rows, so the 7-period trailing mean is computed independently per store and no values cross store boundaries.

Free sampleAdvanced Data Structuresmedium

A data scientist is engineering features from a cuDF DataFrame whose 'pickup_time' column is already a datetime dtype. They want a new integer column giving the hour of day from 0 to 23 for each ride so a model can learn demand patterns across the day. Which expression produces that column efficiently on the GPU?

  • Adf['pickup_time'].dt.hour, using the datetime accessor to return the clock hour of each timestamp as an integer Series. Correct
  • Bdf['pickup_time'].astype('int64') % 24, treating the underlying integer timestamp as the hour by taking its remainder modulo 24.
  • Cdf['pickup_time'].apply(lambda t: t.hour), iterating a Python function over each timestamp to read its hour attribute.
  • Ddf['pickup_time'].str.slice(11, 13).astype('int'), extracting the hour characters from the string form of each timestamp.
The dt accessor extracts datetime components such as the hour as a vectorised integer Series directly on the GPU. A datetime dtype carries calendar and clock fields that the dt accessor surfaces, so dt.hour reads the clock hour for every row in one vectorised GPU operation; integer modulo misreads epoch nanoseconds, a Python lambda runs row by row, and the string accessor does not apply to datetime data.

Why A is correct: The dt accessor exposes calendar and clock components of a datetime column, and dt.hour returns the hour of day as a vectorised integer Series computed directly on the GPU, which is the intended way to derive this feature.

Why B is wrong: A datetime is stored as an integer internally, which makes a modulo trick seem clever, but that integer counts nanoseconds since the epoch, so taking it modulo 24 yields a meaningless residue rather than the clock hour.

Why C is wrong: Reading a timestamp's hour attribute is conceptually correct, which is tempting, but a row-wise Python lambda forces element-by-element execution that bypasses the vectorised GPU path and is far slower than the dedicated accessor.

Why D is wrong: Slicing characters would extract the hour digits from an ISO string, which sounds workable, but the string accessor does not apply to a datetime dtype, so this raises an error unless the column is first converted back to text.

Other domains in this exam

See also the NCA-ADS cert hub, the study guide, and the cheat sheet.

Examworthy is not affiliated with or endorsed by NVIDIA. Original, blueprint-aligned practice material only.