All Blogs

Python Coding Questions for Infytq 2022

Received Offers From:
No items found.
Python Coding Questions for Infytq 2022

Coding comprises 60% of the total weightage in the Infytq examination. If you are thoroughly prepared with the coding part then the chances of cracking the exam increase significantly as the cutoff is 65%.

In this article, we will be discussing some previous coding questions that have been asked in the Infytq examination. This will give you an idea of the pattern of the questions asked.

Start preparing now for InfyTQ 2021–2022 Exam with Edyst Special InfyTQ Test Prep. Pack!

To know the pattern and syllabus of the Infytq examination check our previous article on How to Prepare for the Infytq Examination?

Here are some of the Python coding questions that have been asked in previous years.

1. String rotation

You are given a list of strings each having 2 components to it — word and integer. These 2 components are separated by :.

  • If the square of digits in the number component is even, then you must rotate the word to the right by 1
  • If the square of digits in the number component is odd, then you must rotate the word to the left by 2

Finally, print the rotated word.

Example Input



2*2+4*4+6*6 = 56 which is even so rotate rhdt --> trhd

1*1+2*2+4*4+6*6 = 57 which is odd so rotate ghftd --> ftdgh

2. Pronic Numbers

Pronic number is a number that is the product of two consecutive integers, that is, a number n is a product of x and (x+1).

Take a string in which random numbers are present and we have to find the product and the numbers(one is lesser and one is greater) which are already present in the string. Also the numbers x and x+1 are single-digit numbers. Let’s see the example:

E.g. Given a string contains 1203456. The multiplication of 3 and 4(one is lesser and one is greater) product become 12 and it’s present in the string. Like 4 and 5 (one is lesser and one is greater) the product is 20 and it’s present in the string and so on.

In such a way, We have to find all the numbers and in the output, we have to display the pronic numbers on a single line. Display only distinct numbers and make sure they are in sorted order.

If we haven’t found any product then print -1.

Example Input

0 2 6 12 20 56

3. Consecutive Numbers in Matrix

You are given an m*n matrix such that n = m+1. In the given matrix, find if any number is consecutive for 3 times either in row, column, diagonals print the num.

If there are multiple such numbers then print minimum of those numbers.

Input format

  • First line contains m, the number of rows
  • Following m lines contain n numbers

Example Input

2 3 4 5 6 2 4
2 3 4 7 6 7 6
2 3 5 5 5 5 2
2 3 1 1 2 1 3
1 1 1 1 9 0 3
2 3 1 1 5 1 2



The questions asked are of medium difficulty and can be easily solved if you practice well. Practice on Complete Coding Test & Interview Preparation Pack to succeed at Coding rounds at companies like TCS (Ninja), Wipro, Infosys, Mindtree, Valuelabs, CGI, and many more.

“BELIEVE in yourself, and hope for the best.”

We hope you find this piece of writing helpful in any way possible.

Wanna drop us some suggestions & ideas to write articles on?
Write to us @

Visit Edyst Website —

Visit Edyst YouTube Channel —

Visit Edyst Instagram Page-

Visit Edyst Telegram Channel-

About Edyst:

We are an online learning destination for aspiring software developers to get ready for the most in-demand job.

Check Edyst Most Popular Courses:

- Full Stack Web Developer Bootcamp

- Adv. Algorithms and Data Structures Bootcamp

- Python Programming: Intro + Advanced

- Java Programming: Intro + Advanced

- Complete Coding Test and Preparation Pack

-Wipro Elite NLTH 2021 Test Pack

Blog Author Image

Sanket is currently pursuing in Information Technology and loves to solve real-life problems through coding. He loves doing competitive programming & has also worked as a Content Creator Intern in many companies.