Python QuestionsBy Kritika Papne / March 20, 2023 0 votes, 0 avg 695 123456789101112131415 Python Questions 1 / 15 1. As what datatype are the *args stored, when passed into a function? A. none of the above B. list C. tuple D. dictionary 2 / 15 2. Which of the following are valid escape sequences in Python? A. n B. t C. \ D. all of the above 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) A. 1 3 3 1 B. 1 3 1 3 C. 3 1 3 1 D. 3 1 1 3 4 / 15 4. Which one of the following is the use of function in python? A. Functions don’t provide better modularity for your application B. you can’t also create your own functions C. Functions are reusable pieces of programs D. All of the mentioned 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) A. 3 B. 4 C. 4 is maximum D. None of the mentioned 6 / 15 6. Which of the following is a Python tuple? A. {1, 2, 3} B. {} C. [1, 2, 3] D. (1, 2, 3) 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)) A. 5 B. 2 C. 8 D. 1 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 = " ") A. i i i i i i B. a a a a a a C. a a a a a D. none of the mentioned 9 / 15 9. Which of the following are valid string manipulation functions in Python? A. count() B. upper() C. strip() D. All of the above 10 / 15 10. What will be the output of the following Python code? x = 'abcd' print(list(map(list, x))) A. [‘a’, ‘b’, ‘c’, ‘d’] B. [[‘a’], [‘b’], [‘c’], [‘d’]] C. [‘abcd’] D. none of the above 11 / 15 11. Loops are known as ___ in programming. A. Control flow statements B. Conditional statements C. Data structure statements D. None of the mentioned above 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? A. Ann Bob B. Ann Nick C. Wick Bob D. Wick Nick 13 / 15 13. Which of the following functions converts date to corresponding time in Python? A. strptime() B. strftime() C. both A and B D. All of the above 14 / 15 14. Python Dictionary is used to store the data in a ___ format. A. Key value pair B. Group value pair C. Select value pair D. None of the mentioned above 15 / 15 15. Which of the following is not a valid set operation in python? A. Union B. Intersection C. Difference D. none of the above Your score isThe average score is 40% LinkedIn Facebook VKontakte 0% Restart quiz By WordPress Quiz plugin Written by Shubhranshu Shekhar, who has trained 20000+ students in coding. Kritika Papne