M3-R5 O Level Question Paper with Solution

M3-R5 O Level Question Paper with Solution

M3-R5: Programming and Problem Solving Through Python
January 2021

Q.1. Each question below gives a multiple choice of answers.

1.1 निम्नलिखित पाइथन कोड का आउटपुट क्या होगा?
What will be the output of the following Python code ?
import functools
L=[1,2,3,4,5]
m=functools.reduce(lambda x, y:x if x>y else y,L)
print(m)
(A) Error
(B) Address of m
(C) 1
(D) 5 ✔️

1.2 निम्नलिखित में से कौन सा एक अवैध वेरिएबल है?
Which of the following is an invalid variable?
(A) my_string_1
(B) foo
(C) –
(D) 1st_string ✔️

1.3 निम्नलिखित पाइथन प्रोग्राम का आउटपुट ज्ञात करें:
Find the output of following Python Programs.
class Acc:
def_init_(self, id):
self.id=id
id=555
acc=Acc(111)
print acc.id
(A) 111
(B) 555
(C) 666
(D) error in code ✔️

1.4 निम्नलिखित पाइथन प्रोग्राम का आउटपुट ज्ञात करें:
Find the output of following Python Programs.
def gfg(x,L=[]):
for i in range(x):
L.append(i*i)
print(L)
gfg(2)
(A) [3,2,1,0,1,4]
(B) [0,1] ✔️
(C) [0,1,0,1,4]
(D) error in code

1.5 निम्नलिखित पाइथन प्रोग्राम का आउटपुट ज्ञात करें:
Find the output of following Python Programs.
x=[ ‘ab ‘ , ‘cd ‘]
for i in x:
i.upper()
print(x)
(A) ab
(B) cd
(C) [‘ab’, ‘cd’] ✔️
(D) [‘cd’, ‘ab’]

1.6 निम्नलिखित पाइथन कोड का आउटपुट क्या होगा?
What will be the output of the following Python code ?
>>>t1=(1,2,4,3)
>>>t2=(1,2,3,4)
>>>t1<t2
(A) True
(B) False ✔️
(C) Error
(D) (1,2,4,3)

1.7 निम्नलिखित प्रोग्राम का आउटपुट क्या है?
What is the output of following Programs.
a=2
b=’3.77′
c=-8
str1='{0:4f} {0:3d} {2} {1}’.format(a,b,c)
prit(str1)
(A) 2.0000 2 -8 3.77 ✔️
(B) 2 3.77 -8 3.77
(C) 2.000 3 -8 3.77
(D) 2.000 2 8 3.77

1.8 मान लें कि t = (1, 2, 4, 3), निम्नलिखित में से कौन गलत है?
Suppose t = (1, 2, 4, 3), which of the following is incorrect ?
(A) print(t [3])
(B) t[3]=45
(C) print max(t)) ✔️
(D) print (len(t))

1.9 रिकर्शन के बारे में निम्नलिखित कथनों में से कौन सा सा गलत है?
Which of the following statements is false about recursion ?
(A) Every recursive function must have a base case
(B) Infinite recursion can occur if the base case isn’t properly mentioned ✔️
(C) A recursive function makes the code easier to understand.
(D) Every recursive function must have a return value

1.10 निम्नलिखित पाइथन प्रोग्राम का आउटपुट ज्ञात करें:
Find the output of following Python Programs.
a = “Meetmeafterparty”
b=13
print a+b
(A) 29
(B) 14
(C) error in code ✔️
(D) 15

Q.2. Each statement below is either TRUE or FALSE.

No.QuestionT/F
2.1पाइथन एक उच्च स्तरीय, समझी जाने वाली, इंटरैक्टिव और वस्तु-आधारित स्क्रिप्टिंग लैंग्वेज है। यह अत्यंत अपठनीय होने के लिए तैयार की गई है। Python is a high-level, interpreted, interactive and object-oriented scripting language. It is designed to be highly unreadable.F
2.2पाइथन कई अन्य लैंग्वेजों से ली गई है जिनमें शामिल हैं ए.बी.सी., मोडूला-3, C, C++, अल्गोल-68, स्माल टॉक और यूनिक्स शेल और अन्य स्क्रिप्टिंग लैंग्वेज शामिल हैं। Python is derived from many other languages, including ABC, Modula-3, C, C++, Algol-68, Smalltalk, and Unix shell and other scripting languages.T
2.3पाइथन में किसी विशेष फंक्शन के लिए एक से अधिक व्यवहार असाइनमेंट और किए गए ऑपरेशन ऑब्जेक्ट टाइप या आर्गुमेंट्स के अनुसार भिन्न होते हैं, जिन्हें ऑपरेटर ओवरलोडिंग के रूप में जाना जाता है। In Python assignment of more than one behavior to a particular function and the operation performed varies by the types of objects or arguments involved are known as operator overloading.F
2.4टपल में मानों तक पहुंचने के लिए, उस इंडेक्स पर उपलब्ध मूल्य प्राप्त करने के लिए इंडेक्स या सूचकांकों के साथ स्लाइसिंग के लिए चौकोर कोष्ठक का उपयोग करें। To access values in tuple, use the square brackets for slicing along with the index or indices to obtain value available at that index.T
2.5 डेटाबेस इंटरफ़ेसों के लिए पाइथन मानक पाइथन SB-API है। अधिकाँश पाइथन डेटाबेस इंटरफ़ेस इस मानक का पालन करते हैं। The Python standard for database interfaces is the Python SB-API. Most Python database interfaces adhere to this standard.T
2.6यदि डेटा स्रोत के साथ संपर्क स्थापित हो जाता है तो   कनेक्शन वस्तु लौटा दी जाती है और आगे उपयोग के लिए डीबी में सेव की जाती है, अन्यथा डीबी को None में सेट किया जाता है। If a connection is established with the data source, then a Connection Object is returned and saved into db for further use, otherwise db is set to none.T
2.7 tell() मेथड आपको फाइल के अन्दर वर्तमान स्थिति बताता है। The tell() method tells you the current position within the file.T
2.8पृथक टपल एलिमेंट्स को हटाना संभव है। Removing individual tuple elements is possible.F
2.9पहली विध _init_() एक विशेष विधि है, जिसे क्लास  कंस्ट्रक्टर या इनिशियलाइज़ेशन विधि कहा जाता है जिसे पाइथन कॉल करता है जब आप इस क्लास का  एक नया उदाहरण बनाते हैं। The first method_init_() is a special method, which is called class constructor or initialization method that Python calls when you create a new instance of this class.T
2.10जब एक पाइथन स्क्रिप्ट एक अपवाद को उठाती है, तो उसे या तो अपवाद को तुरंत संभालना चाहिए अन्यथा वह समाप्त हो जाती है और मुक्त हो जाती है। When a Python script raises an exception, it must either handle the exception immediately otherwise it terminates and quits.T

Q.3. Match words and phrases in column X with the closest related meaning of word(s)/phrase(s) in column Y.

XY
3.1एरर किसी भी श्रेणी में नहीं आता है। Error does not fall into any category .    (F)A.Time.altzone
3.2आर्गुमेंट्स के लिए इनवैलिड वैल्यू विनिर्दिष्ट की गई हैं। The argument have invalid values specified. (D)B.Tuples(seq)
3.3एक फाइल को बाइनरी फॉर्मेट में पढ़ने और लिखने दोनों के  लिए खोलता है। Opens a file for both reading and writing in binary format.   (E)C.tell()
3.4फंक्शन ब्लॉक कीवर्ड के साथ आरम्भ होते हैं। Function blocks begin with the keyboard.   (H)D.Value Error
3.5नेगेटिव की दायें से गिनती होती है। Negative count from the right.  (G)E.rb+
3.6विधि वर्तमान कार्य डायरेक्टरी को प्रदर्शित करती है। Method  displays the current working directory.    (J)F.Runtime Error
3.7स्थानीय डीएसटी टाइम जोन का ऑफसेट। The offset of the local DST time zone.   (A)G.L[-2]
3.8एक लिस्ट को टपल में परिवर्तित करता है। Converts a list into tuple.   (B)H.def
3.9फाइल के अन्दर वर्तमान स्थिति दर्शाता है। Shows  current position within the file.   (C)I.del
3.10एक सम्पूर्ण टपल को स्पष्ट रूप से हटाता है। Explicitly remove a entire tuple.    (I)J.getcwd()
K.Syntax Error
L.Rb-
M.L[-1]

Q.4. Each statement below has a blank space to fit one of the word(s) or phrase(s) in the list below.

ATime.time()B24Cparentheses
DreferenceEmoreFlocal variables
GTRUEHGuido van RossumIfunction
JobjectsKlessLFalse
MTim Berner

4.1 निम्नलिखित पाइथन प्रोग्राम का आउटपुट है…B…..
The output of following Python program is…B….
r=lambda q: q*2
s=lambda q: q*3
x=2
x=r(x)
x=s(x)
x=r(x)
print x

4.2 निम्नलिखित पाइथन कोड पर विचार करें :
Let consider the following Python code
a=True
b=False
c=False
if a or b and c:
print “TRUE”
else:
print “FALSE”
the output of this code is …L….

4.3 नॉन-रिकर्सिव फंक्शन की तुलना में रिकर्सिव फंक्शन सामान्यतः…F….मेमोरी स्थान लेते हैं।
Resursive functions usually take …F….memory space than non-recursive functions.

4.4 पाइथन प्रोग्रामिंग लैंग्वेज…H….द्वारा सृजित की गई थी।
Python Programming language was created by …H…..

4.5 पाइथन वस्तु-उन्मुखी स्टाइल या प्रोग्रामिंग की तकनीक का समर्थन करता है जिसमें कोड…J….के अन्दर शामिल रहता है।
Python supports Object-Oriented style or technique of programming that encapsulates code within …J

4.6 …A….करंट टाइम इंस्टेंट, काल के बाद से सेकंड की एक फ़्लोटिंग-पॉइंट संख्या लौटाता है।
A… a return the current time instant, a floating-point number of seconds since the epoch.

4.7 पाइथन लैंग्वेज में सभी मानदंड (आर्गुमेंट्स)…D…..द्वारा पारित किये जाते हैं।
All parameters (arguments) in the Python language are passed by …D….

4.8 …F…को केवल उस फंक्शन के अंदर एक्सेस किया जा सकता है जिसमें उन्हें घोषित किया गया है, जबकि वैश्विक वेरियबल को सभी फंक्शन द्वारा प्रोग्राम बॉडी में शुरू से अंत तक एक्सेस किया जा सकता है।
The …F…. can be accessed only inside the function in which they are declared, whereas global variable can be accessed throughout the program body by all functions.

4.9 टपल्स और सूचियों के बीच यह अंतर है कि टपल्स सूचियों के विपरीत बदले नहीं जा सकते हैं और टपल्स…C… का उपयोग करते हैं, जबकि सूचियाँ वर्ग कोष्ठक का उपयोग करती हैं।
The differences between tuples and lists are, the tuples cannot be changed unlike list and tuples use…C… whereas lists use square brackets.

4.10 पाइथन संख्याओं को मूल्यांकन के लिए मिश्रित प्रकारों को एक सामान्य प्रकार से युक्त अभिव्यक्ति में आंतरिक रूप से परिवर्तित करता है। लेकिन कभी-कभी, …I….पैरामीटर की आवश्यकताओं को पूरा करने के लिए एक संख्या को एक प्रकर से दूसरे प्रकार में स्पष्ट रूप से जमा करते हैं।
Python converts numbers internally in an expression containing mixed types to a common type for evaluation. But sometimes, coerce a number explicitly from one type to another to satisfy the requirements of …I.. parameter.

Part Two
(Answer any four Questions)

Q.5.
(A) NumPy की परिभाषा दें? NumPy ऐरे कैसे बनाते हैं?
Define NumPy? How to create NumPy Array ?

(B) फ्लोचार्ट और फ्लोचार्ट में उपयोग किए जाने वाले प्रतीकों की व्याख्या करें। अल्गोरिथम, छद्म कोड लिखें और हनोई के टावर्स के लिए फ्लोचार्ट तैयार करें।
Explain Flowchart and symbols used in flowchart. Write the Algorithm, pseudo code and draw the flowchart for Towers of Hanoi.

Q.6.
(A) आप एक पैकेज को कैसे सृजित और इम्पोर्ट करेंगे? प्रोग्राम के एक उदाहरण के साथ इसकी व्याख्या करें।
How will you create a Package and import it? Explain it with an example program.

(B) निम्नलिखित की व्याख्या करें: Explain the following:
(i) लिस्ट स्लाइसिंग List Slicing
(ii) लिस्ट एक्सेसिंग विधिय List Accessing Methods

Q.7.
(A) रिकर्शन का उपयोग करके किसी दी गई संख्या के फ़ैक्टोरियल की गणना करने के लिए एक पाइथन प्रोग्राम लिखें।
Write a Python program to compute the factorial of a given number using recursion.

(B) परिवर्तनीय और अपरिवर्तनीय डेटा प्रकार की परिभाषा दें। पाइथन प्रोग्राम के साथ लीनियर और बाइनरी सर्च की अवधारणा की व्याख्या करें।
Define mutable and immutable data type. Explain the concept of Linear and Binary search with Python program.

(C) टपल के एक्सेसिंग तत्वों के निष्पादन के लिए पाइथन में कोड स्निपेट्स लिखें।
Write code snippets in Python to perform Accessing Elements of a Tuple.

Q.8.
(A) एक पाइथन प्रोग्राम को निष्पादित करने के लिए इंटरप्रेटर द्वारा अपेक्षित बेसिक स्टेप्स लिखें।
Write the basic steps required by the interpreter to execute a python program.

(B) निम्नलिखित प्रोग्राम के आउटपुट को प्रिडिक्ट और व्याख्या करें।
Predict and explain the output of following program
r = lambda q: q*2
s = lambda q: q* 3
x = 2
x = r(x)
x = s(x)
x = r(x)
print x

(C) पाइथन में मेमोरी का प्रबंधन कैसे किया जाता है? उस उपकरण का नाम दें जो बग्स का पता लगाने में मदद करता है या स्थैतिक विश्लेषण करता है।
How memory is managed in Python? Give the tools name that help to find bugs or perform static analysis?

Q.9.
(A) उपयुक्त आरेख की मदद से एल.ई.जी.बी. नियमों और उनके महत्व का वर्णन करें।
Illustrate the LEGB rules and its significance with help of suitable diagram.

(B) पाइथन स्लाइस की व्याख्या करें। स्लाइस का सिन्टैक्स लिखें और इसके बारे में चर्चा करें।
Explain about Python slice. Write the syntax of slice and discuss about it.



My Youtube Channel