Font size
WorksheetsM3 R5 Chapter 6
Total questions: 105
Worksheet time: 53mins
Python में function को define करने के लिए कौन सा keyword उपयोग किया जाता है?
def
func
define
lambda
Function का उपयोग क्यों किया जाता है?
To organize code into reusable blocks
To reduce performance
To increase memory usage
To handle exceptions
Top-down approach किस पर आधारित है?
Breaking problems into smaller, manageable components
Combining multiple small problems into one
Ignoring the details of a problem
Testing all solutions simultaneously
Top-down approach का मुख्य लाभ क्या है?
Simplifies debugging and implementation
Reduces code readability
Removes modularity
Decreases team collaboration
Modular programming का मुख्य उद्देश्य क्या है?
To create independent, reusable code modules
To increase dependency between modules
To execute programs faster
To avoid using functions
Modular programming का एक उदाहरण क्या है?
Dividing code into separate functions or classes
Writing everything in a single file
Using global variables only
Ignoring code reusability
Python में variable को declare करने के लिए कौन सा syntax सही है?
x = 10
int x = 10
var x = 10
declare x = 10
Python में variable को dynamically type क्यों कहा जाता है?
Because they can change type during runtime
Because their names can change
Because they are declared using var
Because they cannot store strings
Docstring लिखने के लिए कौन सा symbol उपयोग होता है?
Triple quotes ("")
Double quotes (")
Hash symbol (#)
Single quotes (')
Function में docstring का उपयोग क्यों किया जाता है?
To provide documentation for the function
To execute the function
To comment out the function
To define global variables
Python में global variable को modify करने के लिए कौन सा keyword उपयोग होता है?
global
nonlocal
static
const
Global variables का मुख्य नुकसान क्या है?
They can be accessed and modified from anywhere, leading to unintended side effects
They are not accessible outside the function
They cannot store strings
They are slow to execute
Positional arguments कैसे पास किए जाते हैं?
In the order they are defined
In reverse order
Randomly
Using keyword-value pairs
Positional arguments के साथ error कब आती है?
When the number of arguments does not match the function definition
When arguments are passed as keywords
When arguments are all integers
When arguments are default values
Python में math library का उपयोग किसके लिए किया जाता है?
To perform mathematical operations
To manipulate strings
To manage files
To create user interfaces
random library का उपयोग क्यों किया जाता है?
To generate random numbers
To sort numbers
To access global variables
To create static variables
Python में string को uppercase में बदलने के लिए कौन सी method उपयोग होती है?
upper()
lower()
capitalize()
title()
String में substring की position find करने के लिए कौन सी method उपयोग होती है?
find()
index()
Both A and B
replace()
Slicing syntax में कौन सा range शामिल होता है?
Start index to (end index - 1)
Start index to end index
Start index to end of the string
Entire string
Python में membership operator कौन सा है?
in
is
not
and
Python में absolute value पाने के लिए कौन सी function उपयोग होती है?
abs()
round()
ceil()
floor()
Python में किसी संख्या को round करने के लिए कौन सी function उपयोग की जाती है?
round()
floor()
abs()
ceil()
Python में current date और time प्राप्त करने के लिए कौन सा module उपयोग होता है?
datetime
time
calendar
dateutils
Python में datetime.now() method का उपयोग किसके लिए किया जाता है?
To get the current date and time
To calculate time intervals
To set alarms
To retrieve past dates
Recursion का मुख्य लाभ क्या है?
Simplifies code for problems like factorial and Fibonacci series
Speeds up program execution
Uses less memory
Avoids stack overflow
Recursion के कारण stack overflow कब होता है?
When the base case is not defined
When the function is called with the wrong parameters
When recursion is not used
When too many global variables are defined
Python में string slicing का syntax क्या है?
string[start:end:step]
string[start:end]
string[start]
Both A and B
Python में string की membership चेक करने के लिए कौन सा operator उपयोग होता है?
in
is
==
!=
Python में pattern matching के लिए कौन सा module उपयोग होता है?
re
regex
match
string
सा module उपयोग होता है?
re
regex
match
string
Python में regex pattern को match करने के लिए कौन सी method उपयोग होती है?
match()
find()
search()
Both A and C
Python में default arguments को define करने का syntax क्या है?
def func(x=5):
def func(x:5):
def func(int x=5):
def func(x=>5):
Default arguments कब उपयोग होते हैं?
When no value is passed for that parameter
When all parameters are integers
When the function has no return value
When the function is recursive
Python में random number generate करने के लिए कौन सी function उपयोग की जाती है?
random.randint()
random.random()
Both A and B
random.shuffle()
Python में math.sqrt() function का उपयोग क्यों किया जाता है?
To calculate the square root of a number
To calculate the square of a number
To generate random numbers
To find the absolute value
Python में function की docstring को retrieve करने के लिए कौन सी attribute उपयोग की जाती है?
__doc__
__str__
__dict__
__help__
Docstring का प्राथमिक उद्देश्य क्या है?
To describe the purpose and functionality of a function
To debug a program
To calculate the return value
To optimize the function
Python में string को split करने के लिए कौन सी method उपयोग होती है?
split()
partition()
join()
replace()
Python में string को replace करने के लिए कौन सी method उपयोग होती है?
replace()
sub()
re.sub()
split()
Recursion में base case का क्या महत्व है?
It terminates the recursive calls to avoid infinite loops.
It increases the number of recursive calls.
It slows down the program.
It uses less memory.
Python में recursion का उपयोग कब उचित होता है?
When solving problems that can be divided into smaller sub-problems.
When dealing with non-repeating tasks.
When the base case cannot be defined.
When you want to avoid stack overflow.
Python में किसी संख्या के square root की गणना करने के लिए कौन सा function उपयोग होता है?
math.sqrt()
math.pow()
round()
abs()
math.pow(x, y) का आउटपुट क्या होता है?
The value of xyx^y
The square root of x
The absolute value of x
The remainder when x is divided by y
Python में string slicing में step parameter क्या दर्शाता है?
The interval between indices to pick characters
The length of the string
The ending ind
में step parameter क्या दर्शाता है?
A. The interval between indices to pick characters
B. The length of the string
C. The ending index
D. The starting index
s = "Python" का s[::2] का आउटपुट क्या होगा?
A. Pto
B. Pytho
C. Pon
D. Pyt
Python में regex pattern को compile करने के लिए कौन सा function उपयोग होता है?
A. re.compile()
B. re.match()
C. re.search()
D. re.findall()
re.findall() method का उपयोग किसके लिए होता है?
A. To find all non-overlapping matches of a pattern in a string
B. To return only the first match
C. To replace patterns in a string
D. To compile regex patterns
Python में current year प्राप्त करने के लिए कौन सी method उपयोग होती है?
A. datetime.now().year
B. datetime.today().year
C. date.today().year
D. datetime.now().today()
time.sleep() function का उपयोग क्यों किया जाता है?
A. To pause the execution of the program for a specified duration
B. To measure the execution time
C. To set an alarm
D. To retrieve the system time
Keyword arguments का उपयोग कब किया जाता है?
A. When arguments are passed with their parameter names
B. When arguments are passed in sequential order
C. When default values are ignored
D. When positional arguments are not used
Python में positional और keyword arguments को mix करने पर error कब आती है?
A. When a positional argument is given after a keyword argument
B. When all arguments are positional
C. When all arguments are keywords
D. When default arguments are used
Python किस प्रकार के functions को support करता है?
A. Built-in and User-defined
B. Static and Global
C. Inline and Recursive
D. Anonymous and Predefined
User-defined functions को define करने के लिए Python में कौन सा keyword उपयोग होता है?
A. def
B. define
C. func
D. lambda
Python में docstring को लिखने के लिए कौन सा symbol उपयोग होता है?
A. Triple quotes ("")
B. Single quotes (')
C. Hash symbol (#)
D. Double quotes (")
Function docstring में क्या जानकारी होती है?
A. Purpose of the function
B. Function's arguments and return values
C. Examples of usage
D. All of the above
Function में कितने levels की depth allow की जाती है?
A. No specific limit (depends on system's stack limit)
B. 100 levels
C. 10 levels
D. 50 levels
Recursive functions को depth limit से बचाने के लिए क्या उपयोग होता है?
A. Base case
B. Global variables
C. Default parameters
D. Overloading
s को depth limit से बचाने के लिए क्या उपयोग होता है?
Base case
Global variables
Default parameters
Overloading
Function का primary use क्या है?
Code reuse and modularity
To make the code slower
To reduce debugging
To increase dependencies
Python में function को call करने के लिए कौन सा syntax सही है?
function_name()
call function_name
execute function_name
function_name.run()
Python में string को lowercase में बदलने के लिए कौन सी method उपयोग होती है?
lower()
upper()
swapcase()
title()
upper() method का output क्या होगा अगर input "hello" हो?
HELLO
hello
Hello
hELLO
swapcase() method का उपयोग किस लिए किया जाता है?
To swap uppercase to lowercase and vice versa
To capitalize the string
To reverse the string
To split the string
islower() method कब True return करता है?
When all characters in the string are lowercase
When all characters in the string are uppercase
When the string is empty
When the string contains numbers
Random numbers generate करने के लिए कौन सा module उपयोग होता है?
random
math
time
sys
random.randint(1, 10) का output क्या हो सकता है?
Any integer between 1 and 10 (inclusive)
Any number between 1 and 10 (exclusive)
Only 1 or 10
Only integers greater than 10
Python में random floating-point numbers generate करने के लिए कौन सी method उपयोग होती है?
random.uniform()
random.randint()
random.sample()
random.shuffle()
Python में math.ceil() का उपयोग क्या करता है?
Returns the smallest integer greater than or equal to the given number
Returns the largest integer less than or equal to the given number
Returns the square root of the number
Rounds the number to the nearest integer
math.sqrt(16) का output क्या होगा?
4.0
8.0
16.0
2.0
ceil() और floor() में क्या अंतर है?
ceil() rounds up, while floor() rounds down.
ceil() rounds down, while floor() rounds up.
Both perform the same function.
ceil() works only with integers.
math.ceil(4.2) का output क्या होगा?
5
4
4.0
5.0
Python में math.sqrt() negative numbers के साथ क्या return करता है?
Error
Zero
Negative square root
Positive square root
Built-in functions में से कौन सा Python का function है?
print()
sum()
len
Built-in functions में से कौन सा Python का function है?
print()
sum()
len()
All of the above
User-defined functions में arguments को कैसे पास किया जाता है?
By specifying them in parentheses during the function call
By using the return statement
By declaring them globally
By writing them after the function definition
Multi-line docstring को लिखने के लिए सही syntax क्या है?
""" This is a multi-line docstring """
''' This is a multi-line docstring '''
Both A and B
None of the above
Docstring का मुख्य उद्देश्य क्या है?
To document code for better understanding
To run the function automatically
To import libraries
To debug the code
Functions में parameters के उपयोग का क्या लाभ है?
They allow data to be passed into the function.
They make functions independent of external variables.
They increase modularity.
All of the above
Recursive function में recursion depth को किससे control किया जा सकता है?
Using a base case
Using global variables
Using a loop
Using a lambda function
"HELLO".lower() का output क्या होगा?
hello
HELLO
Hello
Error
"python".isupper() method का output क्या return करेगा?
False
True
None
Error
"Python".swapcase() का output क्या होगा?
pYTHON
PYTHON
python
PytHON
random.choice() function का उपयोग कब किया जाता है?
To select a random element from a sequence
To shuffle a sequence
To generate a random number within a range
To generate random floating-point numbers
Python में random.shuffle() का उपयोग किसके लिए किया जाता है?
To shuffle elements in a list randomly
To create a sorted list
To remove duplicates from a list
To create a new random list
math.ceil(9.1) का output क्या होगा?
10
9
9.1
Error
Negative numbers पर math.sqrt() का उपयोग करने पर क्या होगा?
ValueError
Returns None
Returns a negative square root
Runs successfully
math.sqrt(25) का सही output क्या है?
5.0
25.0
125
Error
Math functions Python में किस module में उपलब्ध हैं?
math
random
sys
os
Python का default recursion limit कितना होता है?
1000
500
2000
No limit
Python में default recursion limit क्या है?
1000
500
2000
कोई सीमा नहीं
len() का उपयोग किसके लिए किया जाता है?
किसी वस्तु की लंबाई जानने के लिए
सूची को क्रमबद्ध करने के लिए
संख्याओं का योग निकालने के लिए
सूची में सदस्यता की जांच करने के लिए
def func(x, y=10): return x + y में y की value क्या है अगर इसे call किया जाए func(5)?
10
5
0
त्रुटि
Docstring को runtime में कैसे access किया जाता है?
__doc__ attribute का उपयोग करके
print() function का उपयोग करके
help() का उपयोग करके
A और C दोनों
Python में default arguments का उपयोग कब किया जाता है?
जब function call के दौरान कोई value प्रदान नहीं की जाती
अगर कोई value प्रदान नहीं की गई तो त्रुटि फेंकने के लिए
जब सभी arguments अनिवार्य होते हैं
हमेशा एक निश्चित value का उपयोग करने के लिए
निम्नलिखित function call का output क्या होगा: def greet(name="Guest"): return f"Hello, {name}" print(greet())
Hello, Guest
Hello, name
त्रुटि
Hello
Python में default arguments को कहाँ define किया जाता है?
non-default arguments के बाद
non-default arguments के पहले
function definition की शुरुआत में
function में कहीं भी
"123abc".islower() का output क्या होगा?
True
False
None
त्रुटि
"PYTHON".isupper() method का output क्या होगा?
True
False
None
त्रुटि
random.random() function क्या return करता है?
0 और 1 के बीच एक random float
0 और 1 के बीच एक random integer
0 और 10 के बीच एक random float
त्रुटि
निम्नलिखित code का output क्या हो सकता है: import random print(random.randint(1, 5))
1 और 5 (inclusive) के बीच कोई भी integer
1 और 5 (inclusive) के बीच कोई भी float
त्रुटि
हमेशा 5
math.sqrt(49) का output क्या होगा?
7.0
7
49
त्रुटि
Negative input के लिए math.ceil() का result क्या होता है?
यह शून्य की ओर गोल करता है
यह input के बराबर या उससे बड़ा सबसे छोटा integer में गोल करता है
यह input के बराबर या उससे छोटा सबसे बड़ा integer में गोल करता है
त्रुटि
Function parameters को pass करने के लिए कौन सा argument type सबसे पहले use होता है?
Positional arguments
Default arguments
Keyword arguments
Variable-length arguments
Python में help() function किसके लिए उपयोग किया जाता है?
किसी object के docstring और module details को प्रदर्शित करने के लिए
function में त्रुटियों को खोजने के लिए
runtime output को प्रदर्शित करने के लिए
program को debug करने के लिए
