Which keyword is used to begin the definition of a function?
1.Define
2.DEF
3.def
4.Def
Posted Date:-2021-12-12 02:08:36
A module is save with extension ____________
1..py
2..pym
3..mpy
4..mps
Posted Date:-2021-12-12 02:48:12
def cal(n1) : What is n1?
1.Parameter
2.Argument
3.Keyword
4.None of the above
Posted Date:-2021-12-12 02:16:02
Fill in the blank so that the output is 9: a = 9 def sound(): ________ a print(a) sound()
1.local
2.global
3.outer
4.var
Posted Date:-2021-12-12 02:33:49
How many built-in functions are used in the following code: a = int(input("Enter a number: ") b = a * a print(" The square of ",a ,"is", b)
1.1
2.2
3.3
4.4
Posted Date:-2021-12-12 02:35:18
How many built-in functions are used in the following code: a = int(input("Enter a number: ") b = a * a print(" The square of ",a ,"is", b)
1.input( )
2.tuple( )
3.print( )
4.dictionary( )
Posted Date:-2021-12-12 02:36:20
The return statement in function is used to _____
1.return value
2.returns the control to the calling function
3.Both of the above
4.None of the above
Posted Date:-2021-12-12 02:27:55
What is the minimum and maximum value of ‘v’ in the following statement. import random v=random.randrange(20)-3 print(v)
1.0,19 b.
2.0,17
3.3,16
4.-3,17
Posted Date:-2021-12-12 03:32:41
Which of the following function headers is correct?
1. def cal_si(p=100, r, t=2):
2.def cal_si(p=100, r=8, t):
3. def cal_si(p, r=8, t):
4.def cal_si(p, r=8, t=2):
Posted Date:-2021-12-12 03:03:40
Which of the following options can be the output for the following code? import random List=["Delhi","Mumbai","Chennai","Kolkata"] for y in range(4): x = random.randint(1,3) print(List[x],end="#")
1. Delhi#Mumbai#Chennai#Kolkata#
2. Mumbai#Chennai#Kolkata#Mumbai#
3. Mumbai#Chennai#Kolkata#Mumbai#
4.Mumbai# Mumbai #Chennai # Mumbai
Posted Date:-2021-12-12 03:00:12
Write the output of : print(max([1, 2, 3, 4], [4, 5, 6], [7]))
1.[1, 2, 3, 4]
2.[4, 5, 6]
3.[7]
4.7
Posted Date:-2021-12-12 02:42:25
Write the output of the following : print(math.floor(-4.5))
1.-4
2.-5
3.4
4.5
Posted Date:-2021-12-12 02:52:08
Write the output of the following code : import random for i in range(random.randint(2, 2)): print(i)
1.0 1
2.1 2
3.0 1 2
4.Generate different number
Posted Date:-2021-12-12 03:26:57
_______ function of math module calculates the factorial.
1.fact( )
2. facto( )
3.factorial( )
4.factor( )
Posted Date:-2021-12-12 02:54:19
_____________ can be defined as a named group of instructions that accomplish a specific task when it is invoked/called.
1.Function
2.Datatype
3.Token
4.Operator
Posted Date:-2021-12-12 02:06:50
A = random._______________([1,2,3,4,5]). Fill in the blank so that ‘A’ may have any value from the list.
1. shuffle
2.choice
3.uniform
4.None of the above
Posted Date:-2021-12-12 03:34:25
A function can be called __________ times in a program.
1.3
2.7
3.4
4.any number of
Posted Date:-2021-12-12 03:54:01
A function may return multiple values using _
1.List
2.Tuple
3.String
4.Dictionary
Posted Date:-2021-12-12 02:30:44
A Python standard library consists of a number of modules
1.A Python standard library consists of a number of modules
2.Library and modules are alias of each other.
3.A Module consists of a number of Python standard libraries
4.None of the above
Posted Date:-2021-12-12 02:46:32
A variable that is defined inside any function or a block is known as a ___
1.Global variable
2.Local variable
3.Function Variable
4. inside variable
Posted Date:-2021-12-12 02:33:09
Aman wants to import only sqrt( ) function of math module. Help him to write the correct code.
1.import math
2.from math import sqrt
3. import sqrt from math
4.import sqrt
Posted Date:-2021-12-12 02:58:15
Arrange the following from Simple(small) to Complex(big). Instructions, Functions, Library, Module
1.Instructions, Functions, Library, Module
2.Functions, Instructions, Library, Module
3.Module, Functions, Instructions, Library
4.Instructions, Functions, Module, Library
Posted Date:-2021-12-12 02:47:25
Choose the correct answer: def s(n1): print(n1) n2=4 s(n2) Statement A : n1 and n2 have same memory Address Statement B : both n1 and n2 are referring to the same value, so they have same identity
1.Statement A is True and Statement B is False
2. Statement A is False and Statement B is True
3.Both the statements are True
4.Both the statements are False
Posted Date:-2021-12-12 02:19:43
Choose the correct statement
1.We can create function with no argument and no return value.
2.We can create function with no argument and with return value(s)
3.We can create function with argument(s) and no return value.
4.All of the above
Posted Date:-2021-12-12 02:29:02
Choose the correct statement to import Math module:
1. Import math
2.import math
3. import Math
4.Import Math
Posted Date:-2021-12-12 02:49:20
Choose the incorrect statement.
1.print(pow(2, 3))
2. print(pow(2.3, 3.2))
3.print(pow(2, 3, 2))
4.None of the above
Posted Date:-2021-12-12 02:44:16
Consider the following code and choose the incorrect statement.: def s(n1): print(id(n1)) n2=4 s(n2) print(id(n2))
1.Function name is ‘s’
2.Function ‘s’ is taking one parameter.
3.Both print statement will print the same value.
4.Both print statement will print different value.
Posted Date:-2021-12-12 02:22:18
Division of large programs into smaller programs. These smaller programs are called ____
1.Functions
2.Operators
3.logical programs
4.specific programs
Posted Date:-2021-12-12 03:51:27
Function defined to achieve some task as per the programmer’s requirement is called a __
1.user defined function
2. library function
3. built in functions
4.All the above
Posted Date:-2021-12-12 02:10:59
Functions created by user is called _____________ function
1.Inbuilt
2.Library
3. User defined
4.logical
Posted Date:-2021-12-12 03:50:09
Functions which are already defined in python is called a ________
1. user defined function
2.library functions
3. built in functions
4.Both b and c
Posted Date:-2021-12-12 02:12:02
Functions which do not return any value is called ___
1.default function
2. zero function
3. void function
4.null function
Posted Date:-2021-12-12 02:26:22
In a program, a function can be called ____________ times.
1.2
2.3
3.5
4.Multiple times
Posted Date:-2021-12-12 02:07:26
In math.ceil(x), what is x here?
1.An Integer
2.A Floating point number
3. An integer or floating point number
4.None of the above
Posted Date:-2021-12-12 02:51:26
In order to get a list of modules available in Python, we can use the __________ statement:
1.help(“module”)
2. list(“module”)
3.available(“module”)
4.show(“module”)
Posted Date:-2021-12-12 02:57:28
Smallest number return by statement random.randrange(2,7) is _______
1.2
2.7
3.-2
4.0
Posted Date:-2021-12-12 02:55:51
The ____________ statement returns the values from the function to the calling function.
1. send
2.give
3.return
4.take
Posted Date:-2021-12-12 02:27:02
The function can be called in the program by writing function name followed by ___
1.[ ]
2.{ }
3.( )
4.None of the above
Posted Date:-2021-12-12 02:15:19
The part of the program where a variable is accessible is known as the __________ of that variable
1. scope
2.module
3.part
4.None of the above
Posted Date:-2021-12-12 02:31:32
The process of dividing a computer program into separate independent blocks of code with specific functionalities is known as _________.
1.Programming
2.Modular Programming
3.Modular Programming
4.Step Programming
Posted Date:-2021-12-12 02:06:05
Use of functions _______________ the size of programs.
1. increases
2.reduces
3. makes no change in
4.None of the above
Posted Date:-2021-12-12 03:53:11
What is the minimum and maximum value of ‘A’ in the following statement. import random A=random.randint(2,30) print(A)
1.3 and 30
2. 2 and 30
3. 2 and 29
4.2 and 28
Posted Date:-2021-12-12 03:28:39
What is the output of the following code snippet? def ChangeVal(M,N): for i in range(N): if M[i]%5 == 0: M[i]//=5 if M[i]%3 == 0: M[i]//=3 L = [25,8,75,12] ChangeVal(L,4) for i in L: print(i,end="#")
1.5#8#15#4#
2.5#8#5#4#
3. 5#8#15#14#
4.. 5#18#15#4#
Posted Date:-2021-12-12 03:25:27
What will be the output of the following code? def my_func(var1=100, var2=200): var1 += 10 var2 = var2 - 10 return var1+var2 print(my_func(50),my_func())
1.100 200
2.150 300
3.250 75
4.250 300
Posted Date:-2021-12-12 03:23:49
What will be the output of the following code? value = 50 def display(N): global value value = 25 if N%7==0: value = value + N else: value = value - N print(value, end="#") display(20) print(value)
1.50#50
2.50#5
3. 50#30
4.5#50#
Posted Date:-2021-12-12 03:24:34
What will be the output of the following code? x = 3 def myfunc(): global x x+=2 print(x, end=' ') print(x, end=' ') myfunc() print(x, end=' ')
1.3 5 5
2.5 5 5
3. 5 3 5
4.3 3 5
Posted Date:-2021-12-12 03:01:06
What will be the output of the following Python code? def add (num1, num2): sum = num1 + num2 sum = add(20,30) print(sum)
1. 50
2.0
3.Null
4.None
Posted Date:-2021-12-12 03:23:09
What will be the possible outcome of the following code: import random X =[1,2,3,4] m = random.randint(0,3) for i in range(m): print (X[i],"--",end=" ")
1. 1 —
2.1 — 2 —
3.1 — 2 — 3 —
4.All the above
Posted Date:-2021-12-12 03:26:10
Which module is to be imported for using randint( ) function?
1.rand
2.random
3.randomrange
4.randomrange
Posted Date:-2021-12-12 02:39:59
Which of the following are advantages of using function in program?
1.It increases readability of program.
2.It increases reusability.
3.It makes debugging easier.
4.All the above
Posted Date:-2021-12-12 02:10:12
Which of the following components are part of a function header in Python? i. function name ii. return statement iii. parameter list iv. def keyword
1. only i
2. i and iii
3. iii and iv
4. i, iii and iv
Posted Date:-2021-12-12 03:02:24
Which of the following function definition header is wrong?
1.def sum(n1, n2, n = 3):
2. def scan(p1, p2 = 4, p3 = 5):
3.def div(p1=4, p2, p3):
4.def mul(p1, n1, m1):
Posted Date:-2021-12-12 02:25:30
Which of the following function is not defined in statistics module?
1.mean( )
2. mode( )
3.median( )
4.sqrt( )
Posted Date:-2021-12-12 02:56:29
Which of the following function return random real number (float) in the range 0.0 to 1.0?
1.random( )
2.randint( )
3.randrange( )
4.None of the above
Posted Date:-2021-12-12 02:55:00
Which of the following is not a type conversion functions?
1.int( )
2.str( )
3.input( )
4.float( )
Posted Date:-2021-12-12 03:55:01
Which of the following is not built-in module in python?
1.math
2.random
3.statistics
4.arithmetic
Posted Date:-2021-12-12 02:50:31
Which of the following is not the scope of variable?
1.Local
2.Global
3.Outside
4.None of the above
Posted Date:-2021-12-12 02:32:14
Which of the following is not the type of function argument?
1.Required argument
2. Keyword argument
3. initial argument
4.default argument
Posted Date:-2021-12-12 02:37:23
Which of the following is the correct way to call a function?
1.my_func( )
2.def my_func( )
3.return my_func
4.call my_func( )
Posted Date:-2021-12-12 03:22:17
Which of the following method is not included in random module?
1.Shuffle( )
2.randrange( )
3. randomrange( )
4. uniform( )
Posted Date:-2021-12-12 03:33:40
Which of the following number can never be generated by the following code: random.randrange(0, 100)
1.0
2.100
3.99
4.1
Posted Date:-2021-12-12 02:40:44
Which of the following return floating point number?
1.print(pow(2, 3))
2.print(pow(2.3, 3.2))
3.print(pow(2, 3, 2))
4.All the above
Posted Date:-2021-12-12 02:45:16
Which of the following statement is a function call?
1.call sum( )
2.def sum( )
3.sum( )
4.function sum( )
Posted Date:-2021-12-12 02:09:31
Which of the following statement is not true regarding functions?
1.A function definition begins with “define”
2. A function may or may not have parameters.
3.A function may or may not return value.
4. Function header always ends with a colon (:).
Posted Date:-2021-12-12 02:12:53
Which of the following statement is outside the function “sum”? def sum(): a = int(input(“Enter number”))#Statement 1 b = int(input(“Enter number”)) #Statement 2 s = a + b #Statement 3 print(s) #Statement 4
1.Statement 1
2. Statement 2
3.Statement 3
4.Both Statement 3 and Statement 4
Posted Date:-2021-12-12 02:13:53
Which of the following statement will execute in last? def s(n1): #Statement 1 print(n1) #Statement 2 n2=4 #Statement 3 s(n2) #Statement 4
1. Statement 1
2. Statement 2
3. Statement 3
4. Statement 4
Posted Date:-2021-12-12 02:18:16
Which of the following statement will return error? print(int("a")) #Statement1 print(str(123)) #Statement2
1.Statement1
2.Statement2
3.Statement3
4.Statement4
Posted Date:-2021-12-12 03:57:30
Which of the following subject will never printed in following code? import random L=["English", "Hindi", "Math", "Science", "SST", "CS", "IP"] for i in range(random.randint(1, 6)): print(L[i])
1. CS and IP both
2. English
3.IP
4.English and Hindi both
Posted Date:-2021-12-12 03:31:52
Write the output of : print(abs(-45))
1.45.0
2.-45
3.45
4.None of the above
Posted Date:-2021-12-12 02:41:36
Write the output of : print(math.fabs(-6.7))
1.-6
2.6.7
3. -6.7
4.7
Posted Date:-2021-12-12 02:53:17
Write the output of : print(min(tuple(“computer”)))
1.c
2.o
3.u
4.t
Posted Date:-2021-12-12 02:43:04
Write the output of the following code : import random for i in range(random.randint(2,3)): print("A")
1.A A
2.A A A
3.A A OR A A A
4.Error
Posted Date:-2021-12-12 03:27:50
Write the output of the following code : import random A=random.randrange(20) print(A)
1.Any number between 0 to 19 (including both)
2.Any number between 0 to 20 (including both)
3.Any number between 1 to 20 (including both)
4.None of the above
Posted Date:-2021-12-12 03:29:25
Write the output of the following code : import random print(int(random.random( )))
1.Any random number less than 1 and greater than 0
2.Always generate 0
3.Always generate 1
4.Shows Error
Posted Date:-2021-12-12 03:30:16
Write the output of the following code : import random print(int(random.random()*5))
1.Always generate 0
2.Generate any number between 0 to 4 (including both)
3.Generate any number between 0 to 5 (including both)
4.None of the above
Posted Date:-2021-12-12 03:31:04
Write the output of the following: a = 9 def sound(): b = 7 print(a) sound() print(b)
1.7 7
2.9 9
3.7 9
4.Error
Posted Date:-2021-12-12 02:34:34
Write the output of the following: def cal(m,n): if m==n: return m*3 else: return m*2 s = cal(9, 8) print(s)
1.16
2.18
3.27
4.24
Posted Date:-2021-12-12 02:23:04
Write the output of the following: def cal(m,n): if m==n: return m*3 else: return n*2 s = cal("Amit", "Anuj") print(s)
1.AmitAmitAmit
2.AmitAmit
3.AnujAnujAnuj
4. AnujAnuj
Posted Date:-2021-12-12 02:23:49
Write the output of the following: def check(): i = 5 while i > 1: if i //2==0: x = i + 2 i = i-1 else: i = i-2 x = i print (x) check()
1.3 3
2.5 3
3.3 1
4.3 2
Posted Date:-2021-12-12 02:39:06
Write the output of the following: def fn(n1, n2=7): n1=n1+n2 print(n1) fn(3, 9)
1.3
2.9
3.12
4.10
Posted Date:-2021-12-12 02:24:17
Write the output of the following: def fn(n1, n2=7): n1=n1%n2 print(n1) fn(3%2, 9%2)
1.1
2.0
3.2
4.3
Posted Date:-2021-12-12 02:24:43
Write the output of the following: def s(n1): print(n1) n2=4 s(n2)
1.2
2.3
3.4
4.Error
Posted Date:-2021-12-12 02:17:24
Write the output of the following: print("A") def prnt(): print("B") print("C") prnt()
1.A B C
2.B C A
3.A B
4.A C B
Posted Date:-2021-12-12 02:38:16
Write the output of the following: sound() def sound(): print("sound" * 2)
1.sound
2.soundsound
3.NameError : name ‘sound’ is not defined
4.SyntaxError: invalid syntax
Posted Date:-2021-12-12 02:30:04
Write the output of the following. print(int( ))
1. Error
2. Any random number
3.0
4.1
Posted Date:-2021-12-12 03:56:11