Infytq Python Questions and Answers 2023 | Set-2

Infytq Python Questions and Answers 2023: In this article, we will be discussing some important Infytq Python Questions and Answers which will help you guys to crack Infytq 2023 exam.

So, If you are also preparing for Infytq exam, Must prepare these questions.

Also check Infytq Detailed Exam Pattern, Click here

Infytq Python questions and answers

Question 6: What is the output of the code given below?

def fun(input_list,index):try:
        output_list = [ 0 ]*len(input_list)
        output_list [index] = input_list[index]/int(input_list[index+1])
        return output_list
    except ValueError :
        print("Invalid value")
    except ZeroDivisionError :
        print("Division by zero")
    finally :
        print("End of function")
try :
    list1 = [2,4,'6',2,8]
    list2 = fun(list1,  4) 
except TypeError :
    print ("Invalid type")
except IndexError :
    print ("Invalid index")
finally :
    print ("End of program")

A)    

Invalid value

End of function

End of program

B)

Division by zero

End of function

End of program

C)

End of function

Invalid index

End of program

D)

End of function

Invalid type

End of program

Answer: C

Question 7: What will be the output of the code?

a. dict1 – {1:11 , 2:22 , 3:33 , 4:44 , 5: 55}
dict2 – {1:11 , 2:22 , 3:33 , 4:44 , 5: 55}

b. dict1 — {1:11 , 2:22 , 3:33 , 4:44 , 5: 55}
dict2 — {2:11 , 3:22 , 4:33 , 5:44 , 6: 55}

c. dict1 – {1:11 , 2:22 , 3:33 , 4:44 , 5: 55}
dict2 – {2:10 , 3:20 , 4:30 , 5:40 , 6: 50}

d. dict1 – {1: 11 , 2 : 11, 3: 22, 4 : 33 , 5 : 44 , 6 : 55}
dict2 – {2 :10, 3: 21, 4:30 ,5: 41, 6:50}

Answer: C

Question 8: What is the output of the code given below?

def func (var1, var2, var3):if(var1<=var2):
        if(var3>-var2):
            if(var1+var2>-var3):
                print(-1)
            else:
                print(-2)
        else:
            if(var1+var3>var2):
                print (-3)
            else:
                print (-4)

func(156,2100,9500)

A. -2

B. -3

C. -4

D. -1

Answer: D

Question 9: Consider the following code snippet written in Python:

def fun(num) :if num<1 :
         	return 0 elif num%2 == 0 :
         	return fun (num-1)
   	else :
         	return num+fun(num-2)
print (fun (8) )

A. 8

B. 12

C. 20

D. 16

Answer: D

Question 10: What will be the Output of the below code?

a. Try again
score: 0
b. Good job
Can do better
Score: 1
C. Better luck next time
Score: 1
d. Can do better
AttributeError: ‘MultiplicationQuiz’ object has no attribute

Answer: Option C

Leave a Reply

Your email address will not be published. Required fields are marked *