Cognizant GenC Next Data Structure Questions 2025

GenC Next Data Structure Questions 2025

Cognizant has announced its GenC Next Hiring profile for 2025 graduates. In this hiring exam, DSA plays a very important role. The hiring exam of GenC Next consists of three sections-:

  • Section 1 – Coding Round(Easy)
  • Section 2 – Code Debugging
  • Section 2 – Coding Round(Hard)

And, in above all sections Data structures plays a very important role, you’ll find questions based on DSA both in the GenC Next Code Debugging  Round and Coding Round.

Genc Next DSA
Total number of Questions in in TCS NQT Verbal

4 Question

Total Question

Time limit for TCS NQT Verbal Ability Section

100 minutes

Total Time

Marks rewarded for TCS NQT Verbal Ability Section

1 Mark/Question

Marking Scheme

No negative marking in TCS NQT Verbal Ability Section

No

Negative Marking

Practice Questions for GenC Next Data Structure

1. Prepster has a simple undirected planar graph on 4 vertices with 14 edges. If graph is a connected graph, then the number of bounded faces in any embedding of graph on the plane is equal to

10

10

31.07%

11

11

19.14%

12

12

43.62%

None of the mentioned

None of the mentioned

6.17%

Explanation : v-e+f=2 is used to calculate the number of bounded faces in any embedding of graphs on the plane.Here, in the given question we have v=4, e=14

So, f=2+(14-4) => f=12

2. Prepster wants to perform the insertion sorting on the array containing elements {2,1,4,3,7,9,0} , to sort the array in ascending order. How many insertion operations does he need to perform?

2

2

14.43%

1

1

5.73%

3

3

64.82%

None of the mentioned

None of the mentioned

15.02%

Given array contains elements {2,1,4,3,7,9,0}.

First insertion will done in inserting 1 to its correct position , so array will become {1,2,4,3,7,9,0}

Second insertion will done in inserting 3 to its correct position , so array will become {1,2,3,4,7,9,0}

And third insertion will done in inserting 0  to its correct position , so array will become {0,1,2,3,4,7,9}

3. A stack is implemented as a linear array A[0…N-1]. Prepster writes the following
functions for popping an element from the stack.

Fun_POP (top, N)
{
  if (top >= 0)
    {
      // Add your code//
    }
  else
    {
    print "Underflow"
    }

return top
}

Prepster wants to know what should be written at the place of  // Add your code//

top = top+1

top = top+1

25.7%

top = top-1

top = top-1

71.68%

Error

Error

1.57%

None of the mentioned

None of the mentioned

1.05%

As Fun_POP() will delete the element so the index of top will get decremented by 1.

4. Prepster design a complete graph G of order x. Then how many maximum cut vertices does that graph contain?

x

x

7.99%

x-1

x-1

33.79%

x-2

x-2

36.99%

x+1

x+1

21.23%

Explanation : Vertex cut is a subset of vertices of a graph which, if removed (or "cut")--together with any incident edges--disconnects the graph (i.e., forms a disconnected graph). A complete graph G, of order x will contain x-2 maximum cut vertices.

5. What will be the maximum number size of the stack that will appear during the analysis of the ( ( ) ( ( ) ) ( ( ) ) ) at any instance of time

4

4

10.07%

3

3

54.49%

6

6

28.01%

2

2

7.44%

Let max_size=0 represents the required size and curr_size is the current size of the stack.

Initially ( will push into stack now curr_size=1, as curr_size > max_size so max_size =1

now,( will push into stack now curr_size=2, as curr_size > max_size so max_size =2

Now, ) comes then pop() operation will perform so curr_size become 1 ,

Now ( will push into stack now curr_size=2, as curr_size > max_size so max_size =2

Now again  ( will push into stack now curr_size=3, as curr_size > max_size so max_size =3

Now, ) comes then pop() operation will perform so curr_size become 2

Again ) comes then pop() operation will perform so curr_size become 1

Now ( will push into stack now curr_size=2, as curr_size > max_size so max_size =2

Now again  ( will push into stack now curr_size=3, as curr_size > max_size so max_size =3

Now, ) comes then pop() operation will perform so curr_size become 2

Again ) comes then pop() operation will perform so curr_size become 1

And at last ) comes then pop() operation will perform so curr_size become 1

So the max_size appears to be 3.

6. What the following function will return :

void fun (Node * root)
{

  if (!root)
    return;

  return (1 + fun (root->left) + fun (root->right)));

}

 

10

/  \

20     30

/  \

40   50

If the root of the above tree is passed initially to function fun():

5

5

48.22%

4

4

16%

3

3

22.22%

1

1

13.56%

Explanation : The following code will return the total number of nodes in the tree, in the given code we pass the root of the tree which has 5 odes, ence the function will give output as 5.

7. Prepster pushed seven elements X, Y, Z, P, Q, R and S onto a stack in reverse order, i.e., starting from S. The stack is popped five times and each element is inserted into a queue.Two elements are deleted from the queue The second deleted  item is ________.

X

X

6.22%

Y

Y

70.65%

P

P

17.91%

Q

Q

5.22%

In the given scenario: 

The status of the stack , when 7 elements are inserted into it is : S R Q P Z Y X.

As stack follows LIFO then  status of queue will be : X Y Z P Q.

Now the queue follows FIFO principle then the first deleted element will be X and second will be Y.

8. If the prepster performs a certain operation on an empty queue.

ADD 23

DELETE

ADD 20

ADD 32

ADD 90

DELETE

DELETE

ADD 8

ADD 27

What element is present at the front and rear respectively?

27 90

27 90

9.98%

90 27

90 27

73.87%

20 27

20 27

12.59%

27 20

27 20

3.56%

Initially the queue is empty,

Queue follows FIFO mechanism

Operation            Status of queue

ADD 23                23

DELETE               -

ADD 20                20

ADD 32                20  32

ADD 90                20  32  90

DELETE               32  90

DELETE               90

ADD 8                   90 8

ADD 27                 90 8 27

Hence, 90 is present at front end and 27 at rear end.

9. Prepster  pushes five items A, B, C, D, and E into a stack, one after another starting from A. The stack is popped with four items and each element is inserted in a queue. The two elements are deleted from the queue and pushed back on the stack. Now one item has popped from the stack. The popped item is

A

A

7.4%

B

B

12.33%

C

C

10.68%

D

D

69.59%

Initially the stack will contain A B C D E when stack is popped four times and element from stack will be inserted in queue then Queue contain E D C B and stack contain A only ,.

Now two elements will deleted from queue and inserted into stack then stack contain A E D and queue contain C B.

Now the popped element from stack is D.

10. What is the time complexity to check if a string(length m) is a substring of another string(length n) stored in a Directed Acyclic Word Graph, given n is greater than m?

O(m+n)

O(m+n)

48.62%

O(1)

O(1)

5.26%

O(n)

O(n)

32.33%

O(m)

O(m)

13.78%

 The time complexity will be O(n) , n is the length of the main string.

 

×

Please login to report

Cognizant GenC Next Data Structure Preparation Material

GenC Next is comparatively a difficult hiring than the normal Cognizant GenC, the level of questions in GenC Next exam are difficult and tricky, and covers a vast syllabus. DSA plays an important role in the GenC Next exam, as it is asked in both Code Debugging Round and in the Coding Round. Below we have mentioned all the topics that you need to cover to prepare for Data Structures for Cognizant GenC Next Exam.

  • Arrays
  • Searching and Sorting
  • Struct
  • Linked Lists
  • Queues
  • Stacks
  • Trees
  • Graphs

 

GenC Next Data Structure Section Details

DSA SectionGenC Next
Number of Questions4 Questions
Time Limit100 Mins
DifficultyHigh
ImportanceHigh

FAQs about GenC Next DSA Round

Is there a separate Data Structure round in GenC Next Exam ?

No, there is no separate section for DSA questions, you’ll find them in all the sections, with other questions

  • Section 1 – Coding round(easy)
  • Section 2 – Code Debugging Round
  • Section 3 – Coding Round(hard- Web UI Round)

Is there any sectional cut-off in genc Next exam ?

No, there is no sectional cut-off in GenC Next Exam, but you need to clear both the sections to move up to the interview round.

Is there any elimination round in genc Next exam ?

No, there is no elimination round in GenC Next Exam, but you need to clear both the sections to move up to the interview round.