Python 3 MCQ (SET-7) – Multiple Choice Questions and Answers

What will be the output after the following statements? b = 3 for a in range(10, 1): b -= a + 1 print(b) a. 7 b. 4 c. 3 d. 8 What will be the output after the following statements? b = 1 for a in range(1, 5): b *= a + 1 print(b) a. … Read more

Python 3 MCQ (SET-6) – Multiple Choice Questions and Answers

What will be the output after the following statements? x = ‘2.7’ print(x.isdecimal()) a. True b. False c. 1 d. 0 What does the following statement do? x = open(‘python.csv’, ‘r’) a. Opens an existing text file named python.csv to write b. Opens an existing text file named python.csv to append c. Opens an existing … Read more

Python 3 MCQ (SET-5) – Multiple Choice Questions and Answers

What does the following statements do?from datetime import *print(datetime.today().strftime(‘%x’))a. Displays the time appropriate for localeb. Displays the current year as 00 to 99c. Displays the current year as 0001 to 9999d. Displays the date appropriate for locale What does the following statements do?from datetime import *print(datetime.today().strftime(‘%X’))a. Displays the current year as 0001 to 9999b. Displays … Read more

Python 3 MCQ (SET-4) – Multiple Choice Questions and Answers

What is printvar in the following statements? myvar = 5 def printvar() : print(myvar) printvar() a. A list b. A string c. An integer d. A function What will be the output after the following statements? myvar = 5 def printvar() : print(myvar, end =”) printvar() printvar() a. 55 b. 5 5 c. 5 d. … Read more

Python 3 MCQ (SET-3) – Multiple Choice Questions and Answers

What will be the output after the following statements? x = {0:4, 1:8, 2:16, 3:32} print(list(x.values())[2]) a. [4, 8] b. [4, 8, 16] c. 16 d. 8 What will be the output after the following statements? x = {0:4, 1:8, 2:16, 3:32} print(x.items()) a. dict_items(4, 8, 16, 32) b. dict_items([4, 8, 16, 32]) c. dict_items[0, … Read more