Skip to content

Category Archives: Python-Quizzes

Given a function that does not return any value, what value is shown when executed at the shell? (A) int (B) bool (C) void (D)… Read More
What is the output of the following program : print "Hello World"[::-1] (A) dlroW olleH (B) Hello Worl (C) d (D) Error Answer: (A) Explanation:… Read More
What is the output of the following program : i = 0 while i < 3:        print i        i++        print i+1 (A) 0 2 1… Read More
Which operator is overloaded by the or() function? (A) || (B) | (C) // (D) / Answer: (B) Explanation: or() function overloads the bitwise OR… Read More
Which function overloads the >> operator? (A) more() (B) gt() (C) ge() (D) None of the above Answer: (D) Explanation: rshift() overloads the >> operatorQuiz… Read More
What is the output of the following code : print 9//2 (A) 4.5 (B) 4.0 (C) 4 (D) Error Answer: (C) Explanation: The ‘//’ operator… Read More
What is the output of the following program : import re sentence = 'horses are fast' regex = re.compile('(?P<animal>\w+) (?P<verb>\w+) (?P<adjective>\w+)') matched = re.search(regex, sentence)… Read More
Which of the following is the use of id() function in python? (A) Id returns the identity of the object (B) Every object doesn’t have… Read More
What is called when a function is defined inside a class? (A) Module (B) Class (C) Another Function (D) Method Answer: (D) Explanation: Quiz of… Read More
What is the output of the following program : y = 8 z = lambda x : x * y print (z(6)) (A) 48 (B)… Read More
What is the output of the following segment : chr(ord('A')) (A) A (B) B (C) a (D) Error Answer: (A) Explanation: ord() function converts a… Read More
What is the output of the following code : L = ['a','b','c','d'] print("".join(L)) (A) Error (B) None (C) abcd (D) [‘a’,’b’,’c’,’d’] Answer: (C) Explanation: “”… Read More
What will be the output of the following code : print type(type(int)) (A) type ‘int’ (B) type ‘type’ (C) Error (D) 0 Answer: (B) Explanation:… Read More