• Study Materials
    • InfyTQ Archive
    • Infosys Archive
    • TCS Archive
    • Accenture Archive
    • AMCAT Archive
    • Capgemini Archive
    • Cisco Archive
    • CoCubes Archive
    • Cognizant(CTS) Archive
    • Deloitte Archive
    • DXC Archive
    • Goldman Sachs Archive
    • Hexaware Technologies Archive
    • LTI Archive
    • MindTree Archive
    • Virtusa Archive
    • Wipro Archive
  • Interview Preparation
    • C Interview Questions
    • Data Structures Interview Questions
    • DBMS Interview Questions
    • HR Interview Questions
    • Java Interview Questions
    • Operating System Interview Questions
    • Python Interview Questions
    • SQL Query Interview Questions
  • Tutorials
    • Node.js Tutorial
    • Express.js Tutorial
    • Python Tutorial
  • Programming
    • C Programming MCQs
    • C Code Snippets – Output Questions
    • Python Code Snippets – Output Questions
    • Java Code Snippets – Output Questions
  • Aptitude
    • Verbal Ability for Placements
CODE OF GEEKS

We at CODE OF GEEKS, aim at providing best and quality content for our users at no extra cost.

    • Study Materials
      • InfyTQ Archive
      • Infosys Archive
      • TCS Archive
      • Accenture Archive
      • AMCAT Archive
      • Capgemini Archive
      • Cisco Archive
      • CoCubes Archive
      • Cognizant(CTS) Archive
      • Deloitte Archive
      • DXC Archive
      • Goldman Sachs Archive
      • Hexaware Technologies Archive
      • LTI Archive
      • MindTree Archive
      • Virtusa Archive
      • Wipro Archive
    • Interview Preparation
      • C Interview Questions
      • Data Structures Interview Questions
      • DBMS Interview Questions
      • HR Interview Questions
      • Java Interview Questions
      • Operating System Interview Questions
      • Python Interview Questions
      • SQL Query Interview Questions
    • Tutorials
      • Node.js Tutorial
      • Express.js Tutorial
      • Python Tutorial
    • Programming
      • C Programming MCQs
      • C Code Snippets – Output Questions
      • Python Code Snippets – Output Questions
      • Java Code Snippets – Output Questions
    • Aptitude
      • Verbal Ability for Placements
CODE OF GEEKS
CODE OF GEEKS
  • Study Materials
    • InfyTQ Archive
    • Infosys Archive
    • TCS Archive
    • Accenture Archive
    • AMCAT Archive
    • Capgemini Archive
    • Cisco Archive
    • CoCubes Archive
    • Cognizant(CTS) Archive
    • Deloitte Archive
    • DXC Archive
    • Goldman Sachs Archive
    • Hexaware Technologies Archive
    • LTI Archive
    • MindTree Archive
    • Virtusa Archive
    • Wipro Archive
  • Interview Preparation
    • C Interview Questions
    • Data Structures Interview Questions
    • DBMS Interview Questions
    • HR Interview Questions
    • Java Interview Questions
    • Operating System Interview Questions
    • Python Interview Questions
    • SQL Query Interview Questions
  • Tutorials
    • Node.js Tutorial
    • Express.js Tutorial
    • Python Tutorial
  • Programming
    • C Programming MCQs
    • C Code Snippets – Output Questions
    • Python Code Snippets – Output Questions
    • Java Code Snippets – Output Questions
  • Aptitude
    • Verbal Ability for Placements

InfyTQ Previous Year Python Questions 2022

  • March 3, 2021
  • CODE OF GEEKS
  • 0

InfyTQ Previous Year Python Questions 2022 : Python Output based Questions asked in previous editions.

You are here : Home >> InfyTQ Archive >> InfyTQ Python Questions

1. Consider the following code given below ?

class Glove: 
    def __init__(self,color):
        self.__color = color 
    def get_color(self):
        return self.__color 
    def set_color(self,color):
        self.__color= color 
class Minion: 
    def __init__(self,glove): 
        self.__glove=glove 
        self.__color="Yellow"
    def get_glove(self):
        return self.__glove 
black_glove = Glove("Black")
red_glove = Glove("Red")
bob = Minion(black_glove)
black_glove.set_color(red_glove.get_color())
print(#line)

What should be placed in the place of #line to get the color of bob Minion’s glove ?

a. bob.__glove.__color
b. red_glove.get_color()
c. bob.get_glove().get_color()
d. bob.get_glove().__color

View Answer

Ans. c

2. Consider the following code :

class Customer: 
    def __init__(self,cust_id, cust_name):
        self.__cust_id = cust_id 
        self.__cust_name = cust_name
        self.__bill_amount = 0.0 
class RegularCustomer(Customer): 
    def __init__(self,cust_id, cust_name):
        self.__cust_id = cust_id 
        self.__cust_name = cust_name
        self.__bill_amount = 0.0 
        self.__discount = 5 

Identify the OOP principle(s) that has/have been implemented in the above code :

a. Only Encapsulation
b. Only Inheritance
c. Both Encapsulation and Inheritance
d. Only Polymorphism

View Answer

Ans. b

You are here : Home >> InfyTQ Archive >> InfyTQ Python Questions

3. Find the output of the following code :

values = ["823", "863"]
num = values[0][0:]
for row in range(0,len(values)): 
    for column in range(0, len(values[row])):
        if num > values[row][column:]:
            num = values[row][column:]
print(num)

a. 2
b. 3
c. 23
d. 823

View Answer

Ans. c

InfyTQ Study Materials & Previous Year Questions
  • InfyTQ 2022 Overview
  • InfyTQ Previous Year Coding Questions
  • InfyTQ Previous Year Python Questions
  • InfyTQ Previous Year Java Questions
  • InfyTQ Previous Year DBMS Questions
  • 100+ Python MCQs for InfyTQ
  • Java MCQs for InfyTQ

4. Consider the following code :

def function(string,list1):
    #line1
    while(num!=len(string)):
        if len(string)%2==0 or (string[num] in ('a','e','i','o','u')): 
            list1.append(string[num])
        #line2
        #line3
        break 
    return list1 
print(function("Epoch",[]))  

a. Line 1 : num=0, Line 2 : num+=1, Line 3 : function(string[num:],list1)
b. Line 1 : num=1, Line 2 : no code,Line 3 : list1 = function(string[num:],list1)
c. Line 1 : num=0, Line 2 : num+=1, Line 3 : list1 = function(string[num+1:],list1)
d. Line 1 : num=1, Line 2 : num+=1, Line 3 : list1 = function(string[num],list1)

View Answer

Ans. a

Pages: 1 2 3 4 5
Tags: infosys python programming questionsinfytq previous year questions pythoninfytq previous year questions python mcqinfytq python interview questionsinfytq python mcq questionsinfytq python mcq questions 2020infytq python mcq questions and answersinfytq python mcq questions with answersinfytq python practice questionsinfytq python previous year questionsinfytq python programming questionsinfytq python questionsinfytq python questions and answersinfytq questions 2021 pythoninfytq questions on pythoninfytq questions pythonpython infytqpython infytq questionspython mcq questions for infytqpython programming questions for fresherspython questions for infytq
  • Previous Hack with Infy 2021 – Eligibility, Registrations, Exam Pattern, Insights
  • Next InfyTQ Certification Exam| InfyTQ Screening Test 2021-2022| Eligibility| Helpful Tips

Leave a Reply Cancel reply

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

Learning Python

python tutorials

InfyTQ Previous Year Questions 2023

  • InfyTQ 2023 Overview
  • InfyTQ Previous Year Coding Questions
  • InfyTQ Previous Year Python Questions
  • InfyTQ Previous Year Java Questions
  • InfyTQ Previous Year DBMS Questions
  • 100+ Python MCQs for InfyTQ
  • Java MCQs for InfyTQ

Study Materials : Company Wise

CODE OF GEEKS

Subscribe to Newsletter

CODE OF GEEKS

Learn | Code | Achieve

Reach us

[email protected]
We at CODE OF GEEKS, aim at providing quality content to our users at no cost.
CODE OF GEEKS

Important Pages

About us
Advertise
Privacy Policy
Terms and Conditions
Refund Policy
Contact us

Placements – Study Materials

TCS NQT     Wipro     CapGemini
Accenture     MindTree     CTS
DXC     Hexaware Technologies     AMCAT
CoCubes     Goldman Sachs     Dell
Cisco     Deloitte     Virtusa     LTI     Infosys   

Tutorials

Python
Node.js
Express.js
Golang

Recent Posts

Strings in Go and its basic operations
  • August 11, 2023
Introduction to Functions in Go programming
  • August 11, 2023

Copyright @ CODE OF GEEKS. All Rights Reserved.