Python Questions

0 votes, 0 avg
695

Python Questions

1 / 15

1. As what datatype are the *args stored, when passed into a function?

2 / 15

2. Which of the following are valid escape sequences in Python?

3 / 15

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

a = 3
b = 1 
print(a, b)
a, b = b, a 
print(a, b)

4 / 15

4. Which one of the following is the use of function in python?

5 / 15

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

    def printMax(a, b):

        if a > b:

            print(a, 'is maximum')

        elif a == b:

            print(a, 'is equal to', b)

        else:

            print(b, 'is maximum')

    PrintMax(3, 4)

6 / 15

6. Which of the following is a Python tuple?

7 / 15

7. What will be the output of the following Python program?

    def addItem(listParam):

        listParam += [1]

     

    mylist = [1, 2, 3, 4]

    addItem(mylist)

    print(len(mylist))

8 / 15

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

x = "abcdef"
i = "a"
while i in x:
    x = x[:-1]
    print(i, end = " ")

9 / 15

9. Which of the following are valid string manipulation functions in Python?

10 / 15

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

x = 'abcd'
print(list(map(list, x)))

11 / 15

11. Loops are known as ___ in programming.

12 / 15

12. Study the following program:

class Std_Name:   
    def __init__(self, Std_firstName, Std_Phn, Std_lastName):  
        self.Std_firstName = Std_firstName  
        self. Std_PhnStd_Phn = Std_Phn  
        self. Std_lastNameStd_lastName = Std_lastName  
   
Std_firstName = "Wick"  
name = Std_Name(Std_firstName, 'F', "Bob")  
Std_firstName = "Ann"  
name.lastName = "Nick"  
print(name.Std_firstName, name.Std_lastName) 

What will be the output of the print statement?

13 / 15

13. Which of the following functions converts date to corresponding time in Python?

14 / 15

14. Python Dictionary is used to store the data in a ___ format.

15 / 15

15. Which of the following is not a valid set operation in python?

Your score is

The average score is 40%

0%

Written by Shubhranshu Shekhar, who has trained 20000+ students in coding.

Scroll to Top