Browse By

InfyTQ – previous year Coding Questions with solution

InfyTQ – previous year Coding Questions with solution in Python. InfyTQ is launched by Infosys to help students learn relevant technologies today and in future. Students can interact directly with the company through InfyTQ Certification Exam. Students can benefit from anywhere and attained InfyTQ Certification Exam.

The InfyTQ Certification is a one of the test that gives you the opportunity to increase your programming knowledge and abilities to prove your industry readiness.

The difficulty level of InfyTQ is quite high so it is required to prepare well for this round. This year InfyTQ exam pattern is also Completely changed. So in this article we will give detailed knowledge of this Infytq coding questions and answers.

Certification Round

ICertification RoundNo. of questions in QualifierTotal Time
Hands- On Coding2 Ques3 Hours (Shared)
JAVA/ Python (MCQs)10 Ques3 Hours (Shared)
DBMS (MCQs)10 Ques3 Hours (Shared)
Total22 Ques3 Hours
  • Programming Test: In this section only two programming questions will be given you can slove using the programming language of your choice (Java/Python). 
  • Multiple Choice Questions: 10 question based on JAVA/ Python and 10 question based on DBMS.
  • There is no negative marking.
  • There is no sectional cut-off in this round but if you score 65 % above then you will eligible for the Advantage Round.

Infytq coding questions and answers

Problem 1

Input: Given a list of numbers separated with a comma. The numbers 5 and 8 are present in the list. Assume that 8 always comes after 5.

Case 1: num1 -> Add all numbers which do not lie between 5 and 8 in the Input List.
Case 2: num2 -> Numbers formed by concatenating all numbers from 5 to 8 in the list

Output: Sum of num1 and num2
Example: 1,2,2,5,3,1,7,8,4
Num1: 1+2+2+4=9
Num2: 53178

O/p=53178+9 = 53187

Coding:

array = list(map(int,input().split(“,”)))

# add all numbers which do not lie between 5 and 8 input
num1 = sum(array[:array.index(5)]) + sum(array[array.index(8) + 1:])
# numbers lie between 5 and 8
l = array[array.index(5):array.index(8) + 1]
# Initialization the number2
num2 = “”
# concatenate all number present in array 1
for i in l:
   num2 = num2*10+n
# output: num1 + num2
print(int(num2) + num1)

Problem 2

A string which is a mixture of letters ,numbers and special characters from which produce the largest possible even number from the available digit after removing the duplicates digits from the input string.

If an even number did not produce then return -1.

Constraints

4 <= Size of String <= 100

Input Format :
First line will be given string which will contain alphabets , digits and special characters.

Output Format : Print largest possible even number using distinct digits only from input string.

Test Case 1

Input :
infosys@337

Output : -1

Explanation 1

There is no even number possible using digits from Above String.
So output will be -1.

Test Case 2

Input :
Hello#81@219349

Output : 984312

Explanation

So after taking distinct digits 1, 2, 3, 4, 8, 9 from input string.
So largest possible even number using these digits will be 984312.

Pseudo code
Problem 3

Read ‘m’ m>4
n=m+1
Take m*n matrix
If any num is consecutive for 3 times either in a row, column, diagonals print the num, if there multiple num print min of those num

Note : If there are multiple numbers then print minimum of those numbers.
Note : If no consecutive number found in the given matrix then print -1.

Input Format :

First line will be given values of m and n.
Next m lines will be given with n integers in each lines.

Output Format : Print the minimum value according to given condition above.

Ex: m=6 take 6*7 matrix

2 3 4 5 6 2 4 3
2 3 4 7 6 7 6 2
2 3 5 5 5 5 2 5
2 3 1 1 2 1 3 6
1 1 1 1 9 0 3 5
2 3 1 1 5 1 2 7
O/p=1

Explanation

There is minimum 3 consecutive 1 at row number 6th and 1 is minimum in the given matrix. If no consecutive number found in the given matrix then print -1.

Pseudo Code
Problem 4

You will be given some pair of string and number.
Each pair will be separated with comma and in every pair string is associated with the number separated with colon(‘:’).
Apply these rules on given input data.
Rule 1 : If sum of squares of corresponding digits is even then rotate the string left by 1 position.
Rule 2 : If sum of squares of digits is odd then rotate the string right by 2 position.

Input Format :
First line will be given pairs separated with comma(‘,’) and in each pair string will be associated with number separated with colon(‘:’).

Output Format : Print rotated string of every pair separated with space.

Ex: Input :
rhdt:246,ghftd:1246

Output : trdt ftdgh

Explanation

Finding sum of squares of every digits of first pair 2*2+4*4+6*6=56 which is even so rotate rhdt left by 1 position so after rotating by one position so it will become trhd.
Finding sum of squares of every digits of second pair 1*1+2*2+4*4+6*6=57 which is odd then rotate ghftd right by 2 position so it will become ftdgh.
Hence output will be trhd ftdgh.

Pseudo Code

Problem 5

Given input of array of string in format employee name:employee number separated by commas.
Find maximum digit in the corresponding employee number which is less or equal to the length of employee name and add that place char into the final string.
Note : If there is no any digit which satisfy the condition then add ‘X’ into the final string.

Input Format :
First line will be given array of employee name associated with employee number and every employee details will be separated with commas (‘,’).

Output Format : Print final generated password according to given rule above.

Test Case 1

Input :
Robert:36787,Tina:68721,Jo:56389

Output : tiX

Explanation 1

  • So first employee name and employee number is Robert:36787. Now in the employee number 36787 there is 6 which is maximum and less than or equal to the length of Robert. So we will take 6th character of Robert. So here at 6th position in Robert there is t so we will add t into the final output string.
  • Same we will do with other employee details. Next one is Tina : 68721 Now in the emp number there is 2 which is maximum and less than or equal to the length of Tina. So we will take 2nd character of Tina. So here at 2nd position in Tina there is i so we will add i into the final output string.
  • Next employee is Jo:56389. So in the employee number there is no any digit which is maximum and less than or equal to length of Jo. So in this case we will add X into the final String Output. Hence final output string i.e generated password will be tiX.
Code
#s is string
s = input().split (“,”)
print(s)
stt=[]
numm=[]
for i in s:
s1,n = i.split(“:”)
stt.append(s1)
numm.append(n)
print(stt)
print(numm)
def pas(ss,n):
l=len(ss)
while l!=0:
if str(1) in n:
return ss[l-1]
else:
l-=1
return “X”
for i in range(len(numm)):
print(pas(stt[i],numm[i]),end=””)
Problem 6

Find the longest palindrome from a string
Input: moomso
Possible cases
Moom, mom, oso, 000, omo
Longest is moom so output: moom

Code
s = input()
#generating substring
ara = [s[i:j+1] for i in range(len(s)) for j in range(i,len(s))]
l=0
out=””
for i in ara:
rev= i[::-1]
if i == rev and len(i)>l:
l=len(i)
out=i
print(out)

आशा करता हूँ, कि यह आर्टिकल आपको पसंद आया होगा तो सोच क्या रहे हैं अभी इसी वक्त इसे अपने दोस्तों के साथ सोशल मीडिया पर Share करें।

ThankingYou………………धन्यवाद………………..शुक्रिया………………..मेहरबानी…………………..

Read More