page-banner
Chapter-6 (Part-2) Python Function
Q1.
सिस्टम मेमोरी के किस भाग में फ़ंक्शन कॉल के पैरामीटर और लोकल वेरिएबल्स को संग्रहीत करता है?

Which part of the memory does the system store the parameter and local variables of a function call?
A. heap
B. stack
C. Uninitialized data segment
D. None of these
View Answer
Q2.
आउटपुट क्या होगा

What is the output?
def calc(x):
    r = 2 * x ** 2
    return r
print(calc(5))
A. Error
B. 50
C. 100
D. 20
View Answer
Q3.
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?

What will be the output of the following Python code?
def printMax(a, b):
    if a > b:
        print(a, 'is maximum')
    elif a == b:
        print(a, 'is equal to', b)
    else:
        print(b, 'is maximum')

printMax(3, 4)
A. 3
B. 4
C. 4 is maximum
D. None of these
View Answer
Q4.
निम्नलिखित कोड का आउटपुट क्या होगा?

What is the output of the following code?
x = 50
def func(x):
    x = 2
    func(x)
print('x is now', x)
A. x is now 50
B. x is now 2
C. x is now 100
D. Error
View Answer
Q5.
निम्नलिखित कोड का आउटपुट क्या होगा?

What is the output of the following code?
def disp(*arg):
    for i in arg:
        print(i)
disp(name="Rajat", age="20")
A. TypeError
B. Rajat 20
C. Name age
D. None of these
View Answer
Q6.
निम्नलिखित फ़ंक्शन का रिटर्न प्रकार क्या है?

What is the return type of following function?
def func1():
    return 'mnp', 22
A. List
B. dictionary
C. string
D. tuple
View Answer
Q7.
निम्नलिखित कोड का परिणाम क्या है?

What is the output of the following code?
def fun(a, b=6):
    a = a + b
    print(a)
fun(5, 4)
A. 11
B. 9
C. 5
D. 4
View Answer
Q8.
निम्नलिखित पाइथन कोड का परिणाम क्या है?

What will be the output of the following Python code?
from math import pow
print(math.pow(2,3))
A. Nothing is printed
B. 8
C. Error, method pow doesn’t exist in math module
D. Error, the statement should be: print(pow(2, 3))
View Answer
Q9.
एक एल्गोरिदम जो स्वयं को प्रत्यक्ष या अप्रत्यक्ष रूप से कॉल करता है, उसे कहा जाता है।

An algorithm that calls itself directly or indirectly is called as.………
A. Sub Function
B. Recursion
C. Reverse Polish Notation
D. Traversal Algorithm
View Answer
Q10.
randint() फ़ंक्शन का उपयोग करने के लिए कौन सा मॉड्यूल इम्पोर्ट किया जाना है?

Which module is to be imported for using randint() function?
A. random
B. randrange
C. randomrange
D. rand
View Answer
Q11.
प्रोग्रामर की आवश्यकता के अनुसार किसी कार्य को प्राप्त करने के लिए परिभाषित फ़ंक्शन को ………………… कहा जाता है।

Function defined to achieve some task as per the programmer’s requirement is called a …………………….
A. user defined function
B. library function
C. built in functions
D. All of the above
View Answer
Q12.
निम्नलिखित का आउटपुट क्या होगा?

What will be the output of the following?
def iq(a, b):
    if a == 0:
        return b
    else:
        return iq(a - 1, a + b)

print(iq(3, 6))
A. 9
B. 10
C. 11
D. 12
View Answer
Q13.
निम्नलिखित का आउटपुट क्या होगा?

What will be the output of the following?
example = "helle"
example.rfind("e")
A. 1
B. 2
C. 4
D. 5
View Answer
Q14.
निम्नलिखित पाइथन कोड का आउटपुट क्या होगा?

What will be the output of the following Python code?
from math import *
floor(11.7)
A. 12
B. 11
C. 11.0
D. None of these
View Answer
Q15.
पायथन …………… नामक निर्माण का उपयोग करके रनटाइम पर अज्ञात कार्यों के निर्माण का समर्थन करता है।

Python supports the creation of anonymous functions at runtime, using a construct called ……………
A. pi
B. anonymous
C. lambda
D. None of these
View Answer
Q16.
निम्नलिखित कोड का परिणाम क्या है?

What is the output of the following code?
print(sum(1, 2, 3))
A. 1
B. 6
C. 3
D. Error in code
View Answer
Q17.
एक स्ट्रिंग x = “hello” दिया गया है x.count('l') का आउटपुट क्या है

Given a string x = “hello” What is the output of x.count(‘l’)
A. 1
B. 2
D. None of these
View Answer
Q18.
func1() की सही फ़ंक्शन घोषणा चुनें ताकि हम निम्नलिखित दो फ़ंक्शन कॉल को सफलतापूर्वक निष्पादित कर सकें।

Choose the correct function declaration of func1() so that we can execute the following two function calls successfully. fun1(25, 75, 55) fun1(10, 20)
A. def fun1(**kwargs)
B. def fun1(args*)
C. No, it is not possible in Python
D. def fun1(*data)
View Answer
Q19.
निम्नलिखित पायथन कोड का आउटपुट क्या है?

What is the output of the following Python code?
from math import *
a = 2.19
b = 3.999999
c = -3.30
print(int(a), floor(b), ceil(c), fabs(c))
A. 2 3 -3 3.3
B. 3 4 -3 3
C. 2 3 -3 3
D. 2 3 -3 -3.3
View Answer
Q20.
किसी मॉड्यूल को दूसरे मॉड्यूल में उपयोग करने के लिए, आपको इसे ………… स्टेटमेंट का उपयोग करके इम्पोर्ट करना होगा।

To use a module in another module, you must import it using an …………. Statement
A. import
B. include
C. both a and b
D. None of these
View Answer
Q21.
निम्नलिखित में से कौन सा फ़ंक्शन पायथन में एक बिल्ट-इन फ़ंक्शन है

Which of the following functions is a built-in function in Python
A. factorial()
B. print()
C. seed()
D. sqrt()
View Answer
Q22.
निम्नलिखित कोड स्निपेट का आउटपुट क्या है?

What is the output of the following code snippet?
print([i.lower() for i in "HELLO"])
A. hello
B. [‘h’, ‘e’, ‘l’, ‘l’, ‘o’]
C. hel
D. HELLO
View Answer
Q23.
निम्नलिखित पाइथन कोड का आउटपुट क्या है?

What is the output of the following Python code?
Y = [2,5J, 6]
Y.sort()
A. [2, 6, 5J]
B. [5J, 2, 6]
C. [6, 5J, 2]
D. Error
View Answer
Q24.
निम्नलिखित कोड का आउटपुट क्या है?

What is the output of the following code?
def s(n1):
    print(n1)
    n1 = n1 + 2
n2 = 4
s(n2)
print(n2)
A. 6 4
B. 4 6
C. 4 4
D. 6 6
View Answer
Q25.
निम्नलिखित पाइथन कोड का आउटपुट क्या है?

What is the output of the following Python code?
def display(b, n):
    while n>0:
        print(b, end='')
        n = n-1
display('z', 3)
A. zzz
B. zz
C. Infinite Loop
D. An exception is thrown
View Answer
Q26.
फ़ंक्शन द्वारा .......... इंटरवल का मान जनरेट किया जाएगा

What is the interval of the value generated by the function
import random
random.random()
A. (0,1)
B. (0,1]
C. [0,1]
D. [0,1)
View Answer
Q27.
निम्नलिखित पायथन कोड का आउटपुट क्या है?

What is the output of the following Python code?
def power(x, y=2):
    r = 1
    for I in range(y):
        r = r * x
    return r
print(power(3))
print(power(3, 3))
A. 212 32
B. 9 27
C. 567 98
D. None of these
View Answer
Q28.
निम्नलिखित में से कौन से पायथन में वैध स्ट्रिंग मैनिपुलेशन फ़ंक्शन हैं?

Which of the following are valid string manipulation functions in Python?
A. count()
B. upper()
C. strip()
D. All of these
View Answer
Q29.
निम्नलिखित में से कौन सा त्रुटि के बिना चलेगा?

Which of the following will run without errors?
A. round(45.8)
B. round(6352.898,2,5)
C. round()
D. round(7463.123,2,1)
View Answer
Q30.
निम्नलिखित स्टेटमेंट के बाद आउटपुट क्या होगा ?

What will be the output after the following statements?
m = 18
def nop():
    print(m)
nop()
A. m
B. nop
C. 18
D. Mnop
View Answer
Q31.
निम्नलिखित स्टेटमेंट के बाद आउटपुट क्या होगा ?

What will be the output after the following statements?
def abc(m, n) :
    print(m - n)
abc(14, 5)
A. (14, 5)
B. 145
C. m - n
D. 9
View Answer
Q32.
निम्नलिखित स्टेटमेंट के बाद आउटपुट क्या होगा ?

What will be the output after the following statements?
def abc(m=15, n=10, o=5) :
    print(m * n + o)
abc()
A. 150
B. 155
D. 225
View Answer
Q33.
निम्नलिखित स्टेटमेंट के बाद आउटपुट क्या होगा ?

What will be the output after the following statements?
def abc(m, n) :
    return m * n
print(abc(7, 3))
A. 21
B. 7, 3
C. (7, 3)
D. m * n
View Answer
Q34.
निम्नलिखित स्टेटमेंट के बाद आउटपुट क्या होगा ?

What will be the output after the following statements?
def p(m, n) :
    return m / n
o = p(50, 5)
print(o)
A. 5
B. 50 / 5
C. 10.0
D. 10
View Answer
Q35.
निम्नलिखित स्टेटमेंट के बाद आउटपुट क्या होगा ?

What will be the output after the following statements?
def abc(m, n) :
    print(m - m - n)
abc(14, 5)
A. (14, 5)
B. -5
C. m - n
D. Error
View Answer
Q36.
निम्नलिखित स्टेटमेंट के बाद आउटपुट क्या होगा ?

What will be the output after the following statements?
def abc(m=15, n=10, o=5) :
    print(m * n % 10 + o / o)
abc()
A. 150
B. 155
C. 1.0
D. 225
View Answer
Q37.
निम्नलिखित स्टेटमेंट के बाद आउटपुट क्या होगा ?

What will be the output after the following statements?
m = lambda n: n**3
print(m(6))
A. 6
B. 18
C. 36
D. 216
View Answer
Q38.
निम्नलिखित स्टेटमेंट के बाद आउटपुट क्या होगा ?

What will be the output of the following statements?
import math
print(math.floor(67.3))
A. 67
B. 68
C. 67.0
D. 68.0
View Answer
Q39.
निम्नलिखित स्टेटमेंट के बाद आउटपुट क्या होगा ?

What will be the output of the following statements?
import math
print(math.ceil(21.4))
A. 21
B. 22
C. 21.0
D. 22.0
View Answer
Q40.
निम्नलिखित स्टेटमेंट के बाद आउटपुट क्या होगा ?

What will be the output of the following statements?
import math
print(math.sqrt(4))
A. 2.1
B. 2
C. 2.0
D. 4.0
View Answer
Q41.
निम्नलिखित स्टेटमेंट के बाद आउटपुट क्या होगा ?

What will be the output of the following statements?
import math
print(math.pow(3,2))
A. 6
B. 9
C. 6.0
D. 9.0
View Answer
Q42.
निम्नलिखित कथन क्या करते हैं?

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
View Answer
Q43.
निम्नलिखित कथन क्या करते हैं?

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
View Answer
Q44.
निम्नलिखित कथन क्या करते हैं?

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
View Answer
Q45.
निम्नलिखित कथन क्या करते हैं?

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
View Answer
Q46.
निम्नलिखित कथन क्या करते हैं?

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
View Answer
Q47.
निम्नलिखित कथन क्या करते हैं?

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)
View Answer
Q48.
निम्नलिखित स्टेटमेंट का आउटपुट क्या होगा ?

What will be the output of the following statements?
x = 'Python'
print(x.capitalize())
A. Python
B. Python.capitalize
C. PYTHON
D. python
View Answer
Q49.
निम्नलिखित स्टेटमेंट का आउटपुट क्या होगा ?

What will be the output of the following statements?
x = 'python job interview'
print(x.title())
A. python job interview
B. Python job interview
C. Python Job Interview
D. Python job Interview
View Answer
Q50.
निम्नलिखित स्टेटमेंट का आउटपुट क्या होगा ?

What will be the output of the following statements?
x = 'python jobs'
print(x.upper())
A. PYTHON JOBS
B. Python jobs
C. Python Jobs
D. python jobs
View Answer