Cognizant GenC Next Data Structure Questions 2021-22

GenC Next Data Structure Questions 2022

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

  • Section 1 – MCQ Round
  • Section 2 – Coding Round

And, in both these sections Data structures plays a very important role, you’ll find questions based on DSA both in the GenC Next MCQ Round and Coding Round

Cognizant GenC Next Data Structure Questions 2022
Total number of Questions in in TCS NQT Verbal

20 - 25 Question

Total Question

Time limit for TCS NQT Verbal Ability Section

40 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.21%

11

11

16.56%

12

12

47.45%

None of the mentioned

None of the mentioned

4.78%

 v-e+f=2 is used to calculate the number of bounded faces in any embedding of graphs on the plane.

 

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

13.5%

1

1

5.83%

3

3

66.56%

None of the mentioned

None of the mentioned

14.11%

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

23.88%

top = top-1

top = top-1

74.16%

Error

Error

1.12%

None of the mentioned

None of the mentioned

0.84%

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.09%

x-1

x-1

32.43%

x-2

x-2

39.86%

x+1

x+1

20.61%

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.23%

3

3

56.77%

6

6

24.09%

2

2

8.91%

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

49.36%

4

4

16.99%

3

3

19.87%

1

1

13.78%

The following code will return the total number of nodes in the tree

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.59%

Y

Y

71.79%

P

P

17.22%

Q

Q

4.4%

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

8.16%

90 27

90 27

77.3%

20 27

20 27

11.7%

27 20

27 20

2.84%

Queue follows FIFO mechanism so after performing all operation 90 is present at front 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

6.64%

B

B

12.89%

C

C

9.77%

D

D

70.7%

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)

47.31%

O(1)

O(1)

6.09%

O(n)

O(n)

34.41%

O(m)

O(m)

12.19%

 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 the MCQ 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 Questions20 – 25 Questions
Time Limit40 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 within both the sections, with other questions

  • Section 1 – MCQ Round
  • Section 2 – Coding 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.