InfyTQ Questions and Answers | Python Certification Round
InfyTQ Python MCQ Questions and Solutions for 2023 graduates
Infosys has announced the InfyTQ Certification exam for 2023 graduates. This exam will contain two rounds, that are Certification and Advantage Round.
The Certification Round consists of Python MCQ and Hands on Coding Questions. There will be 10 Python MCQ Questions and 2 coding questions if you opt for Python programming language while booking the slot.
Here we have provided sample practice questions for Python MCQ Questions Round based on previous year questions papers and sample test.
InfyTQ Online Test Pattern:-
Name Of The Section | Number Of Questions |
Hands-on coding | 2 Ques |
DBMS | 10 Ques |
Programming( JAVA or Python) | 10 Ques |
Coding | 3 Ques |
InfyTQ Python MCQ Round Practice Questions
Question 1 – st=”Cadbury Dairy Milk” x=st.split(‘a’) print(len(x)) What is the output of the above code?
Options
- 9
- 3
- 6
- 7
Answer- 3
Explanation – x=st.split(\’a\’) x becomes ,
x=[\’C\’, \’dbury D\’, \’iry Milk\’]
length of x is 3.
Question 2 –
st=”Happy Christmas and Happy new year”
if(st.startswith(“Happy”)):
x=st.rsplit(“Happy”)
print(len(x))
What is the output of above code?
Options
- 9
- 3
- 6
- 7
Answer- 3
Explanation – rstrip()-splits string at specified separator and returns string
startswith()-returns true if the string starts with specified value.
Question 3 – Which of the following sorts the elements of tuple?
Options
- sorted(tuple)
- tuple.sorted()
- sort(tuple)
- tuple.sort()
Answer- sorted(tuple)
Explanation – sorted() is used to sort tuple , .sort() function is used for lists
Question 4 –
t=(9,10,11,1,11)
s=0
for i in t:
if(t.count(i)>1):
s+=(i//2)
else:
s+=i*(t.index(i))
print(s)
What is the output of the above code?
Options
- 19
- 23
- 15
- 17
Answer- 23
Explanation –
for i=duplicate element if condition becomes true otherwise false
i=9 ==> s=0+9*0=0
i=10 ==> s=0+10*1=10
i=11 ==> s=10+11//2=15
i=1 ==> s=15+1*3=18
i=11 ==> s=18+11//2=23
S=23
Question 5 – print(ord(‘abc’)) What is the output of the above code?
Options
- 89
- 97
- 65 97
- error
Answer- error
Explanation – ord() function accepts only unit length string(character) and returns integer value for a given character.
Question 6 – What is the output of below code?
import math
L = [3, 1, 2, 4]
T = (‘A’, ‘b’, ‘c’, ‘d’)
L.sort()
counter = 0
for x in T:
L[counter] += ord(x)
counter += 1
break
print(math.ceil(max(L)/min(L)))
Options
- 33
- 43
- 67
- 37
Answer- 33
Explanation – L is sorted , L=[1,2,3,4]
L[0]+=ord(\”A\”)
where ord(\”A\”) is 65 so L[0] becomes 1+65=66
L=[66,2,3,4]
answer=66/2=33
Question 7 – Which of the following operators can be used on tuples?
Options
- %
- /
- *
- **
Answer- *
Explanation – Tuples can be multiplied but cant perform power operator(**), division (/) and modulus(%) operations on whole tuple.
Question 8 – Which of the following operators can be used on tuples?
Options
- %
- /
- *
- **
Answer- *
Explanation – Tuples can be multiplied but cant perform power operator(**), division (/) and modulus(%) operations on whole tuple.
Question 9 –
l=[1,2,3]
t=(‘a’,’b’,’c’)
s=””
for i in t:
for j in l:
if(t.index(i)==l.index(j)):
s+=i*j
print(s.find(“bb”))
What is the output of above code?
Options
- 1
- 2
- 3
- error
Answer- 1
Explanation – Final S becomes \”abbccc\”
s.find(\”bb\”) gives 1 as \”bb\” presents/starts from index 1
Question 10 – Which of the following is used to create an empty set?
Options
- []
- {}
- ()
- set()
Answer- set()
Explanation – {} is of class dictionary (print(type({})) try this code for more clarity) and set() is empty set
Login/Signup to comment