Thursday, March 11, 2021

O Level M3-R5 Python

 

M3-R5 : Programming and problem solving through python language

1. Each question below gives a multiple choice of answers. Choose the most appropriate one and enter in the “OMR” answer sheet supplied with the question paper, following instructions therein.

1.1 Find the output of following python programs.

A = “Meetmeafterparty”

B = 13

Print A+B

निम्नलिखित पाइथन प्रोग्राम का आउटपुट ज्ञात कीजिएः

A = “Meetmeafterparty”

B = 13

Print A+B

a) 29 b) 14

c) Error in code d) 15

1.2 Find the output of the following python programs.

Class Acc:

def_init_(self,id):

self.id=id

id=555

acc=Acc(111)

print acc.id

निम्नलिखित पाइथन प्रोग्राम का आउटपुट ज्ञात करेंः

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.3 Which of the following is an invalid variable ?

निम्नलिखित में कौन एक अवैध वेरिएबल है।

a) my_string_1 b) foo

c) _ d) 1st_string

1.4 Find the output of the 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.5 Find the output of the following python programs.

निम्नलिखित पाइथन प्रोग्राम का आउटपुट ज्ञात करेंः

a = 2

b = ‘3.77’

c = -8

str1 = ‘{0:4f} {0:3d} {2} {1}’ . format (a,b,c) print(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.6 Find the output of the following python programs.

निम्नलिखित पाइथन प्रोग्राम का आउटपुट ज्ञात करेंः

def gfg(x,1=[]):

for I in range (x):

Lappend (i*i)

print(1)

gfg(2)

a) [3,2,1,0,1,4] b) [0,1]

c) [0,1,0,1,4] d) Error in code

1.7 Suppose t = (1,2,4,3), which of the following is incorrect ?

मान ले कि t = (1,2,4,3) निम्नलिखित में से कौन सा गलत है।

a) print (t [3]) b) t [3] = 45

c) print (max(t)) d) print (Len(t))

1.8 Find the output of the following python programs.

निम्नलिखित पाइथन प्रोग्राम का आउटपुट ज्ञात करेंः

>>>t1=(1,2,4,3)

>>>t2=(1,2,3,4)

>>>t1<t2

a) True b) False

c) Error d) (1,2,4,3)

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 recursion function makes the code easier to understand एक रिकर्शिव फंक्शन कोड को समझने में आसान बनाता है।

d) Every recursive function must have a return value प्रत्येक रिकर्शिव फंक्शन की एक रिटर्न वैल्यू अवश्य होनी चाहिए।

1.10 Find the output of the following python programs.

निम्नलिखित पाइथन प्रोग्राम का आउटपुट ज्ञात करेंः

import functools

1 = [1,2,3,4,5]

m = functools.reduce(lambda x, y:x if x>y else y, 1)

print(m)

a) Error b) Address of m

c) 1 d) 5


2. Each statement below is either TRUE or FALSE. Choose the most appropriate one and enter your choice in the “OMR” answer sheet supplied with the question paper, following instructions therein.

2.1 Python is a high-level, interpreted, interactive and object -oriented scripting language. It is designed to be highly unreadable.

पाइथन एक उच्च स्तरीय, समझी जाने वाली, इंटरऐक्टिव और वस्तु-आधारित स्क्रिप्टिंग लैंग्वेज है। यह अत्यंत अपठनीय होने के लिए तैयार की गयी है।

2.2 Python is derived from many other languages, including ABC, Modula-3, c, c++, Algol-68, small talk and unix shell and other scripting languages.

पाइथन कई अन्य लैेग्वेजों से ली गयी है जिनमें शामिल है ए.बी.सी., मोडूला-3,c, c++, अल्गोल-68, स्माल टाक और यूनिक्स शेल और अन्य स्क्रिप्टिंग लैंग्वेज शामिल है।

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.

पाइथन में किसी विशेष फंक्शन के लिए एक से अधिक व्यवहार असाइनमेंट और किए गये ऑपरेशन ऑब्जेक्ट टाइप या आर्गुमेंटस के अनुसार भिन्न होते है, जिन्हें ऑपरेटर ओवरलोडिंग के रुप में जाना जाता है।

2.4 To access values in tuple, use the square brackets for slicing along with the index of indices to obtain value available at that index.

टपल में मानो तक पहुँचने के लिए, उस इंडेक्स पर उपलब्ध मूल्य प्राप्त करने के लिए इंडेक्स या सूचकांकों के साथ स्लाईसिंग के लिए चौकोर कोष्ठक का उपयोग करे।

2.5 The python standard for database interfaces is the python SB-API. Most python database interfaces adhere to this standard.

डेटाबेस इंटरफेसों के लिए पाइथन मानक पाइथन SB-API है। अधिकांश पाइथन डेटाबेस इंटरफेस इस मानक का पालन करते है।

2.6 If a connection is established with the datasource, then a connection object is returned and saved into db for further use, otherwise db is set to none.

यदि डेटा स्त्रोत के साथ संपर्क स्थापित हो जाता है तो कनेक्शन वस्तु लौटा दी जाती है और आगे उपयोग के लिए डीबी में सेव की जाती है, अन्यथा डीबी को none में सेट किया जाता है।

2.7 The tell() method tells you the current position with in the files.

Tell() मेथेड आपको फाइल के अंदर वर्तमान स्थिति बताता है।

2.8 Removing individual tuple elements is possible.

पृथक टपल एलिमेंट्स को हटाना संभव है।

2.9 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.

पहली विधि _init _() एक विशेष विधि है, जिसे क्लाश कंस्ट्रक्टर या इनिशियालाइजेशन विधि कहा जाता है। जिसे पाइथन कॉल करता है जब आप इस क्लास का नया उदाहरण बनाते है।

2.10 When a python script raises an exception, it must either handle the exception immediately otherwise it terminates and quits.

जब एक पाइथन स्क्रिप्ट एक अपवाद को उठाती है, तो उसे या तो अपवाद को तुरंत संभालना चाहिए अन्यथा वह समाप्त हो जाती है और मुक्त हो जाती है।

3 Match words and phrase in column X with the closed related meaning of word(s)/phrase(s) in column Y. Enter your selection in the “OMR” answer sheet supplied with the question paper, following instructions therein.


X


Y

3.1

Error does not fall into any category

एरर किसी भी श्रेणी में नही आता।

A.

Time.altzone

3.2

The argument have invalid values specified

आर्गुमेंट्स के लिए इनवैलिड वैल्यू विनिर्दिष्ट की गयी है।

B.

Tuple (seq)

3.3

Opens a file for both reading and writing in binary format

एक फाइल को बाइनरी फार्मेट में पढ़ने और लिखने दोनों के लिए खोलता है।

C.

tell()

3.4

Function blocks begin with the keyword

फंक्शन ब्लाक कीवर्ड के साथ प्रारम्भ होते है।

D.

Value error

वैल्यू एरर

3.5

Negative count from the right

नेगेटिव की दाए से गिनती होती है।

E.

rb+

3.6

Method display the current working directory

विधि वर्तमान कार्य डायरेेक्टरी को प्रदर्शित करती है।

F.

Runtime error

रनटाइम एरर

3.7

The offset of the local DST time zone

स्थानीय डीएसटी टाइम जोन का ऑफसेट

G.

L[-2]

3.8

Converts a list into tuple

एक लिस्ट को टपल में परिवर्तित करता है।

H.

def

3.9

Shows current position within the file

फाइल के अंदर वर्तमान स्थिति दर्शाता है।

I.

del

3.10

Explicitly remove an entire tuple

एक सम्पूर्ण टपल को स्पष्ट रुप से हटाता है।

J.

Getcwd()



K.

Syntax error

सिंटेक्स एरर



L.

rb-



M.

L[-1]




4. Each statement below has a blank space to fit one of the word(s) or phrase(s) in the list below. Choose the most appropriate option, enter your choice in the “OMR” answer sheet supplied with the question paper, following instructions therein.

A.

Time.time()

B.

24

C.

Parentheses

D.

Reference

E.

More

F.

Local variables

G.

TRUE

H.

Guido Van Rossum

I.

Function

J.

Object

K.

Less

L.

FALSE

M.

Tim Burner








4.1 The output of following Python program is ………………

निम्नलिखित पाइथन प्रोग्राम का आउटपुट है -

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 ……………….

4.3 Recursive function usually take …………. memory space than non-recursive function.

नॉन-रिकर्सिव फंक्शन की तुलना में रिकर्सिव फंक्शन सामान्यतः ……………. मेमोरी स्थान लेते है।

4.4 Python programming language was created by …………..

पाइथन प्रोग्रामिंग लैंग्वेज ………………… द्वारा सृजित की गयी थी।

4.5 Python supports object – oriented style or technique of programming that encapsulates code within …………….

पाइथन वस्तु-उन्मुखी स्टाइल या प्रोग्रामिंग की तकनीक का समर्थन करता है जिसमें कोड ………….. के अंदर शामिल रहता है।

4.6 ………………. returns the current time instant, a floating point number of seconds since the epoch.

…………….. करंट टाइम इंस्टेंट, काल के बाद से सेंकण्ड की एक फ्लोटिंग-पाइंट संख्या लौटाता है।

4.7 All parameters (argument) in the python language are passed by ………….

पाइथन लैंग्वेज में सभी मानदंड (आर्गुमेंट्स) …………. द्वारा पारित किए जाते है।

4.8 The ……………. can be accessed only inside the function in which are declared, where as global variables can be accessed throughout the program body by all functions.

…………… को केवल उस फंक्शन के अंदर एक्सेस किया जा सकता है जिसमें उन्हे घोषित किया गया है, जबकि वैश्विक वैरियेबल को सभी फंक्शन द्वारा प्रोग्राम बाडी से शुरु से अंत तक एक्सेस किया जा सकता है।

4.9 The difference between tuples and lists are, the tuple cannot be changed unlike lists and tuples use ………… whereas lists use square brackets.

टप्लस और सूचियों के बीच यही अंतर है कि टपल्स सूचियों के विपरीत बदले नही जा सकते है और टपल्स ……………… का उपयोग करते है, जबकि सूचियाँ वर्ग कोष्ठक का उपयोग करती है।

4.10 python converts numbers internally in an expression containing mixed types to a common type for evolution. But sometimes, coerce a number explicitly from one type to another to satisfy the requirements of ……………. parameters.

पाइथन संख्याओं को मूल्यांकन के लिए मिश्रित प्रकारों को एक समान्य प्रकार से युक्त अभिव्यक्ति में आंतरिक रुप से परिवर्तित करता है। लेकिन कभी-कभी, ………….. पैरामीटर की आवश्यकताओं को पूरा करने के लिए एक संख्या को एक प्रकार से दूसरे प्रकार में स्पष्ट रुप से जमा करते है।

PART-TWO (Answer any Four Questions)

5 (a) Write the basic steps required by the interpreter to execute the 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 ?

पाइथन में मेमोरी का प्रबंधन कैसे किया जाता है, उस उपकरण का नाम दें जो बग्स का पता लगाने में मदद करता है या स्थैतिक विश्लेषण करता है।

6 (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.

टपल के एक्सेसिंग तत्वों के निष्पादन के लिए पाइथन मे कोड स्निपेट्स लिखें।


7 (a) How will you create a package and import it? Explain with an example program.

आप एक पैकेज को कैसे सृजित और इम्पोर्ट करेंगे, प्रोग्राम के उदाहरण के साथ इसकी व्याख्या करे।

(b) Explain the following :

निम्नलिखित की व्याख्या करें -

(1) List slicing लिस्ट स्लाइसिंग

(2) List Accessing methods लिस्ट एक्सेस विधिया

8 (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.

पाइथन स्लाइस की व्याख्या करें। स्लाइस का सिंटैक्स लिखे और इसके बारे में चर्चा करें।

9 (a) Define Numpy ? How to create numpy array ?

Numpy की परिभाषा दे, Numpy एैरे कैसे बनाते है।

(b) Explain Flowchart and symbols used in flowchart. Write the algorithm, pseudo code and draw the flowchart for towers of Hanoi.

फ्लोचार्ट और फ्लोचार्ट में उपयोग किए जाने वाले प्रतीकों की व्याख्या करें। अल्गोरिथम, छद्म कोड

लिखें और हनोई के टावर्स के लिए फ्लोचार्ट तैयार करें।

No comments:

Post a Comment

MCQ QUESTIONS

Loading…