Python Questions and Answers – List Comprehension – 2
Python Multiple Choice Questions & Answers (MCQs) focuses on “List Comprehension – 2”. Q 1. Read the information given below carefully and write a list comprehension such that the output is: [‘e’, ‘o’] w="hello" v=('a', 'e', 'i', 'o', 'u') A. [x for…
Python Questions and Answers – List Comprehension – 1
Python Multiple Choice Questions & Answers (MCQs) focuses on “List Comprehension – 1”. Q 1. What will be the output of the following Python code? l=[1,2,3,4,5] [x&1 for x in l] A. [1, 1, 1, 1, 1]B. [1, 0, 1, 0, 1]C. [1, 0, 0, 0, 0]D. [0, 1, 0, 1,…
Python Questions and Answers – Matrix List Comprehension
Python Multiple Choice Questions & Answers (MCQs) focuses on “Matrix List Comprehension”. Q 1. Which of the following matrices will throw an error in Python?A. A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] B. B = [[3, 3, 3] [4, 4, 4] [5, 5, 5]] C. C = [(1,…
Python Multiple Choice Questions – List Comprehension
Python Multiple Choice Questions & Answers (MCQs) focuses on “List Comprehension”. Q 1. What will be the output of the following Python code snippet? k = [print(i) for i in my_string if i not in "aeiou"] A. prints all characters of my_string…
Python Questions and Answers – Lists – 6
Python Multiple Choice Questions & Answers (MCQs) focuses on “Lists-6”. Python Multiple Choice Questions & Answers (MCQs) focuses on “Lists-6”. Q 1. What will be the output of the following Python code? a=[10,23,56,[78]] b=list(a) a[3][0]=95…
Python Questions and Answers – Lists – 5
Python Questions and Answers – Lists – 5 Python Question Paper focuses on “Lists”. Q 1. What will be the output of the following Python code? print("Hello, World!"[7:]) values = [[3, 4, 5, 1], [33, 6, 1, 2]] v = values[0][0] for lst in values: for…
Python Questions and Answers – Lists – 4
Python Programming Questions & Answers focuses on “Lists”. Q 1. What will be the output of the following Python code? def f(i, values = []): values.append(i) return values f(1)f(2)v = f(3)print(v) A. [1] [2] [3]B. [1] [1, 2] [1, 2, 3]C. [1, 2,…
Python Questions and Answers – Lists – 3
Python Programming Questions & Answers focuses on “Lists”. Q 1. Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after list1.reverse()?A. [3, 4, 5, 20, 5, 25, 1, 3]B. [1, 3, 3, 4, 5, 5, 20, 25]C. [25, 20, 5, 5, 4, 3, 3, 1]D. [3, 1, 25, 5,…
Python Multiple Choice Quizs Question– String
Q 1. The output of executing string.ascii_letters can also be achieved by:A. string.ascii_lowercase_string.digitsB. string.lowercase_string.uppercaseC. string.lettersD. string.ascii_lowercase+string.ascii_uppercase Show Answer Answer:-D.…
Python Quizs Question and Answers – Formatting – 2
Q 1. The output of which of the codes shown below will be: “There are 4 blue birds.”?A. ‘There are %g %d birds.’ %4 %blueB. ‘There are %d %s birds.’ %(4, blue)C. ‘There are %s %d birds.’ %[4, blue]D. ‘There are %d %s birds.’ 4, blue Show Answer…