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. 10
What will be the output after the following statements? def call(var) : print(var, end =”) call(45) a. 55 b. 4 5 c. 45 d. var
What will be the output after the following statements? def call(var1, var2) : print(var1 + var2, end =”) call(10, 40) a. 10 b. 50 c. 40 d. 10 + 40
What will be the output after the following statements? def call(var1, var2, var3) : print(var1 var2 var3, end =”) a = b = c = 10 call(a, b, c) a. 1000 b. 10 c. 30 d. 10 10 10
What will be the output after the following statements? def call(var1=20, var2=5, var3=2) : print(var1 var2 var3, end =”) call() a. 100 b. 1000 c. 2052 d. 200
What will be the output after the following statements? def call(var1=20, var2=5, var3=2) : print(var1 var2 var3, end =”) call(5,9,7) a. 597 b. 315 c. 2052 d. 200
What will be the output after the following statements? def call(var1=20, var2=5, var3=2) : print(var1 var2 var3, end =”) call(5,7) a. 57 b. 315 c. 70 d. 200
What will be the output after the following statements? def call(var1=20, var2=5, var3=2) : print((var1 * var2) – var3, end =”) call(var2=5, var3=3, var1=4) a. 17 b. 98 c. 70 d. 11
What will be the output after the following statements? def call(var1=20, var2=5, var3=2) : print((var1 * var2) – var3, end =”) call(7,4) a. 17 b. 98 c. 26 d. 11
What will be the output after the following statements? def call(x, y) : return x * y print(call(5, 3)) a. 18 b. 5, 3 c. 15 d. 8
What will be the output after the following statements? def call(y, x) : return x / y z = call(4, 9) print(z) a. 0.444445 b. 2 c. 0 d. 2.25
What will be the output after the following statements? def call(x,y) : if y == 0: return return y – x print(call(8,2)) a. 6 b. -6 c. 2 d. 6.0
What will be the output after the following statements? def call(x,y) : if x == 0: return return y + x print(call(0,5)) a. 5 b. 5.0 c. 0 d. None
What will be the output after the following statements? y = lambda x: x*4 print(y(6)) a. 24 b. 24.0 c. 6: 24 d. 36
What will be the output after the following statements? x = 27 if x < 25: print(x) else: pass a. None b. 25 c. 27 d. No output
Which of the following is not a core data structure in Python? a. List b. Module c. Dictionary d. Tuple
What will be the output after the following statements? def gen(): x = 0 while True: yield x x += 1 y = gen() print(next(y), end=”) print(next(y), end=”) print(next(y), end=”) a. 012 b. 123 c. 111 d. 000
What will be the output after the following statements? def gen(): x = 2 while True: yield x x += 1 y = gen() for i in y: if i >= 5: break else: print(i, end=”) a. 0123 b. 123 c. 12345 d. 234
What do you type to enter the interactive help mode of Python? a. HELP b. save c. help() d. help
What does the following statement do? import random a. Imports the random module b. Imports a random module from a list of modules c. Imports the random function d. imports the directory named random
What does the following statement do? import keyword, sys a. Imports all the python keywords b. Imports the keyword and sys modules c. Imports the keyword and sys functions d. imports the directories named keyword and sys
What will be the output after the following statements? import random as rd print(rd.randint(4,7)) a. A random float value between 4 and 7, including 4 and 7 b. A random float value between 4 and 7, excluding 4 and 7 c. A random integer value between 4 and 7, excluding 4 and 7 d. A random integer value between 4 and 7, including 4 and 7
What will be the output after the following statements? import random as rd print(rd.random()) a. A random float value between 0 and 1 b. A random integer value between 0 and 1 c. A random float value between 0 and 10 d. A random integer value between 0 and 10
What will be the output after the following statements? from random import * x = [0, 2, 4, 6, 8, 10] print(sample(x, 3)) a. A dictionary containing 3 random keys from list x b. Three random integer values between 0 and 10 c. A list containing 3 random elements from list x d. A tuple containing 2 random elements from list x
Which of the following can be a possible output after the following statements? from random import * print(sample(range(0,10), 3)) a. [4, 11, 30] b. [3, 15, 10] c. [1, 5, 7, 4] d. [1, 5, 0]
What does the following statements do? import sys print(sys.version) a. Displays the Python version b. Displays the operating system version c. Displays the date d. Displays the year
What does the following statements do? import sys print(sys.executable) a. Displays the Python version b. Displays the operating system version c. Displays the location of the Python interpreter d. Displays the date and time
What does the following statements do? import keyword print(keyword.kwlist) a. Displays the list of Python modules b. Displays a list of all the Python keywords c. Displays a random keyword from the Python keywords d. Displays the date and time
What will be the output after the following statements? import math print(math.floor(67.3)) a. 67 b. 68 c. 67.0 d. 68.0
What will be the output after the following statements? import math print(math.ceil(21.4)) a. 21 b. 22 c. 21.0 d. 22.0
What will be the output after the following statements? import math print(math.sqrt(4)) a. 2.1 b. 2 c. 2.0 d. 4.0
What will be the output after the following statements? import math print(math.pow(3,2)) a. 6 b. 9 c. 6.0 d. 9.0
What does the following statements do? import datetime print(datetime.datetime.today()) a. Displays current date and time b. Displays a list of all the hours remaining till midnight c. Displays a random time from today’s date d. Displays today’s weekday name
What does the following statements do? from datetime import * print(getattr(datetime.today(),’hour’)) a. Displays current date and time b. Displays a list of all the hours remaining till midnight c. Displays current hour of the day d. Displays the number of hours in a day
What does the following statements do? from datetime import * print(getattr(datetime.today(),’year’)) a. Displays current date and year b. Displays current year c. Displays the number of months in a year d. Displays the number of days in a year
What does the following statements do? from datetime import * print(datetime.today().strftime(‘%A’)) a. Displays the full month name b. Displays the abbreviated month name c. Displays the abbreviated day name d. Displays the full weekday name
What does the following statements do? from datetime import * print(datetime.today().strftime(‘%B’)) a. Displays the full weekday name b. Displays the full month name c. Displays the abbreviated day name d. Displays the abbreviated month name
What does the following statements do? from datetime import * print(datetime.today().strftime(‘%d’)) a. Displays the hour number of 12-hour clock b. Displays the date and time appropriate for locale c. Displays the day of the month number (from 01 to 31) d. Displays the microsecond number (from 0 to 999999)
What does the following statements do? from datetime import * print(datetime.today().strftime(‘%c’)) a. Displays the date and time appropriate for locale b. Displays the microsecond number (from 0 to 999999) c. Displays the hour number of 12-hour clock d. Displays the hour number of 24-hour clock
What does the following statements do? from datetime import * print(datetime.today().strftime(‘%f’)) a. Displays the date and time appropriate for locale b. Displays the microsecond number (from 0 to 999999) c. Displays the hour number of 24-hour clock d. Displays the hour number of 12-hour clock
What does the following statements do? from datetime import * print(datetime.today().strftime(‘%I’)) a. Displays the hour number of 12-hour clock b. Displays the minute number from 00 to 59 c. Displays the hour number of 24-hour clock d. Displays the day number of the year from 000 to 366
What does the following statements do? from datetime import * print(datetime.today().strftime(‘%H’)) a. Displays the minute number from 00 to 59 b. Displays the hour number of 12-hour clock c. Displays the hour number of 24-hour clock d. Displays the day number of the year from 000 to 366
What does the following statements do? from datetime import * print(datetime.today().strftime(‘%j’)) a. Displays the month number from 01 to 12 b. Displays the minute number from 00 to 59 c. Displays the day number of the year from 000 to 366 d. Displays the second number from 00 to 59
What does the following statements do? from datetime import * print(datetime.today().strftime(‘%M’)) a. Displays the month number from 01 to 12 b. Displays the second number from 00 to 59 c. Displays the AM or PM equivalent for locale d. Displays the minute number from 00 to 59
What does the following statements do? from datetime import * print(datetime.today().strftime(‘%m’)) a. Displays the minute number from 00 to 59 b. Displays the month number from 01 to 12 c. Displays the second number from 00 to 59 d. Displays the AM or PM equivalent for locale
What does the following statements do? from datetime import * print(datetime.today().strftime(‘%p’)) a. Displays the AM or PM equivalent for locale b. Displays the minute number from 00 to 59 c. Displays the month number from 01 to 12 d. Displays the second number from 00 to 59
What does the following statements do? from datetime import * print(datetime.today().strftime(‘%S’)) a. Displays the AM or PM equivalent for locale b. Displays the second number from 00 to 59 c. Displays the week number of the year from 00 to 53 d. Displays the month number from 01 to 12
What does the following statements do? from datetime import * print(datetime.today().strftime(‘%W’)) a. Displays the weekday number from 0(Sunday) to 6(Saturday) b. Displays the AM or PM equivalent for locale c. Displays the date appropriate for locale d. Displays the week number of the year from 00 to 53
What does the following statements do? from datetime import * print(datetime.today().strftime(‘%w’)) a. Displays the week number of the year from 00 to 53 b. Displays the date appropriate for locale c. Displays the weekday number from 0(Sunday) to 6(Saturday) d. Displays the time appropriate for locale