Skip to main content

TCS Xplore 2023 - PYTHON MCQ question for best practice ( iON Proctored Assessment )

                            Multiple Choice Question On PYTHON 

                                            Part - 01 





Some Important Points : 

-->   Developed by : Guido van Rossum

-->   Extesion : .py 

-->   Case Sensitive  : yes 

-->   Support : oops  yes 


1. Like the else, the elif statement is optional 

    a. True                             b. False 


2. Suppose s is “\t\tWorld\n”, what is s.strip() ?

     a. World                          b. world 

     c. WORLD                      d.  \tWorld\n

Explanation : The string strip() method in python is built-in from Python. It helps the developer to remove the whitespaces or specific characters from the string at the beginning and end of the string.


3. Function can not have return statement

         False

4. Which method is used to delete an object created by initializing constructor.

        Destructor

5.  What gets printed ? nums=set([1,1,2,3,3,3,4])

      print(len(nums))

     a. 4                       b. 6

     c. 2                       d. 7


6.  E=’hello’ print E.find(‘e’)

     a. 1                      b. 5

     c. 2                       d. 3


7.  Which type of Programming does Python support?

       a) object-oriented programming
       b) structured programming
       c) functional programming
       d) all of the mentioned

Explanation: Python is an interpreted programming language, which supports object-oriented, structured, and functional programming


8.   What will be the value of the following Python expression?

       4 + 3 % 5
   
       a. 7                     b. 2

      c. 1                      d. 3


9.   Which keyword is used for function in Python language?

       a) Function
       b) def
       c) Fun
       d) Define

Explanation: The def keyword is used to create, (or define) a function in python


10.   Which of the following character is used to give single-line comments in Python?
   
        a) //                                 b) #
        c) !                                  d) /*



--------------------------------------------- THANK YOU -----------------------------------------------


                  
                                                         Part - 02






11.  What will be the output of the following Python code?
       
       i = 1
while True:
    if i%3 == 0:
        break
    print(i)
 
    i + = 1

      a) 1 2 3
      b) error
      c) 1 2
      d) none of the mentioned

Explanation : SyntaxError, there shouldn’t be a space between + and = in +=.


12.  What will be the output of the following Python code snippet if x=1?
        
            x<<2

         a) 2                                  b) 4
        c) 3                                  d) 8


13.   What are the values of the following Python expressions?

        2**(3**2)
    (2**3)**2
     2**3**2
     
       a) 512, 64, 512
        b) 512, 512, 512
        c) 64, 512, 64
        d) 64, 64, 64


14.  What will be the output of the following Python expression if x=56.236?
print("%.2f"%x)

         a) 56.236
         b) 56.23
         c) 56.0000
         d) 56.24


15.   What will be the output of the following Python code ?

             for i in [1, 2, 3, 4][::-1]:

        print (i)

Ans : 4 3 2 1


16.   What will be the output of the following code snippet?

      print(2**3 + (5 + 6)**(1 + 1))



17.   Data type of var is ? 
 
         var = 10
print(type(var)) var = "Hello" print(type(var))

Ans : int , str


18. What will be the output of the following code snippet?
a = [1, 2, 3, 4, 5]
sum = 0
for ele in a:
   sum += ele 
print(sum)

Answer , write in the comment 

19.    output ? 

       def thrive(n):

if n % 15 == 0: print("thrive", end = “ ”) elif n % 3 != 0 and n % 5 != 0: print("neither", end = “ ”) elif n % 3 == 0: print("three", end = “ ”) elif n % 5 == 0: print("five", end = “ ”)
thrive(35) thrive(56) thrive(15) thrive(39)

20. output ? 

example = ["Sunday", "Monday", "Tuesday", "Wednesday"]; print(example[-3:-1])


--------------------------------------------- THANK YOU -----------------------------------------------












Comments

Popular posts from this blog

Complete Strategy to clear TCS Xplore IPA in One Attempt Now ( 80+ Score )

  So hello Everyone , Here are the all Links from where you can Practice !  All the resources are searched from my best !  1. For KYT and Bizzskill  Link :- tcs Xplore course  2. Unix Operating system Link :-    a.  click here Link 1 b.  click here Link 2 c.  Click here Link 3   3. UI  Link :-  click here 4. SQL and Pl SQL Link : -  Click here Click here click here 5. Java MCQ  Link :-  click here click here click here 6. Java coding :-  Access the playlist on YouTube :-  click here to watch Access the blogs :-  click here All in one link :-   click here

TCS IPA previous year quistion ( 35 marks ) , Quistion , Input , output

 Problem Statement Video Link :    https://youtu.be/XCBvfJAo908 Create a class TravelAgencies with below attributes: regNo – int agencyName – String pakageType – String price – int flightFacility – boolean Write getters, setters for the above attributes . Create constructor which takes parameter in the above sequence. Create class Solution with main method. Implement two static methods – findAgencyWithHighestPackagePrice and agencyDetailsforGivenIdAndType in Solution class. findAgencyWithHighestPackagePrice method: This method will take array of TravelAgencies objects as an input parameter and return the highest package price from the given array of objects. agencyDetailsForGivenldAndType method: This method will take three input parameters -array of TravelAgencies objects, int parameter regNo and String parameter packageType. The method will return the TravelAgencies object based on below conditions. FlightFacility should be available. The input parameters(regNo and packageType) shoul

TCS IPA previous year problems solved [input + output ] in JAVA - (35 marks )

  Problem Statement :  Video Link :   Click Here Create a class AutonomousCar with the below attributes: carld – int brand – String   noOfTestsConducted – int noOfTestsPassed- int environment – String grade – String Write getters, setters for the above attributes . Create constructor which takes parameter in the above sequence except grade. Create class Solution with main method. Implement two static methods – findTestPassedByEnv and updateCarGrade in Solution class. findTestPassedByEnv method: This method will take two input parameters -array of AutonomousCar objects and string parameter environment. The method will return the sum of the noOfTestsPassed attribute from autonomousCar objects for the environment passed as parameter. If no autonomousCar with the given environment is present in the array of AutonomousCar objects, then the method should return 0. updateCarGrade method: This method will take a String parameter brand, along with the array of AutonomousCar objects. The method