# InfyTQ Certification Round

## What is InfyTQ Certification Round ?

InfyTQ certification round is conducted to test your knowledge in programming and database management with the help of objective and hands-on questions. There will be an option to choose a programming language between Java and Python for this round.

After scoring 65% or more in the Certification round and going through other necessary requirements, you will be eligible to appear in the Advantage Round. ## InfyTQ Certification Round Sample Questions

To practice questions for InfyTQ  Certification Round you should have a strong hold of knowledge in solving java or python MCQs. Below here you will find sample questions based on InfyTQ latest exam pattern.

## Java Sample Questions

Question 1 –An Employee Management System application is used to maintain information about employees in an organization. In the application, employee details are stored in the ascending order of the employee Ids. Which algorithmic design technique would best fit if an employee needs to be searched based on the employee ld.

Options

1.  Greedy Approach
2. Brute Force
3. Divide and Conquer
4. Dynamic Programming

Explanation – Greedy algorithms are simple instinctive algorithms used for optimization (either maximized or minimized) problems. This algorithm makes the best choice at every step and attempts to find the optimal way to solve the whole problem.

Question 2 – What is the output of the code given below?

```class Computation {
public int add(int num1, int num2) {
return num1 + num2 ;
}
public int divide(int num1, int num2) {
return num1 / num2 ;
}
}
public class TestComputation {
Computation comput = new Computation ( ) ;
@Test
public void testAdd1 ( ) {
int expected = 5 ;
int actual = comput.add(2, 3) ;
Assert.assertEquals(expected, actual) ;
}
@Test
public void testAdd2 ( ) {
int expected = 7 ;
int actual = comput.add(2, 5) ;
Assert.assertEquals(expected , actual) ;
}
}```

Options

Explanation – Both the test case will pass and the output will be as expected.

Question 3 – What will be the output of the following test case ?

`public class Tester{public static void main (string[]args){int[] tempList = { 1, -1, -2 };int[] numList = { -2, -1, 1 };int length = numList.length;for (int value:tempList){int tempValue = value;if (value < 0)tempValue = length - math.abs (value);}if (Value == templist[tempValue]){if (value < 0){numList[length - temValue] = value;}else{numList[tempValue] = value;}}else{numList = value;}}}`

Options

1. [-2,-1,1}

2. [-2,-2,1]

3. [1,-2,1]

4. [-2,-1,2]

Explanation – Values will be the same after the third iteration of the for loop.

## Python Sample Questions

Question1:

Consider the Python code below.

Assume that the necessary imports have been done.

```class Shape (metaclass-ABCMeta) :
def _init_(self) :
print ( “I am in init”)
def draw_shape(self) :
pass
def set_color(self) :
pass
class Circle(Shape) :
def draw_shape(self) :
print(“Draw Circle”)
```

Which of the following statement(s) is/are TRUE?

i) Class Circle cannot be instantiated as it does not implement the set_color() method

ii) The above code will not compile because class Shape has two abstract methods

Options

1. Both i) and ii) are True
2. Neither of i) or ii) is True
3. Only i) is True
4. Only ii) is True

Explanation:

The abstract class can have multiple abstract functions.

Here class Shape has more than one abstract method. It is totally possible for a base class to have more than one abstract method but all these methods have to be implemented by the child class or a TypeError would occur.

Statement 1 says that the child class Circle cannot be instantiated which is true, as it does not implement all the abstract methods of the base class.

Statement 2 says the code will not compile because of the base class having more than one abstract method which is false.

Question 2:

Consider the following Python code snippet.

```class ClassA :
_param1=200def _init_(self) :
self._param1 = 100def  method1(self) :
#Line1____________
@staticmethod
def method2( ) :
#Line2_____________
obj1=ClassA( )
obj1.method1( )
#Line3_____________________```

Note: Line numbers are for reference only.

Fill in the blanks at Line1, Line2, and Line3 to get the output as 302.

Choose TWO CORRECT options

1. Line1:ClassA._param1=(ClassA._param1+1)+self._param1 Line2:print(self._param 1+1) Line3:self.method2()
2.  Line1:ClassA._param1=(ClassA._param1+2)+ClassA._param1 Line2:print(ClassA._param1) Line3:ClassA.method2()
3. Line1:ClassA._param1=(ClassA._param1+1)+self._param1 Line2:print(ClassA._param1+1) Line3:ClassA.method2()
4. Line1:ClassA._param1=(ClassA._param1+2)+self._param1 Line2:print(ClassA._param 1) Line3:method2()
5. Line1:ClassA._param1=ClassA._param 1 +(self._param1+2) Line2:print(ClassA._param 1) Line3:ClassA.method2()

3 and 5 is the correct option

Explanation:

1. There will be an error because of a self._param1 call outside the class
2. This option calls for ClassA.method2() and method2 is defined as → print(ClassA._param1) but the method2 is a static method and the values for ClassA.param1 has already been initialized in method1→ (ClassA._param1+2)+ClassA._param1 which is equivalent to → (200+2)+200 That ends up giving us 402 as the output.
3.  This option calls for ClassA.method2() and method2 is defined as → print(ClassA._param1+1) but the method2 is a static method and the values for ClassA.param1 has already been initialized in method1→ (ClassA._param1+1)+self._param1 which is equivalent to → (200+1)+100. That ends up giving us 302 as the output.
4.  This option calls for method2() and method2 is not defined outside the classes so basically it would not return anything
5.  This option again would be a call for the method2→ ClassA.method2() and method2 is defined as → print(ClassA._param1) but the method2 is a static method and the values for ClassA.param1 has already been initialized in method1→ ClassA._param1+(self._param1+2) which is equivalent to → 200+(100+2). That ends up giving us 302 as the output.

Question 3:

Number 14 needs to be searched using BINARY SEARCH in the following sorted list of numbers:

1, 3, 7, 9, 14, 19, 45

How many comparisons will be required to conclude that the number 14 is found at 5th position?

Note: We have used integer division for finding the middle element and the index starts with 0 (zero)

Options:

1. 2
2. 3
3. 4
4. 1

Explanation:

1st iteration:

low= 0

high= 6

mid= (0+6)//2 = 3

a<key, which means 9<14

2nd iteration:

low = mid+1 = 4

high = 6

mid = (4+6)//2 = 5

a>key, which means 19>14

3rd iteration: low = 4

high = mid – 1 = 4

mid = (4+4)//2 = 4

a==key, which means 14==14. Hence answer found

Question 4:

Consider the below inputs:

input_stack (Top to Bottom): 4, 2, 5, 10

```def generate (input_linked_list , input_stack):
element=0while(temp.get_next ( ) is not None):
temp.set_data (temp.get_data ( )+temp.get_next ( ). get_data ( )+element)
if temp.get_data ( ) %2 !=0:
temp.set_data(temp.get_data ( ) +input_stack.pop ( ) )
element=temp.get_data ( )
else:
input_stack.push (element )
element=temp.get_next ( ).get_data ( )
temp=temp.get_next ( )
temp.set_data(temp.get_data ( )+input_stack.pop ( ) )
```

What will be the content of Input_linked_list from head to tail and input_stack from top to bottom after the execution of the function generate?

Assumption: Stack and LinkedList classes, with the necessary methods, are available

Options:

1.  input_linked_list (Head to Tail): 7 -> 14 -> 20 -> 5 input_stack (Top of Bottom): 5, 10
2. input_linked_list (Head to Tail): 5 -> 7 -> 10 -> 5 input_stack (Top of Bottom): 2, 5, 10
3. input_linked_list (Head to Tail): 7 -> 14 -> 20 -> 3 input_stack (Top of Bottom): 5, 10
4. input_linked_list (Head to Tail): 7 -> 14 -> 20 -> 5 input_stack (Top of Bottom): 10

Answer: input_linked_list (Head to Tail): 5 -> 7 -> 10 -> 5 input_stack (Top of Bottom): 2, 5, 10

Explanation:

All the nodes are checked for the values to be a multiple of 2 and when they are not a value of the stack is popped and added to them and the previous values are overwritten.

Question 5:

What will be the output of below Python code?

```class Vehicle ( ):def __init__(self, color):
self.color=color
class FourWheeler(Vehicle):def __init__(self,no_of_gears,color):
super().__init__(color)
self.no_of_gears=no_of_gears
class TwoWheeler(Vehicle):def __init__(self,engine_cc):
super().__init__("Red")
self.engine_cc=engine_cc
self.color="Blue"

maruti=FourWheeler(4, "Red")
print (maruti.color,maruti.no_of_gears)
activa=TwoWheeler(80)
print(activa.color, activa.enigne_cc)
```

Options:

1. Error as object of TwoWheeler class cannot be created since required number of arguments have not been passed
2. Red 4

Red 80

3. Error: Cannot modify the value of attribute color inside TwoWheeler class

4.Red 4

Blue 80

Answer: Error: Cannot modify the value of attribute color inside TwoWheeler class

Explanation: We will not be able to modify the value of attribute colour inside TwoWheeler class, it would indirectly throw an error as ‘TwoWheeler’ object has no attribute ‘enigne_cc’

Question 6:

Consider the code given below.

```def display_cat_details(color, name1, name2=none, name3=None) : #Line 1pass
display_cat_details(“Brown”, “Fluffy”,”Snow”)
```

Which of the following function signatures when replaced in Line 1 would continue to execute successfully?

Options:

1. def display_cat_details(color, *names,name1)
2. def display_cat_details(color, name_list)
3. def display_cat_details(color, *names)
4. def display_cat_details(color, name1,*names)

Answer: Option C and D are supposed to be selected

Explanation:

1. Is again a invalid syntax as display_cat_details() takes 2 positional arguments but 3 were given
2. Same reason as A
3. This would take in all the 3 respective parameters and execute successfully
4. This also would take all the 3 parameters even though there are only 2 parameters given in the function definition, because of *names

Question 7:

Consider the below code:

```my_queue1 = Queue(3)
my_queue2 = Queue(3)
for index in range(0, 3):
my_queue.enqueue(index *3)
for index in range(0, 3):
if(index == 2):
break
my_queue2.enqueue(my_queue1.dequeue ( ) )
my_queue2.enqueue(12)
```

Assumption: Queue class, with the necessary methods, is available

What is the status of my_queue1 and my_queue2 after the execution of above code?

Options:

1. my_queue1(front->rear):0, 3, 6

my_queue2(front->rear):0, 3, 12

2. my_queue1(front->rear):6

my_queue2(front->rear):0, 3,

3. my_queue1(front->rear):6

my_queue2(front->rear):0, 3, 12

4. my_queue1(front->rear):Queue is empty.

my_queue2(front->rear):0, 3, 12

my_queue1(front->rear):6

my_queue2(front->rear):0, 3, 12

Explanation:

Here the queue1 is being filled as 0, 3, 6 (front to rear). When this is dequeued the order would be 0 first, then 3 and finally 6. So the 1st dequeue would give us 0, so now queue2 becomes 0 (front to rear). Next dequeue of queue1 would give us 3, which would be the 2nd enqueue for queue2. So now queue2 would be 0, 3 (front to rear). The dequeue of queue1 would stop here as the index reaches 2. Final enqueue of queue2 would happen with a 12. So finally queue2 becomes 0, 3, 12 (front to rear).

Question 8:

The following numbers are to be stored in a hash table(arriving in the order shown) using the hash function.

h(k)=k%4

4, 7, 16, 9, 17, 22

Identify for which numbers collision will NOT occur after mapping the numbers with the given hash function.

Options:

1. 4, 7, 16 and 9
2. 7, 9, 17 and 22
3. 7 and 22
4.  4, 16, 9 and 17

Explanation:

1. There would be a collision between 4 and 16 which would both give the value 0 for 4%4 and 16%4.
2. There would be a collision between 9 and 7 which would both give the value 1.
3. There would be no collision between 7 and 22.
4. All four numbers would end up in a collision.

Question 9:

What would be the state of the linked list after the following Python function is executed when the head node of the above-given linked_list and num=5 are passed as input to the function?

```def func(head, num) :
returnelse :
index = 1while(index < num) :
val = temp.get_data ( )
#get_data ( ) returns the data of the node
temp = temp.get_next ( )
#get_next ( ) returns the link to the next node
index +=1
temp.set_data(temp 1)
```

Assumption: LinkedList class, with the necessary methods, is available.

Options:

Explanation:

The iteration stops when the index value is greater than or equal to 5. Hence the last value 9 will be overwritten with 7.

Question 10:

John is visiting a zoo. After roaming for sometime, he finds that he has lost his way. John wants to reach the entry/exit gate. He remembers ‘Vans Ice-Cream’, a landmark which he saw while strolling in the zoo. John finds that there are 3 ways to reach Vans Ice-Cream from his current location and from Vans Ice-Cream there are 4 ways to reach the entry/exit gate.

Considering the above scenario, identify the most suitable data structure that can represent all possible ways to reach the entry/exit gate from John’s current location?

A. Graph

B. Tree

C. Stack

D. Queue

Explanation: Graphs are awesome data structures that you use every day through Google Search, Google Maps, GPS, and social media. They are used to represent elements that share connections. The elements in the graph are called Nodes and the connections between them are called Edges. This is a similar instance.

## FAQs

##### What is the syllabus of the InfyTQ Certification examination?
The exam will be testing your programming (either Java or Python), Database Management Systems (DBMS), and SQL skills.
##### Questions will be based on which programming language during InfyTQ Certification examination?
There will be an option to select a programming language between Java and Python while booking a test slot for the Certification Round. You will be tested on the same language which you have chosen for the certification round.

##### Can the InfyTQ certification examination test slot be changed after booking?
No, the slot cannot be changed after booking.
##### What is the eligibility criteria for InfyTQ Certification Exam?

B.Tech, B.E.,  M.Tech, M.E., MCA, MCM, or M.Sc. students completing the degree course in 2023 are eligible.

##### Is there any Age limit for the  InfyTQ Certification Exam?

No, there is no age restriction as long as you are completing graduation/post graduation in 2023.

##### Will the Infosys Certification affiliated by a board?
The Infosys Certification is an independent technology certification issued by Infosys Limited.

##### What is the registration fee?
There is no registration fee.