CBSE Class 12 COMPUTER SCIENCE Previous Year Question Paper 2025 – Free PDF Download
CBSE CLASS 12 PREVIOUS YEAR QUESTION PAPER
COMPUTER SCIENCE
Previous Year Question paper Class 12 with Free PDF download Link
Free PDF Download Link Available in last of the question Paper / Post
Series: 4YWZX
रोल नं. / Roll No.
SET-4
प्रश्न-पत्र कोड / Q.P. Code: 91
कम्प्यूटर साइंस / COMPUTER SCIENCE
निर्धारित समय: 3 घण्टे / Time allowed: 3 hours
अधिकतम अंक: 70 / Maximum Marks: 70
परीक्षार्थी प्रश्न-पत्र कोड को उत्तर-पुस्तिका के मुख-पृष्ठ पर अवश्य लिखें ।
Candidates must write the Q.P. Code on the title page of the answer-book.
नोट / NOTE:
कृपया जाँच कर लें कि इस प्रश्न-पत्र में मुद्रित पृष्ठ 31 हैं।
कृपया जाँच कर लें कि इस प्रश्न-पत्र में 37 प्रश्न हैं।
प्रश्न-पत्र में दाहिने हाथ की ओर दिए गए प्रश्न-पत्र कोड को परीक्षार्थी उत्तर-पुस्तिका के मुख पृष्ठ पर लिखें ।
कृपया प्रश्न का उत्तर लिखना शुरू करने से पहले, उत्तर-पुस्तिका में यथा स्थान पर प्रश्न का क्रमांक अवश्य लिखें।
इस प्रश्न-पत्र को पढ़ने के लिए 15 मिनट का समय दिया गया है। प्रश्न-पत्र का वितरण पूर्वाह्न में 10.15 बजे किया जाएगा । 10.15 बजे से 10.30 बजे तक परीक्षार्थी केवल प्रश्न-पत्र को पढ़ेंगे और इस अवधि के दौरान वे उत्तर-पुस्तिका पर कोई उत्तर नहीं लिखेंगे ।
Please check that this question paper contains 31 printed pages.
Please check that this question paper contains 37 questions.
Q.P. Code given on the right hand side of the question paper should be written on the title page of the answer-book by the candidate.
Please write down the serial number of the question in the answer-book at the given place before attempting it.
15 minute time has been allotted to read this question paper. The question paper will be distributed at 10.15 a.m. From 10.15 a.m. to 10.30 a.m., the candidates will read the question paper only and will not write any answer on the answer-book during this period.
सामान्य निर्देश :
(i) इस प्रश्न-पत्र में 37 प्रश्न हैं।
(ii) सभी प्रश्न अनिवार्य हैं। परंतु कुछ प्रश्नों में आंतरिक विकल्प दिये गये हैं। ऐसे प्रश्नों में केवल एक विकल्प को चुनिए ।
(iii) इस प्रश्न-पत्र को 5 खण्डों क, ख, ग, घ और ङ में बाँटा गया है।
(iv) खण्ड - क में 21 प्रश्न (1 से 21) हैं। प्रत्येक प्रश्न के लिये 1 अंक निर्धारित है।
(v) खण्ड - ख में 7 प्रश्न (22 से 28) हैं। प्रत्येक प्रश्न के लिये 2 अंक निर्धारित हैं।
(vi) खण्ड - ग में 3 प्रश्न (29 से 31) हैं। प्रत्येक प्रश्न के लिये 3 अंक निर्धारित हैं।
(vii) खण्ड - घ में 4 प्रश्न (32 से 35) हैं। प्रत्येक प्रश्न के लिये 4 अंक निर्धारित हैं।
(viii) खण्ड - ङ में 2 प्रश्न (36 एवं 37) हैं। प्रत्येक प्रश्न के लिये 5 अंक निर्धारित हैं।
(ix) सभी प्रोग्रामिंग प्रश्नों का उत्तर केवल Python Language में दिया जाना है।
(x) बहुविकल्पीय प्रश्नों (Multiple Choice Questions) के मामले में सही उत्तर का text भी लिखा जाना चाहिए ।
CBSC class 12th preveious year exam , cbse exam , CBSE exam paper, CBSE COMPUTER SCIENCE exam, CBSE CLASS 12 COMPUTER SCIENCE QUESTION PAPER 2024 - FREE PDF DOWNLAOD LINK
Computer Science Question Paper CBSE Class 12 Free PDF download Link
Chemistry Question Paper CBSE Class 12 - with Free PDF download lInk
Biology Question Paper CBSE Class 12 - With Free PDF Download link
Applied mathematics Question paper CBSE class 12
खण्ड - क / SECTION - A
(21 × 1 = 21) बतायें कि सही है या गलत :
"Python List में हमेशा सभी एलिमेंट्स (elements) एक ही डेटा टाइप के होने चाहिए।"
State True or False:
"A Python List must always contain all its elements of same data type." निम्नलिखित स्टेटमेंट (Statement) का आउटपुट (Output) क्या होगा ?
print(14%32*4)
(A) 16
(B) 64
(C) 20
(D) 256
What will be the output of the following statement?
print(14%32*4)
(A) 16
(B) 64
(C) 20
(D) 256 निम्नलिखित कोड स्निपेट (code snippet) का सही आउटपुट (output) बताइये :
game="Olympic2024"
print(game.index("C"))
(A) 0
(B) 6
(C) -1
(D) ValueError
Identify the correct output of the following code snippet:
game="Olympic2024"
print(game.index("C"))
(A) 0
(B) 6
(C) -1
(D) ValueError निम्नलिखित में से कौन सा आइडेंटिफाइअर (identifier) सही है ?
(A) global
(B) Break
(C) def
(D) with
Which of the following is the correct identifier?
(A) global
(B) Break
(C) def
(D) with निम्नलिखित विकल्पों में से अमान्य (invalid) Python statement को बताइए :
(A) print("A", 10, end="")
(B) print("A", sep="", 10)
(C) print("A", 10, sep="")
(D) print("A"10)
Identify the invalid Python statement out of the following options:
(A) print("A", 10, end="")
(B) print("A", sep="", 10)
(C) print("A", 10, sep="*")
(D) print("A"*10) नीचे दिये गए स्टेटमेंट्स (statements) पर विचार कीजिए और दिये गये विकल्पों में से सही आउटपुट (output) चुनिये :
L=['TIC', 'TAC']
print(L[::-1])
(A) ['CIT', 'CAT']
(B) ['TIC', 'TAC']
(C) ['CAT', 'CIT']
(D) ['TAC', 'TIC']
Consider the statements given below and then choose the correct output from the given options:
L=['TIC', 'TAC']
print(L[::-1])
(A) ['CIT', 'CAT']
(B) ['TIC', 'TAC']
(C) ['CAT', 'CIT']
(D) ['TAC', 'TIC'] निम्नलिखित में से कौन सा ऑपरेटर (operator) True में इवैल्युएट (evaluate) होता है, यदि उस ऑपरेटर (operator) के दोनों तरफ के वेरिएबल (variable) समान मेमोरी स्थान (memory location) की ओर इंगित करते हैं, अन्यथा वह operator False में इवैल्युएट (evaluate) होता है ?
(A) is
(B) is not
(C) and
(D) or
Which of the following operator evaluates to True if the variable on either side of the operator points towards the same memory location and False otherwise?
(A) is
(B) is not
(C) and
(D) or नीचे दिए गए स्टेटमेंट्स (statements) पर विचार कीजिए और फिर दिये गये विकल्पों (options) में से सही आउटपुट (output) चुनिये :
D={'S01':95, 'S02':96}
for I in D:
print(I, end='#')
(A) S01#S02#
(B) 95#96#
(C) S01,95#S02,96#
(D) S01#95#S02#96#
Consider the statements given below and then choose the correct output from the given options:
D={'S01':95, 'S02':96}
for I in D:
print(I, end='#')
(A) S01#S02#
(B) 95#96#
(C) S01,95#S02,96#
(D) S01#95#S02#96# तालिका (table) तैयार करते समय कौन सा अवरोध (constraint) तालिका में प्रतिरूप मूल्यों (duplicate values) की प्रविष्टि (insertion) नहीं करने देता ?
(A) UNIQUE
(B) DISTINCT
(C) NOT NULL
(D) HAVING
While creating a table, which constraint does not allow insertion of duplicate values in the table ?
(A) UNIQUE
(B) DISTINCT
(C) NOT NULL
(D) HAVING नीचे दिए गए स्टेटमेंट्स (statements) पर विचार कीजिए और फिर दिये गये विकल्पों से सही आउटपुट (output) चुनिये :
def Change(N):
N = N + 10
print(N, end=' $$')[cite: 3] N = 15[cite: 3] Change(N)[cite: 3] print(N)[cite: 3] (A) 25$$15
(B) 15 $$25[cite: 3] (C) 25$$25
(D) 2525$$ Consider the statements given below and then choose the correct output from the given options: def Change(N): N = N + 10 print(N, end=' $$')[cite: 3]
N = 15[cite: 3]
Change(N)[cite: 3]
print(N)[cite: 3]
(A) 25$$15 (B) 15 $$25[cite: 3]
(C) 25$$25 (D) 2525$$ नीचे दिये गये स्टेटमेंट्स (statements) पर विचार कीजिए और फिर दिये गये विकल्पों (options) से सही आउटपुट (output) चुनिये :
N = '5'
try:
print('WORD' + N, end='#')
except:
print('ERROR', end='#')
finally:
print('OVER')
(A) ERROR#
(B) WORD5#OVER
(C) WORD5#
(D) ERROR#OVER
Consider the statements given below and then choose the correct output from the given options:
N = '5'
try:
print('WORD' + N, end='#')
except:
print('ERROR', end='#')
finally:
print('OVER')
(A) ERROR#
(B) WORD5#OVER
(C) WORD5#
(D) ERROR#OVER निम्नलिखित में से कौन सा Built-in function/method एक डिक्शनरी (dictionary) को वापिस (return) करता है ?
(A) dict()
(B) keys()
(C) values()
(D) items()
Which of the following built-in function/method returns a dictionary?
(A) dict()
(B) keys()
(C) values()
(D) items() SQL में निम्नलिखित में से कौन सी डीएमएल कमाण्ड (DML command) है ?
(A) UPDATE
(B) CREATE
(C) ALTER
(D) DROP
Which of the following is a DML command in SQL?
(A) UPDATE
(B) CREATE
(C) ALTER
(D) DROP SQL में कौन सा संगणना फंक्शन (aggregate function) नल (NULL) वैल्यूज़ (values) को अनदेखा करते हुए निर्दिष्ट कॉलम (specified column) में वैल्यूज़ (values) की संख्या प्रदर्शित करता है ?
(A) len()
(B) count()
(C) number()
(D) num()
Which aggregate function in SQL displays the number of values in the specified column ignoring the NULL values ?
(A) len()
(B) count()
(C) number()
(D) num() MYSQL में किस प्रकार के वैल्यू (value) को उद्धरण चिह्न (Quotation marks) के अंदर नहीं दिखाना चाहिए ?
(A) DATE
(B) VARCHAR
(C) FLOAT
(D) CHAR
In MYSQL, which type of value should not be enclosed within quotation marks?
(A) DATE
(B) VARCHAR
(C) FLOAT
(D) CHAR सही (True) या गलत (False) बतायें :
यदि तालिका (table) A में 6 पंक्तियाँ (rows) और 3 कॉलम (columns) हैं और तालिका B में 5 पंक्तियाँ और 2 कॉलम हैं, तो A और B के कार्तीय गुणनफल (Cartesian product) में 30 पंक्तियाँ (rows) और 5 कॉलम (columns) होंगे ।
State True or False:
If table A has 6 rows and 3 columns, and table B has 5 rows and 2 columns, the Cartesian product of A and B will have 30 rows and 5 columns. कमज़ोर सिग्नल (signal) को दुबारा जनरेट करने और आगे संप्रेषित (transmit) करने के लिये निम्नलिखित में से कौन सा नेटवर्किंग उपकरण (Networking device) प्रयोग किया जाता है ?
(A) हब (Hub)
(B) ईथरनेट कार्ड (Ethernet Card)
(C) रिपीटर (Repeater)
(D) मॉडेम (Modem)
Which of the following networking devices is used to regenerate and transmit the weakened signal ahead?
(A) Hub
(B) Ethernet Card
(C) Repeater
(D) Modem इंटरनेट पर फोन काल्स (phone calls) के लिये निम्नलिखित में से कौन सा विकल्प सही नियमावली (protocol) है ?
(A) PPP
(B) FTP
(C) HTTP
(D) VoIP
Which of the following options is the correct protocol used for phone calls over the internet?
(A) PPP
(B) FTP
(C) HTTP
(D) VoIP ARPANET का पूर्ण रूप (full form) लिखिए ।
Expand ARPANET. प्रश्न संख्या 20 और 21 अभिकथन (A) और तर्क (R) पर आधारित प्रश्न हैं। सही विकल्प पर निम्नलिखित रूप में निशान लगाकर उत्तर दीजिए :
(A) अभिकथन (A) और तर्क (R) दोनों सही हैं और अभिकथन (A) का सही स्पष्टीकरण तर्क (R) है।
(B) अभिकथन (A) और तर्क (R) दोनों सही हैं और अभिकथन (A) का सही स्पष्टीकरण तर्क (R) नहीं है।
(C) अभिकथन (A) सही है, परंतु तर्क (R) गलत है।
(D) अभिकथन (A) गलत है, परंतु तर्क (R) सही है। Q. Nos. 20 and 21 are Assertion (A) and Reason (R) based questions. Mark the correct choice as
(A) Both Assertion (A) and Reason (R) are true and Reason (R) is the correct explanation for Assertion (A).
(B) Both Assertion (A) and Reason (R) are true and Reason (R) is not the correct explanation for Assertion (A).
(C) Assertion (A) is true but, Reason (R) is false.
(D) Assertion (A) is false but, Reason (R) is true. अभिकथन (A) : 'rb' mode का उपयोग करके खोली गई बाइनरी फाइल (binary file) के लिए pickle.dump() मेथड (method) एक त्रुटि (error) दिखायेगा ।
तर्क (R) : pickle.dump() मेथड (method) का प्रयोग बाइनरी फाइल से पढ़ने के लिये किया जाता है।
Assertion (A): For a binary file opened using 'rb' mode, the pickle.dump() method will display an error.
Reason (R): The pickle.dump() method is used to read from a binary file. अभिकथन (A) : हम MYSQL में एक से अधिक तालिकाओं (tables) से रिकॉर्ड प्राप्त कर सकते हैं।
तर्क (R) : फॉरेन की (Foreign key) का प्रयोग दो तालिकाओं (tables) के बीच संबंध स्थापित करने के लिये किया जाता है।
Assertion (A): We can retrieve records from more than one table in MYSQL.
Reason (R): Foreign key is used to establish a relationship between two tables. खण्ड - ख / SECTION - B
(7 × 2 = 14) किसी फंक्शन (function) में रिटर्न स्टेटमेंट (return statement) का क्या कार्य है ? एक उदाहरण से इसे स्पष्ट कीजिए ।
What does the return statement do in a function? Explain with the help of an example. पायथन (Python) में निम्नलिखित में से प्रत्येक का एक उदाहरण लिखिए :
(i) सिन्टेक्स एरर (Syntax Error)
(ii) इमप्लिसिट टाईप कन्वर्जन (Implicit Type Conversion)
Write one example of each of the following in Python :
(i) Syntax Error
(ii) Implicit Type Conversion निम्नलिखित D और D1 डिक्शनरियों (dictionaries) पर विचार कीजिए :
D = {"Suman": 40, "Raj": 55, "Raman": 60}
D1 = {"Aditi": 30, "Amit": 90, "Raj": 20}
(केवल बिल्ट-इन पायथन फंक्शन्स (built-in Python functions) का प्रयोग करते हुए उत्तर दीजिए ।)
(i) (a) Dictionary D में "Raj" key के अनुरूप value प्रदर्शित / वापिस करने के लिये एक statement लिखिए ।
अथवा
(b) Dictionary D1 की लंबाई (length) प्रदर्शित करने के लिये एक statement लिखिए ।
(ii) (a) Dictionary D के सभी की-वैल्यू पेयर्स (key-value pairs) को Dictionary D1 के साथ जोड़ने के लिये statement लिखिए ।
अथवा
(b) Dictionary D1 से, दी गई key, "Amit" वाले आईटम्स (items) को मिटाने के लिए statement लिखिए । Consider the following dictionaries, D and D1:
D = {"Suman": 40, "Raj": 55, "Raman": 60}
D1 = {"Aditi": 30, "Amit": 90, "Raj": 20}
(Answer using built-in Python functions only)
(i) (a) Write a statement to display/return the value corresponding to the key "Raj" in the dictionary D.
OR
(b) Write a statement to display the length of the dictionary D1.
(ii) (a) Write a statement to append all the key-value pairs of the dictionary D to the dictionary D1.
OR
(b) Write a statement to delete the item with the given key "Amit" from the dictionary D1. निम्नलिखित कोड के निष्पादन (execution) पर दिए गए विकल्पों (options) से किस संभावित आउटपुट (output) के प्रदर्शित होने की आशा की जाती है ?
import random
Cards = ["Heart", "Spade", "Club", "Diamond"]
for i in range(2):
print(Cards[random.randint(1, i+2)], end="#")
(A) Spade#Diamond#
(B) Spade#Heart#
(C) Diamond#Club#
(D) Heart#Spade# What possible output from the given options is expected to be displayed when the following code is executed?
import random
Cards = ["Heart", "Spade", "Club", "Diamond"]
for i in range(2):
print(Cards[random.randint(1, i+2)], end="#")
(A) Spade#Diamond#
(B) Spade#Heart#
(C) Diamond#Club#
(D) Heart#Spade# नीचे दिया गया कोड, N को एक पूर्णांक (integer) argument के रूप में स्वीकार करता है और 1 से N तक के सभी पूर्णांकों का योग प्रदर्शित करता है। निम्नलिखित कोड का सावधानी से अवलोकन कीजिए और सभी सिन्टैक्स (syntax) और तार्किक त्रुटियों (logical errors) को हटाने के बाद इसे पुनः लिखिये । सभी किये गये सुधारों को रेखांकित कीजिए ।
def Sum (N)
for I in range(N):
S=S+I
return S
print(Sum (10) The code given below accepts N as an integer argument and returns the sum of all integers from 1 to N. Observe the following code carefully and rewrite it after removing all syntax and logical errors. Underline all the corrections made.
def Sum (N)
for I in range(N):
S=S+I
return S
print(Sum (10) निशा को एक संगठन के कर्मचारियों (staff) का डेटा (data) रखने का कार्य सौंपा गया है। उसे क्रमशः कर्मचारियों की पहचान संख्या, नाम, विभाग और मूल वेतन को स्टोर करने के लिये EMPNO, NAME, DEPARTMENT, BASICSAL शीर्षकों वाले EMPLOYEES नामक एक SQL table में कर्मचारियों (staff) के विवरण (details) रखने हैं। संगठन में एक ही नाम के दो या इससे अधिक कर्मचारी हो सकते हैं।
(i) (a) निशा को उस एट्रीब्यूट (attribute) को पहचानने में सहायता कीजिए जिसे प्राइमरी की (PRIMARY KEY) बनाना चाहिए। अपने उत्तर का औचित्य बताइए ।
अथवा
(b) निशा को उस कन्स्ट्रेट (constraint) का पता करने में सहायता दीजिए जिसे एट्रीब्यूट (attribute) NAME में लागू किया जाना चाहिए ताकि रिकॉर्ड में प्रविष्टि के समय कर्मचारियों के नामों को रिक्त या NULL के रूप में छोड़ा न जा सके परन्तु डुप्लिकेट वैल्यूज (duplicate values) हो सकती हैं।
(ii) (a) EMPLOYEES table में BASICSAL विशेषक का आकार (size) बदलने के लिये SQL कमांड लिखिये ताकि इसमें अधिकतम वैल्यू (maximum value), 99999.99 को स्टोर किया जा सके ।
अथवा
(b) EMPLOYEES टेबल (table) को हटाने के लिए SQL कमांड लिखिये । Nisha is assigned the task of maintaining the staff data of an organization. She has to store the details of the staff in the SQL table named EMPLOYEES with attributes as EMPNO, NAME, DEPARTMENT, BASICSAL to store Employee's Identification Number, Name, Department, and Basic Salary respectively. There can be two or more Employees with the same name in the organization.
(i) (a) Help Nisha to identify the attribute which should be designated as the PRIMARY KEY. Justify your answer.
OR
(b) Help Nisha to identify the constraint which should be applied to the attribute NAME such that the Employees' Names cannot be left empty or NULL while entering the records but can have duplicate values.
(ii) (a) Write the SQL command to change the size of the attribute BASICSAL in the table EMPLOYEES to allow the maximum value of 99999.99 to be stored in it.
OR
(b) Write the SQL command to delete the table EMPLOYEES. (a) URL शब्द का पूर्ण रूप लिखिये और इसे स्पष्ट कीजिए ।
अथवा
(b) PPP शब्द का पूर्ण रूप लिखिए। PPP का क्या उपयोग है ?
(a) Expand and explain the term URL.
OR
(b) Expand the term PPP. What is the use of PPP? खण्ड - ग / SECTION - C
(3 × 3 = 9) (a) एक पायथन फंक्शन (Python function) लिखिये जो एक टेक्सट फाइल "Elections.txt" से 'vote' शब्द वाली सभी पंक्तियों को प्रदर्शित करता है। उदाहरण के लिये, यदि फाइल में यह है :
In an election many people vote to choose their representative.
The candidate getting the maximum share of votes stands elected.
Normally, one person has to vote once.
The process of voting may vary with time and region.
तब output यह होना चाहिए :
In an election many people vote to choose their representative.
Normally, one person has to vote once.
अथवा
(b) एक पायथन फंक्शन (Python function) लिखिये जो "Report.txt" नामक टेक्सट फाइल से एक स्वर (vowel) से शुरू और समाप्त होने वाले सभी शब्दों को प्रदर्शित करता है। क्रमगत (consecutive) शब्द output में एक अंतराल (space) द्वारा अलग-अलग किये जाने चाहिए । उदाहरण के लिये यदि फाइल में यह है :
Once there was a wise man in a village.
He was an awesome story-teller.
He was able to keep people anchored while listening to him.
तब output यह होना चाहिए :
Once a a awesome able Write a Python function that displays all the lines containing the word 'vote' from a text file "Elections.txt". For example, if the file contains:
In an election many people vote to choose their representative.
The candidate getting the maximum share of votes stands elected.
Normally, one person has to vote once.
The process of voting may vary with time and region.
Then the output should be :
In an election many people vote to choose their representative.
Normally, one person has to vote once.
OR
(b) Write a Python function that displays all the words starting and ending with a vowel from a text file "Report.txt". The consecutive words should be separated by a space in the output. For example, if the file contains:
Once there was a wise man in a village.
He was an awesome story-teller.
He was able to keep people anchored while listening to him.
Then the output should be :
Once a a awesome able (a) ClrStack नामक एक संग्रहण (stack) में कुछ रंगों का रिकॉर्ड है। प्रत्येक रिकॉर्ड एक टपल (tuple) के रूप में चार तत्त्वों-ColorName, RED, GREEN, BLUE को प्रदर्शित करता है । ColorName एक स्ट्रिंग (string) है और RED, GREEN, BLUE पूर्णांक (integers) हैं। उदाहरण के लिये संग्रहण (stack) में एक रिकॉर्ड ('Yellow', 237, 250, 68) हो सकता है।
ClrStack पर विनिर्दिष्ट operations करने के लिये पायथन (Python) में निम्नलिखित यूज़र-डिफाइन्ड फंक्शन्स (user-defined functions) लिखिए :
(i) push_Clr (ClrStack, new_Clr): यह फंक्शन stack ClrStack और नये रिकॉर्ड new_Clr को आरग्यूमेंट के रूप में लेता है और इस नये रिकॉर्ड को संग्रहण (stack) में डालता है।
(ii) pop_Clr (ClrStack): यह फंक्शन संग्रहण (stack) से सर्वोच्च रिकॉर्ड को पॉप करता है और इसे वापिस करता है। यदि स्टैक पहले से ही रिक्त हो तो फंक्शन को "Underflow" संदेश प्रदर्शित करना चाहिए ।
(iii) isEmpty (ClrStack): यह फंक्शन यह जाँच करता है कि क्या stack रिक्त है। यदि stack रिक्त है तो फंक्शन को True वापिस करना चाहिए अन्यथा False वापिस करना चाहिए ।
अथवा
(b) पायथन (Python) में निम्नलिखित यूज़र डिफाइन्ड फंक्शन्स लिखिए :
(i) push_trail (N, myStack): यहाँ N और mystack लिस्ट्स हैं और myStack एक stack को प्रदर्शित करता है। इस फंक्शन को list N से अंतिम 5 elements, myStack स्टैक में भेजने चाहिए। उदाहरण के लिये यदि सूची N [1,2,3,4,5,6,7] है, तो फंक्शन push_trail() को 3,4,5,6,7 elements, stack में भेजने चाहिए । इसलिए stack की वैल्यू [3,4,5,6,7] होगी। यह मानिये कि N में कम से कम 5 एलिमेंट्स हैं।
(ii) pop_one (myStack): इस फंक्शन को स्टैक myStack से एक element पॉप करना चाहिए और इस element को वापिस करना चाहिए । यदि stack रिक्त हो तो फंक्शन को 'Stack Underflow' संदेश प्रदर्शित करना चाहिए और None वापिस करना चाहिए ।
(iii) display_all (myStack): फंक्शन को स्टैक myStack के सभी elements, बिना उनको हटाये, प्रदर्शित करने चाहिए। यदि stack रिक्त है तो फंक्शन को 'Empty Stack' संदेश प्रदर्शित करना चाहिए । (a) A stack, named ClrStack, contains records of some colors. Each record is represented as a tuple containing four elements ColorName, RED, GREEN, BLUE. ColorName is a string, and RED, GREEN, BLUE are integers. For example, a record in the stack may be ('Yellow', 237, 250, 68)
Write the following user-defined functions in Python to perform the specified operations on ClrStack:
(i) push_Clr (ClrStack, new_Clr): This function takes the stack ClrStack and a new record new_Clr as arguments and pushes this new record onto the stack.
(ii) pop_Clr(ClrStack): This function pops the topmost record from the stack and returns it. If the stack is already empty, the function should display the message "Underflow".
(iii) isEmpty (ClrStack): This function checks whether the stack is empty. If the stack is empty, the function should return True, otherwise the function should return False.
OR
(b) Write the following user-defined functions in Python :
(i) push_trail (N, myStack): Here N and mystack are lists, and myStack represents a stack. The function should push the last 5 elements from the list N onto the stack myStack. For example, if the list N is [1,2,3,4,5,6,7], then the function push_trail() should push the elements 3,4,5,6,7 onto the stack. Therefore the value of stack will be [3,4,5,6,7]. Assume that N contains at least 5 elements.
(ii) pop_one (myStack): The function should pop an element from the stack myStack, and return this element. If the stack is empty, then the function should display the message 'Stack Underflow', and return None.
(iii) display_all(myStack): The function should display all the elements of the stack myStack, without deleting them. If the stack is empty, the function should display the message 'Empty Stack'. (a) निम्नलिखित कोड का आउटपुट (output) बताइए :
def Examon (mystr):
newstr = ""
count = 0
for i in mystr:
if count % 2 != 0:
newstr = newstr + str(count-1)
else:
newstr = newstr + i.lower()
count += 1
newstr = newstr + mystr[:2]
print("The new string is:", newstr) Examon ("GenX")
अथवा
(b) निम्नलिखित पायथन कोड के निष्पादन (execution) पर आउटपुट (output) लिखिये :
def Change (X):
for K, V in X.items():
L1.append(K)
L2.append(V) D = {1: "ONE", 2: "TWO", 3: "THREE"}
L1 = []
L2 = []
Change (D)
print (L1)
print (L2)
print (D) (a) Predict the output of the following code:
def Examon (mystr):
newstr = ""
count = 0
for i in mystr:
if count % 2 != 0:
newstr = newstr + str(count-1)
else:
newstr = newstr + i.lower()
count += 1
newstr = newstr + mystr[:2]
print("The new string is:", newstr) Examon ("GenX")
OR
(b) Write the output on execution of the following Python code:
def Change (X):
for K, V in X.items():
L1.append(K)
L2.append (V) D = {1: "ONE", 2: "TWO", 3: "THREE"}
L1 = []
L2 = []
Change (D)
print(L1)
print(L2)
print(D) खण्ड - घ / SECTION - D
(4 × 4 = 16) सुमन ने निर्माण स्थल (construction site) के आँकड़े (data) रखने के लिये एक रिकॉर्ड सेट के साथ WORKER नामक एक तालिका (table) तैयार की है जिसमें WID, WNAME, WAGE, HOURS, TYPE, और SITEID शामिल हैं। तालिका तैयार करने के बाद वह इसमें आँकड़ों (data) की निम्नलिखित रूप में प्रविष्टि करती है : WID | WNAME | WAGE | HOURS | TYPE | SITEID
W01 | Ahmed J | 1500 | 200 | Unskilled | 103
W11 | Naveen S | 520 | 100 | Skilled | 101
W02 | Jacob B | 780 | 95 | Unskilled | 101
W15 | Nihal K | 560 | 110 | Semiskilled | NULL
W10 | Anju S | 1200 | 130 | Skilled | 103 Suman has created a table named WORKER with a set of records to maintain the data of the construction sites, which consists of WID, WNAME, WAGE, HOURS, TYPE, and SITEID. After creating the table, she entered data in it, which is as follows: WID | WNAME | WAGE | HOURS | TYPE | SITEID
W01 | Ahmed J | 1500 | 200 | Unskilled | 103
W11 | Naveen S | 520 | 100 | Skilled | 101
W02 | Jacob B | 780 | 95 | Unskilled | 101
W15 | Nihal K | 560 | 110 | Semiskilled | NULL
W10 | Anju S | 1200 | 130 | Skilled | 103 (a) ऊपर दिये गये आँकड़ों (data) के आधार पर निम्नलिखित प्रश्नों के उत्तर दीजिए :
(i) 800 से 1500 के बीच की मजदूरी वाले कर्मचारियों के नाम और मजदूरी (wages) को प्रदर्शित करने के लिये SQL statement लिखिये ।
(ii) जिन कर्मचारियों की SITEID ज्ञात नहीं है, उनका रिकॉर्ड प्रदर्शित करने के लिये SQL statement लिखिए ।
(iii) उन सभी मजदूरों जिनका TYPE 'Skilled' है, उनका WNAME, WAGE और HOURS प्रदर्शित करने के लिए SQL statement लिखिए ।
(iv) जिन मज़दूरों का TYPE "Semiskilled" है, उन सभी का WAGE 1200 करने के लिए SQL statement लिखिए ।
अथवा
(b) ऊपर दी गई WORKER तालिका पर विचार करते हुए निम्नलिखित SQL कमांड के निष्पादन (execution) पर आउटपुट (output) बताइये :
(i) SELECT WNAME, WAGE * HOURS FROM WORKER WHERE SITEID = 103;
(ii) SELECT COUNT(DISTINCT TYPE) FROM WORKER;
(iii) SELECT MAX(WAGE), MIN(WAGE), TYPE FROM WORKER GROUP BY TYPE;
(iv) SELECT WNAME, SITEID FROM WORKER WHERE TYPE="Unskilled" ORDER BY HOURS; Based on the data given above, answer the following questions:
(a) (i) Write the SQL statement to display the names and wages of those workers whose wages are between 800 and 1500.
(ii) Write the SQL statement to display the record of workers whose SITEID is not known.
(iii) Write the SQL statement to display WNAME, WAGE and HOURS of all those workers whose TYPE is 'Skilled'.
(iv) Write the SQL statement to change the WAGE to 1200 of the workers where the TYPE is "Semiskilled".
OR
(b) Considering the above given table WORKER, write the output on execution of the following SQL commands:
(i) SELECT WNAME, WAGE * HOURS FROM WORKER WHERE SITEID = 103;
(ii) SELECT COUNT (DISTINCT TYPE) FROM WORKER;
(iii) SELECT MAX(WAGE), MIN(WAGE), TYPE FROM WORKER GROUP BY TYPE;
(iv) SELECT WNAME, SITEID FROM WORKER WHERE TYPE="Unskilled" ORDER BY HOURS; "P_record.csv" नामक एक csv फाइल में एक अस्पताल के मरीज़ों के रिकॉर्ड रखे गये हैं। फाइल के प्रत्येक रिकॉर्ड में निम्नलिखित आँकड़े (data) हैं :
• रोगी का नाम
• बीमारी
• जितने दिन रोगी भर्ती रहा
• धनराशि
उदाहरण के लिये फाइल का नमूना रिकॉर्ड यह हो सकता है :
["Gunjan", "Jaundice", 4, 15000]
इस फाइल में विनिर्दिष्ट कार्य करने के लिये निम्नलिखित Python functions लिखिए :
(i) read_data() फंक्शन लिखिये जो फाइल से सभी डेटा (data) को पढ़ता है और सभी 'Cancer' रोगियों के विवरण प्रदर्शित करता है।
(ii) count_rec() फंक्शन लिखिये जो फाइल की रिकॉर्ड संख्या की गणना करता है और वापिस (returns) करता है। A csv file "P_record.csv" contains the records of patients in a hospital. Each record of the file contains the following data:
• Name of a patient
• Disease
• Number of days patient is admitted
• Amount
For example, a sample record of the file may be :
["Gunjan", "Jaundice", 4, 15000]
Write the following Python functions to perform the specified operations on this file:
(i) Write a function read_data() which reads all the data from the file and displays the details of all the 'Cancer' patients.
(ii) Write a function count_rec() which counts and returns the number of records in the file. यह मानिये कि आप रचनात्मक कला दीर्घा (सी.ए.जी.) (Creative Art Gallery (CAG)) के आई टी (IT) विभाग में कार्य कर रहे हैं, जो पेन्टिंग्स, मूर्तियाँ (Sculptures) आदि जैसी विभिन्न प्रकार की कलाकृतियों को बेचती है। कलाकृतियों (Art creations) और कलाकारों (Artists) के आँकड़े (data) क्रमशः तालिका (table) Articles और Artists में रखे जाते हैं। इन दो तालिकाओं से कुछ रिकॉर्ड्स इस प्रकार हैं : Table: Articles
Code | A_Code | Article | DOC | Price
PL001 | A0001 | Painting | 2018-10-19 | 20000
SC028 | A0004 | Sculpture | 2021-01-15 | 16000
QL005 | A0003 | Quilling | 2024-04-24 | 3000 Table: Artists
A_Code | Name | Phone | Email | DOB
A0001 | Roy | 595923 | r@CrAG.com | 1986-10-12
A0002 | Ghosh | 1122334 | ghosh@CrAG.com | 1972-02-05
A0003 | Gargi | 121212 | Gargi@CrAG.com | 1996-03-22
A0004 | Mustafa | 33333333 | Mf@CrAg.com | 2000-01-01 टिप्पणी : तालिकाओं (tables) में यहाँ दिखाए गए से कहीं अधिक रिकॉर्ड्स हैं।
• DOC निर्माण की तारीख (Date of Creation) है।
सी.ए.जी. (रचनात्मक कला दीर्घा) के कर्मचारी के रूप में निम्नलिखित के लिये SQL queries लिखने की आपसे अपेक्षा की जाती है :
(i) मूल्यों (Price) के अवरोही (descending) क्रम में Articles table से सभी रिकॉर्ड्स को प्रदर्शित करने के लिए ।
(ii) जिन वस्तुओं को वर्ष 2020 में बनाया गया था उनके विवरण प्रदर्शित करने के लिए ।
(iii) Artists table की संरचना (structure) प्रदर्शित करने के लिए।
(iv) (a) इक्वी-जुड़ाव (Equi Join) के द्वारा पेन्टिंग (Painting) वाली कलाकृति के सभी कलाकारों के नाम प्रदर्शित करने के लिए ।
अथवा
(b) नेचुरल जुड़ाव (Natural Join) के द्वारा पेन्टिंग (Painting) वाली कलाकृति के सभी कलाकारों के नाम प्रदर्शित करने के लिए । Assume that you are working in the IT Department of a Creative Art Gallery (CAG), which sells different forms of art creations like Paintings, Sculptures etc. The data of Art Creations and Artists are kept in tables Articles and Artists respectively. Following are few records from these two tables: Table Articles
Code | A_Code | Article | DOC | Price
PL001 | A0001 | Painting | 2018-10-19 | 20000
SC028 | A0004 | Sculpture | 2021-01-15 | 16000
QL005 | A0003 | Quilling | 2024-04-24 | 3000 Table Artists
A_Code | Name | Phone | Email | DOB
A0001 | Roy | 595923 | r@CrAG.com | 1986-10-12
A0002 | Ghosh | 1122334 | ghosh@CrAG.com | 1972-02-05
A0003 | Gargi | 121212 | Gargi@CrAG.com | 1996-03-22
A0004 | Mustafa | 33333333 | Mf@CrAg.com | 2000-01-01 Note: The tables contain many more records than shown here.
• DOC is Date of Creation of an Article.
As an employee of CAG, you are required to write the SQL queries for the following:
(i) To display all the records from the Articles table in descending order of price.
(ii) To display the details of Articles which were created in the year 2020.
(iii) To display the structure of Artists table.
(iv) (a) To display the name of all artists whose Article is Painting through Equi Join.
OR
(b) To display the name of all Artists whose Article is 'Painting' through Natural Join. CINEMA database में THEATRE नामक तालिका (table) की संरचना निम्नलिखित है :
Field | Type
Th_ID | char (5)
Name | varchar (15)
City | varchar (15)
Location | varchar (15)
Seats | int Delete_Theatre () function लिखें जो उपयोगकर्ता (user) से Th_ID की वैल्यू लें और तालिका से उससे संबंधित रिकॉर्ड हमेशा के लिये हटा दें।
पायथन डेटाबेस संयोजनता (Python-Database connectivity) के लिये निम्नलिखित मान लें :
Host: localhost, User: root, Password: Ex2025 A table, named THEATRE, in CINEMA database, has the following structure :
Field | Type
Th_ID | char (5)
Name | varchar (15)
City | varchar (15)
Location | varchar (15)
Seats | int Write a function Delete_Theatre (), to input the value of Th_ID from the user and permanently delete the corresponding record from the table.
Assume the following for Python-Database connectivity:
Host: localhost, User: root, Password: Ex2025 खण्ड - ङ / SECTION - E
(2 × 5 = 10) PASSENGERS.DAT एक फाइल है जो यात्रियों के रिकॉर्ड्स (records) को निम्नलिखित स्ट्रक्चर में संगृहीत करती है :
[PNR, PName, BRDSTN, DESTN, FARE]
जिसमें :
PNR : यात्री का नंबर (string type)
PName : यात्री का नाम (string type)
BRDSTN : बोर्डिंग स्टेशन का नाम (string type)
DESTN : गंतव्य स्टेशन का नाम (string type)
FARE : यात्रा के लिए किराया राशि (float type) निम्नलिखित कार्यों के लिये Python में यूज़र डिफाइन्ड फंक्शन्स (user defined functions) लिखिए :
(i) Create() यात्रियों के लिये data इनपुट करने और इसे binary file PASSENGERS.DAT में लिखने के लिए ।
(ii) SearchDestn (D) PASSENGERS.DAT फाइल से कान्टेंट्स को पढ़ने और उन यात्रियों के विवरण प्रदर्शित करने के लिए जिनके DESTN की वैल्यू D के अनुरूप हों ।
(iii) UpdateFare () सभी यात्रियों का किराया 5% बढ़ाना और PASSENGERS.DAT फाइल में अपडेट किया गया रिकॉर्ड दुबारा लिखने के लिए । A file, PASSENGERS.DAT, stores the records of passengers using the following structure:
[PNR, PName, BRDSTN, DESTN, FARE]
where:
PNR : Passenger Number (string type)
PName : Passenger Name (string type)
BRDSTN : Boarding Station Name (string type)
DESTN : Destination Station Name (string type)
FARE : Fare amount for the journey (float type) Write user defined functions in Python for the following tasks:
(i) Create() to input data for passengers and write it in the binary file PASSENGERS.DAT.
(ii) SearchDestn (D) to read contents from the file PASSENGERS.DAT and display the details of those Passengers whose DESTN matches with the value of D.
(iii) UpdateFare () to increase the fare of all passengers by 5% and rewrite the updated records into the file PASSENGERS.DAT. मनोवैज्ञानिक उपचार और परामर्श के क्षेत्र में "स्वभाव" एक बड़ा गैर-सरकारी संगठन (NGO) है जिसका मुख्य कार्यालय नागपुर में है। वह दूसरे शहर विजयवाड़ा में इसका एक केन्द्र स्थापित करने की योजना कर रहा है । विजयवाड़ा केन्द्र में चार ब्लॉक अर्थात् प्रशासन (ADMIN), मनोचिकित्सा (PSYCHIATRY), मनोविज्ञान (PSYCHOLOGY) और आईसीयू (ICU) होंगे। एक नेटवर्क विशेषज्ञ के रूप में निम्नलिखित मानकों (parameters) को ध्यान में रखते हुए प्रश्न (i) से (v) तक में उल्लिखित मुद्दों/समस्याओं को हल करने के लिये आपको नेटवर्क संबंधी सर्वोत्तम समाधान बताना है : 'Swabhaav' is a big NGO working in the field of Psychological Treatment and Counselling, having its Head Office in Nagpur. It is planning to set up a center in Vijayawada. The Vijayawada Center will have four blocks ADMIN, PSYCHIATRY, PSYCHOLOGY, and ICU. You, as a Network Expert, need to suggest the best network-related solutions for them to resolve the issues/problems mentioned in questions (i) to (v), keeping the following parameters in mind : एक ब्लॉक से दूसरे ब्लॉक की दूरी (मीटर में) / Block to Block distances (in metres) :
From | To | Distance
ADMIN | PSYCHIATRY | 65 m
ADMIN | PSYCHOLOGY | 65 m
ADMIN | ICU | 65 m
PSYCHIATRY | PSYCHOLOGY | 100 m
PSYCHIATRY | ICU | 50 m
PSYCHOLOGY | ICU | 50 m विजयवाड़ा केन्द्र से नागपुर मुख्य कार्यालय की दूरी = 700 कि.मी.
Distance of Nagpur Head Office from Vijayawada Center = 700 km प्रत्येक ब्लॉक में कम्प्यूटर्स की संख्या / Number of Computers in each block :
Block | No. of Computers
ADMIN | 16
PSYCHIATRY | 40
PSYCHOLOGY | 19
ICU | 20 (i) विजयवाड़ा केन्द्र के अंदर सर्वर (server) के लिए सर्वाधिक उपयुक्त स्थान का सुझाव दीजिए । अपने चयन का औचित्य सिद्ध कीजिए ।
Suggest the most appropriate location of the server inside the Vijayawada Center. Justify your choice. (ii) विजयवाड़ा केन्द्र के प्रत्येक ब्लॉक के अन्दर सभी कम्प्यूटरों को जोड़ने के लिये आप किस हार्डवेयर उपकरण (Hardware Device) का सुझाव देंगे ?
Which hardware device will you suggest to connect all the computers within each block of Vijayawada Center? (iii) विजयवाड़ा केन्द्र के अंदर विभिन्न ब्लॉकों को कुशलतापूर्वक जोड़ने के लिये एक केबल नक्शा (cable layout) बनाइये ।
Draw a cable layout to efficiently connect various blocks within the Vijayawada Center. (iv) विजयवाड़ा केन्द्र में सभी कम्प्यूटर्स को इंटरनेट प्रदान करने के लिये router को कहाँ लगाया जाना चाहिए ?
Where should the router be placed to provide internet to all the computers in the Vijayawada Center? (v) (a) नागपुर के प्रबंधक विजयवाड़ा में प्रशासन ब्लॉक के कम्प्यूटर से परोक्ष रूप से (remotely) जुड़ना चाहते हैं। इसके लिये कौन सा प्रोटोकोल (protocol) प्रयोग किया जाएगा ?
अथवा
(b) विजयवाड़ा केन्द्र से जुड़े कम्प्यूटरों के बीच कौन सा नेटवर्क (PAN, LAN, MAN या WAN) स्थापित किया जाएगा ? (v) (a) The Manager at Nagpur wants to remotely access the computer in Admin block in Vijayawada. Which protocol will be used for this?
OR
(b) Which type of Network (PAN, LAN, MAN or WAN) will be set up among the computers connected with Vijayawada Center?