Page 1
HBSE
MODEL PAPER
2024
Practice Papers
MODEL PAPERS
Marking Scheme
ANSWER KEY
Page 2
Note: Apart from the marking instructions, a teacher can evaluate at his discretion.
नोट: अंकन नदश के अलावा, एक श क अपने ववेकानुसार मू यांकन कर सकता है ।
Marking Scheme-COMPUTER SCIENCE (CPU)
(SUBJECT CODE: 906)
Maximum Marks: 40 Time: 2:30 hours
General Instructions:
i. This question paper is divided into 4 Sections - A, B and C and D.
ii. Section A consists of 1 question (10 parts -Objective Type of 1 mark each).
iii. Section B consists of 4 questions (2-5). Each question carries 1 mark.
iv. Section C consists of 5 questions (6-10). Each question carries 2 marks.
v. Section D consists of 4 questions (11-14). Each question carries 4 marks. Internal choices
are given in all 4 questions.
SECTION A
(Each part of the question carries 1 Mark)
1(i) A collection of hyperlinked documents on the internet will form 1
a) World Wide Web (WWW)
b) E-mail system
c) Mailing list
d) Hypertext markup language
इं टरनेट प ों पर हाइपरिलंक िकए गए द ावेज़ों का सं ह
a) व वाइड वेब (WWW)
b) ई-मे ल णाली
c) मेिलंग सूची
d) हाइपर टे माकअप ल ेज
Ans a) World Wide Web (WWW) a) व वाइड वेब (WWW)
1 Mark for correct identification of the related term.
1(ii) In the __________ normal form, a composite attribute is converted to 1
individual attributes.
a) First
b) Second
c) Third
d) None of the Above
__________ नॉमल फॉम म, एक सम िवशेषता को अलग-अलग िवशेषताओं म प रवितत िकया जाता
है ।
a) पहली
b) दू सरी
c) तीसरी
d) उपरो म से कोई नहीं
Ans a) First a) पहली
Page 3
1 Mark for correct identification of the Normal form.
1(iii) Among the following, which is the HTML paragraph tag? 1
a) <p>
b) <pre>
c) <hr>
d) <a>
िन िल खत म से कौन-सा HTML पैरा ाफ टै ग है ?
a) <p>
b) <pre>
c) <hr>
d) <a>
Ans a) <p>
1 Mark for correct identification of the HTML paragraph tag.
1(iv) If the elements “A”, “B”, “C” and “D” are placed in a queue and are deleted 1
one at a time, in what order will they be removed?
a) ABCD
b) DCBA
c) DCAB
d) DBAC
यिद element "A", "B", "C" और "D" को एक queue म रखा जाता है और एक बार म हटा िदया जाता
है , तो उ िकस म म हटाया जाएगा?
a) ABCD
b) DCBA
c) DCAB
d) DBAC
Ans a) ABCD
1 Mark to identify the order of removal from queue.
1(v) ____________ Tag is used for making the text bold. 1
टे को बो करने के िलए__________ टै ग का उपयोग होता है ।
Ans <B> or <b>
1 Mark for writing the correct HTML tag.
Note: Deduct ½ mark for not writing the tag without < > symbol.
1(vi) ________ Operator in C++ requires three operands. 1
C++ म ________ ऑपरे टर को तीन ऑपरड की आव कता होती है।
Ans Ternary or conditional or ( ? : ) टनरी या कंडीशनल या (? : )
1 Mark for writing the correct C++ operator.
Note: Do not deduct mark for any spelling mistakes.
Page 4
1(vii) “header” keyword is used to declare the header file in C++. True/False 1
C++ म हेडर फाइल को िड े यर करने के िलए “header” कीवड का योग िकया जाता है .
स /अस
Ans False अस
1 Mark for correct identification.
1(viii) HTML files are saved by default with “.html” extension. True/False 1
HTML फाइल िडफॉ प से “.html” ए टशन के साथ से व होती है. स /अस
Ans True स
1 Mark for correct identification.
Direction: In the questions given below, there are two statements marked as
Assertion (A) and Reason (R). Choose the correct option out of the choices
given below in each question:
िनदश: नीचे िदए गए ों म, कथन (A) और कारण (R) के प म िचि त दो कथन ह। ेक म
नीचे िदए गए िवक ों म से सही िवक का चयन कीिजए:
1(ix) Assertion (A): Primary key is a set of one or more attributes that identify tuples 1
in a relation uniquely.
Reason (R): Every table must have one primary key.
I. Both (A) and (R) are correct and (R) is correct explanation of (A).
II. Both (A) and (R) are correct and (R) is not the correct explanation of
(A).
III. (A) is true but (R) is false.
IV. (A) is false but (R) is true.
कथन (A): ाइमरी की एक या अिधक िवशेषताओं का एक सेट है जो िविश प से संबंध म टप की
पहचान करती है ।
कारण (R): े क टे बल म एक ाइमरी की होनी चािहए।
I. (A)और (R) दोनों सही ह और (R), (A) की सही ा ा है ।
II. (A) और (R) दोनों सही ह और (R), (A) की सही ा ा नही ं है ।
III. (A) स है लेिकन (R) अस है ।
IV. (A) अस है लेिकन (R) स है ।
Ans II. Both (A) and (R) are correct and (R) is not the correct explanation
of (A).
II. (A) और (R) दोनों सही ह और (R), (A) की सही ा ा नही ं है ।
1 Mark for correct identification.
1(x) Assertion (A): The Internet is a collection of interconnected computer 1
networks.
Reason (R): World Wide Web is a collection of interconnected documents.
Page 5
I. Both (A) and (R) are correct and (R) is correct explanation of (A).
II. Both (A) and (R) are correct and (R) is not the correct explanation
of (A).
III. (A) is true but (R) is false.
IV. (A) is false but (R) is true
कथन (A): इं टरनेट आपस म जुड़े कं ूटर नेटवक का एक सं ह है ।
कारण (R): व वाइड वेब आपस म जु ड़े द ावेजों का एक सं ह है ।
I. (A)और (R) दोनों सही ह और (R), (A) की सही ा ा है ।
II. (A) और (R) दोनों सही ह और (R), (A) की सही ा ा नही ं है ।
III. (A) स है लेिकन (R) अस है ।
IV. (A) अस है लेिकन (R) स है ।
Ans II. Both (A) and (R) are correct and (R) is not the correct
II. (A) और (R) दोनों सही ह और (R), (A) की सही ा ा नही ं है ।
1 Mark for correct identification.
SECTION B
(Each question carries 1 mark)
2. Define friend function in C++. 1
C++ म ड फं न को प रभािषत कर।
Ans A friend function in C++ is a function that is declared outside a class but is capable of
accessing the private and protected members of the class.
OR
Syntax of Friend Function
class className {
... .. ...
friend returnType functionName(arguments);
... .. ...
}
C++ म ड फं न एक ऐसा फं न है जो ास के बाहर घोिषत िकया जाता है लेिकन
ास के ाइवेट और ोटे े ड सद ों तक प ँचने म स म होता है।
या
ड फं न का िसं टे
class className {
... .. ...
friend returnType functionName(arguments);
... .. ...
}
1 Mark for any correct explanation/definition/syntax of friend function.
(Do not deduct marks if only syntax is written)
(Deduct ½ mark if there is any syntactical error)
3. What is Multi Level Inheritance? 1
Page 6
म ी लेवल इनहे रटस ा है ।
Ans Multilevel Inheritance in C++ is the process of deriving a class from another
derived class.
OR
When one class inherits another class which further inherited by any other
class. It is known as multi-level inheritance.
म ी लेवल इनहे रटस म िकसी बेस ास को िकसी चाइ ास के ारा इनहे रट िकया जाता है
और िफर उस चाइ ास को िकसी तीसरी ास के ारा इनहे रट िकया जाता है
या
जब एक से अिधक ास एक लेवल म एक दू सरे को इनहे रट करते है तो उस इनहे रटस को
म ीलेवल इनहे रटस कहते है
Diagram:
1 Mark for any correct definition of Multilevel Inheritance.
½ mark for multilevel inheritance diagram only.
4. Define 1NF. 1
1NF को प रभािषत कीिजए।
Ans A relation/table/database is said to be in 1NF if it only consists of atomic
values, and no repeating groups are present.
एक रलेशन/टे बल/डे टाबेस को 1NF म कहा जाता है यिद इसम केवल िसंगल वै ू होती ह, और कोई
दोहराए जाने वाले समू ह मौजू द नहीं होते ह।
Example of First normal form (1NF)
Not in 1NF
Relation is in
1NF
1 Mark for any correct definition of 1NF(First Normal form)
½ mark for any example/diagram of 1NF
5. Write the syntax of Create a Table in SQL. 1
Page 7
SQL म Create Table का िसं टै िलख।
Ans CREATE TABLE table_name (
column1 datatype,
column2 datatype,
column3 datatype,
....
);
CREATE TABLE टे बल_नाम (
कॉलम 1 डे टाटाइप,
कॉलम 2 डे टाटाइप,
कॉलम3 डे टाटाइप,
....
);
1 Mark for correct syntax of create table in SQL.
Deduct ½ mark for any syntax error.
SECTION C
(Each question carries 2 marks)
6. What is a constructor? Name different types of constructor in C++. 2
कं र ा है ? C++ म िविभ कार के कं र के नाम िल खए।
Ans Constructor is a special member function with the same name as the class
which is used to initialize the objects of its class.
There are 3 types of constructor in C++
1) Default constructor
2) Parameterized constructor
3) Copy constructor
कं र एक िवशेष मबर फ़ं न है , िजसका नाम ास के नाम पर होता है, और उसका
उपयोग उसकी ास के ऑ े को इिनिशयलाइज़/ आरं भ करने के िलए िकया जाता है ।
C++ म 3 कार के कं र होते ह:
1) िडफ़ॉ कं र
2) पैरामीटराइ ड कं र
3) कॉपी कं र
1 Mark for any correct definition of constructor.
1 Mark for all three type of constructor.
OR
Explain the use of scope resolution operator in C++ programming.
Page 8
C++ ो ािमंग म ोप रे जो ूशन ऑपरे टर के उपयोग की ा ा कर।
Scope resolution operator is used to define the member function and data
member outside of the class i.e. It is used to reference the global variable or
member function that is out of scope.
The operator is represented as the double colon (::) symbol.
For example, when the global and local variable or function has the same name
in a program, and when we call the variable, by default it only accesses the
inner or local variable without calling the global variable. To overcome this
situation, we use the scope resolution operator to fetch a program’s hidden
variables or functions.
ोप रे ज़ो ूशन ऑपरे टर का उपयोग मे र फ़ं न और डे टा मे र को क ा के
बाहर प रभािषत करने के िलए िकया जाता है यानी इसका उपयोग ोबल व रयबल या
मे र फ़ं न को सं दिभत करने के िलए िकया जाता है जो ोप से बाहर ह ।
ऑपरे टर को डबल कोलन (::) से दशाया जाता है ।
उदाहरण : जब िकसी ो ाम म ोबल और लोकल वे रयबल या फ़ं न का एक ही
नाम होता है , और जब हम वे रयबल को कॉल करते ह, तो िडफ़ॉ प से यह ोबल
वे रयबल को कॉल िकए िबना केवल आं त रक या लोकल वे रयबल तक प ं चता है । इस
थित को दू र करने के िलए, हम ो ाम के िछपे ए वे रयबल या फं न को लाने के
िलए ोप रज़ॉ ूशन ऑपरे टर का उपयोग करते ह।
OR/या
Program to show the use of scope resolution operator for a global and local
variable.
#include <iostream>
using namespace std;
int num = 50; // declare global variable
int main ()
{
int num = 100;
cout << " The value of the local variable num: " << num;
// use scope resolution operator (::) to access the global variable
cout << "\n The value of the global variable num: " << ::num;
return 0;
The output of the program with use of scope resolution operator is 50.
But without scope resolution operator it will be 100.
ोप रे ज़ो ू शन ऑपरे टर के उपयोग के साथ ो ाम का आउटपुट 50 है ।
लेिकन ोप रे जो ूशन ऑपरे टर के िबना यह 100 होगा।
1 Mark to explain any correct use of scope resolution operator.
1 Mark to explain with example /programming.
Deduct ½ marks if programming is given without output.
Do not deduct any marks for correct explanation even without programming.
Give full marks attempting the programming example with correct syntax and
output even without theoretical explanation.
Page 9
7. Explain AVG ( ) function, its syntax in SQL with example. 2
AVG ( ) फं न और उसके िसं टै को SQL म उदाहरण सिहत समझाइए।
Ans The AVG ( ) function returns the average value of an expression. It is used to
find out the average of a field/column/attribute in various records. It takes a
column name as its argument.
Syntax of AVG ( )
SELECT AVG(column_name)
FROM table_name;
Example:
SELECT AVG(Price)
FROM Products;
Given that ‘Product’ is the table name and ‘Price’ is it’s one of the column names.
AVG ( ) फ़ं न िकसी ंजक का औसत मान लौटाता है । इसका उपयोग िविभ अिभलेखों म
एक े के औसत का पता लगाने के िलए िकया जाता है । यह एक कॉलम के नाम को इसके
आगुमे के प म लेता है।
AVG ( ) का िसं टे
से ले AVG (कॉलम_नाम)
FROM टे बल_नाम ;
उदाहरण:
SELECT AVG(Price)
FROM Products;
ऊपर दए उदाहरण म ' Products ' टे बल का नाम है और 'price' उसके कॉलम म से एक है ।
1 mark for any correct definition of AVG ( ) function.
½ mark for correct syntax.
½ mark for any correct example of AVG ( ) function.
Deduct ½ marks for any syntax error.
Even if there is a spelling mistake other than syntax, do not deduct any marks if
the concept is understood.
8. How to add hyperlink in a web page using HTML? 2
HTML का उपयोग करके एक वे ब पेज म हाइपरिलंक को कैसे जोड़ सकते ह ?
Ans To add hyperlink in a web page using HTML, we can use the <a> and </a>
tags.
The <a> tag indicates where the hyperlink starts and the </a> tag indicates
where it ends.
Whatever text gets added inside these tags, will work as a hyperlink.
Syntax for adding hyperlink: Put URL in <a href= ” ”> </a> .
For eg.
Page 10
<a href="www.google.com"></a>
HTML का उपयोग करके िकसी वेब पेज म हाइपरिलंक जोड़ने के िलए हम <a> और </a> टै ग
का उपयोग कर सकते ह।
<a> टै ग बताता है िक हाइपरिलंक कहां से शु होता है और </a> टै ग बताता है िक यह कहां
समा होता है ।
इन टै के अंदर जो भी टे जोड़ा जाएगा, वह हाइपरिलंक के प म काम करे गा।
हाइपरिलंक के िलए िसं टे <a href=""> म िलंक के िलए कोई भी URL जोड़।
उदाहरण:
<a href="www.google.com"></a>
1 Mark for correct syntax of <a> </a> tag.
½ mark for correct explanation to add the hyperlink.
½ mark for any correct example to add hyperlink.
Deduct ½ marks for any syntax error.
Do not deduct any marks for not giving any example provided that syntax and
explanation is adequate.
9. Ranjana has to work on her science project which deals with electromagnetic 2
waves. A lot of research work is required by her for the same. She uses Google
Chrome to search for the relevant matter.(Give answer based on the above
information) 2
I. Google Chrome is an example of a
a. Website
b. Web browser
c. Web Page
d. None
II. She finally locates some useful information and clicks on the link
provided to access the website. The link is actually known as
a_____________.
a. Domain name
b. Web Page
c. URL
d. IP address
रं जना को अपनी िव ान प रयोजना पर काम करना है जो िवद् युत चु कीय तरं गों से संबंिधत है । उसके
िलए ब त सारे शोध काय की आव कता है । वह ासंिगक मामले की खोज के िलए Google Chrome
का उपयोग करती है । (उपरो जानकारी के आधार पर उ र द)
I. गू गल ोम इसका एक उदाहरण है
a) वे बसाइट
b) वे ब ाउज़र
c) वे ब पृ
d) कोई नहीं
II. अंत म वह कुछ उपयोगी जानकारी ढू ं ढती है और वे बसाइट तक प ंचने के िलए िदए गए िलं क
पर क करती है । िलं क को वा व म _____________ के प म जाना जाता है।
a) डोमेन नाम
b) वे ब पृ
c) URL
d) IP पता
Ans I. b) Web browser b) वेब ाउज़र
II. c) URL c) URL
Page 11
1 mark for any one correct identification.
2 marks for both correct identifications.
Do not deduct any marks for any spelling mistakes if option name is correctly
written.
10. A School in Haryana uses DBMS to store student details. The school maintains a 2
database 'school_record' under which there are two tables.
StudentTable: Maintains general details about every student enrolled in school.
StuLibrary Table: To store details of issued books.
BookID is the unique identification number issued to each book.
Minimum issue duration of a book is one Day.
ह रयाणा म एक ू ल छा िववरण सं हीत करने के िलए DBMS का उपयोग करता है । ू ल एक
डे टाबेस ' ू ल_ रकॉड' रखता है िजसके तहत दो टे बल ह।
StudentTable: ू ल म नामां िकत े क छा के बारे म सामा िववरण रखता है ।
StuLibrary Table: जारी की गई पु कों के िववरण को ोर करने के िलए।
BookID े क पु क को जारी की जाने वाली िविश पहचान सं ा है ।
एक पु क की ू नतम जारी करने की अविध एक िदन है।
I. The Primary Key for StuLibrary Table is/are …….
StuLibrary टे बल के िलए ाइमरी कुंजी है/ह।
a) BookID
b) BookID,StuID
c) BookID,Issued_date
d) Issued_date
II. The Alternate Key for Student Table will be ……….
Student टे बल के िलए वैक क कुंजी ……… होगी।
a) StuName
b) StuContact
c) StuAadhar
d) StuClass
I. b) BookID,StuID
II. c) StuAadhar
1 mark for any one correct identification.
2 marks for both correct identifications.
Do not deduct any marks for any spelling mistakes if option name/alphabet is
correctly written.
Page 12
SECTION D
(Each question carries 4 Mark)
What is Stack in Data Structure? Write an algorithm to insert an element in a 4
stack.
11. डे टा रम ैक ा है? एक ै क म एक एिलमट डालने के िलए एक ए ो रथम िलख।
Stack is a linear type of data structure that follows the LIFO (Last-In-First-Out)
Ans principle and allows insertion and deletion operations from one end that is ‘top’
Real-life examples of a stack are a deck of cards, stack of books etc.
Push Operation in Stack: Inserting a new element in the stack is termed a
push operation.
Pop Operation in Stack: Removing or deleting elements from the stack is
termed pop operation.
ै क एक लीिनयर कार की डे टा र है जो LIFO (ला -इन-फ -आउट) िस ां त का
पालन करती है और एक ए से एिलमट को जोड़ने और िडलीट करने की अनु मित दे ती है
िजसे 'टॉप' कहते ह ै क के वा िवक जीवन के उदाहरण ताश के प ों का डे क, िकताबों का
ै क आिद है
ै क म PUSH ऑपरे शन: ै क म एक नया एिलमट डालने को पुश ऑपरे शन कहा जाता है।
ै क म POP ऑपरे शन: ै क से एिलमट को हटाने या हटाने को पॉप ऑपरे शन कहा जाता है ।
Push Operation algorithm:
Push operation includes various steps, which are as follows :
Step 1: First, check whether the stack is full or not
Step 2: If the stack is full, then exit
Step 3: If not, increment top by one
Step 4: Insert a new element where the top is pointing
Step 5: Exit
पुश ऑपरे शन ए ो रदम:
पुश ऑपरे शन म िविभ चरण शािमल ह, जो इस कार ह:
चरण 1: सबसे पहले, जां च िक ै क भरा आ है या नही ं
े प 2: अगर ै क फुल हो गया है, तो exit कर
चरण 3: यिद नही ं, तोटॉप म एक की वृ कर
चरण 4: एक नया एिलमट डाल जहां TOP पॉइं ट कर रहा है
चरण 5: बाहर िनकल
OR / या
begin procedure push: stack, data
if stack is full
return null
endif
top ← top + 1
stack[top] ← data
Page 13
end procedure
Example: Given below is the Push and Pop operation in a stack where
operations are titled with count 1 to 10 with initial value in stack top =1. From
1 to 5 there are a Push operations of elements 2,3,4,5,6 and after that from 6 to
10 there are Pop operations of elements 6,5,4,3,2 .
उदाहरण: नीचे एक ै क म पुश और पॉप ऑपरे शन िदया गया है जहां ऑपरे शन का शीषक 1
से 10 की िगनती के साथ ै क टॉप = 1 म ारं िभक मान के साथ है । 1 से 5 तक 2,3,4,5,6
त ों का पुश ऑपरे शन होता है और उसके बाद 6 से 10 तक 6,5,4,3,2 त ों का पॉप
ऑपरे शन होता है।
1 Mark for any correct definition of Stack in data structure.
1 Mark for explaining Push and Pop Operation in stack with/without diagram.
2 Marks for any correct algorithm of Push operation in stack with/without
example.
Consider LIFO and FILO both as correct.
Deduct ½ marks if there is any syntax error while writing algorithm.
OR
What is sorting? Explain Selection Sort in detail with example.
सॉिटग ा है? िसले न सॉट को उदाहरण सिहत िव ार से समझाइए।
Sorting is the process of arranging elements either in ascending (or) descending
order.
OR
Sorting is the process of arranging data into meaningful order so that you can
analyze it more effectively.
OR
Sorting is the process of arranging the elements of an array so that they can be
placed either in ascending or descending order.
सॉिटग एिलमट को या तो आरोही (या) अवरोही म म व थत करने की ि या है।
या
सॉिटग डे टा को साथक म म व थत करने की ि या है तािक आप इसका अिधक भावी
ढं ग से िव ेषण कर सक।
या
सॉिटग एक सारणी के त ों को व थत करने की ि या है तािक उ आरोही या अवरोही
म म रखा जा सके।
Page 14
Selection sort:
It is a simple and efficient sorting algorithm that works by repeatedly
selecting the smallest (or largest) element from the unsorted portion of
the list and moving it to the sorted portion of the list.
The algorithm repeatedly selects the smallest (or largest) element from
the unsorted portion of the list and swaps it with the first element of the
unsorted portion.
This process is repeated for the remaining unsorted portion of the list
until the entire list is sorted.
Let us consider the following array as an example: {64, 25, 12, 22, 11}
First pass:
For the first position in the sorted array, the whole array is traversed from index
0 to 4 sequentially. The first position where 64 is stored presently, after
traversing whole array it is clear that 11 is the lowest value.
64 25 12 22 11
Thus, replace 64 with 11. After one iteration 11, which happens to be the least
value in the array, tends to appear in the first position of the sorted list.
11 25 12 22 64
Second Pass:
For the second position, where 25 is present, again traverse the rest of the array
in a sequential manner.
11 25 12 22 64
After traversing, we found that 12 is the second lowest value in the array and it
should appear at the second place in the array, thus swap these values.
11 12 25 22 64
Third Pass:
Now, for third place, where 25 is present again traverse the rest of the array and
find the third least value present in the array.
11 12 25 22 64
While traversing, 22 came out to be the third least value and it should appear at
the third place in the array, thus swap 22 with element present at third position.
11 12 22 25 64
Fourth pass:
Similarly, for fourth position traverse the rest of the array and find the fourth
least element in the array
As 25 is the 4th lowest value hence, it will place at the fourth position.
Page 15
11 12 22 25 64
Fifth Pass:
At last the largest value present in the array automatically get placed at the last
position in the array
The resulted array is the sorted array.
11 12 22 25 64
िसले न सोिटग :
• यह एक सरल और कुशल सॉिटग ए ो रथम है जो सूची के अनसोटड िह े से बार-बार
सबसे छोटे (या सबसे बड़े ) त का चयन करके और इसे सूची के सॉट िकए गए िह े म ले
जाकर काम करता है ।
• ए ो र म बार-बार सू ची के अ ोटद भाग से सबसे छोटे (या सबसे बड़े ) एिलमट का चयन
करता है और इसे अ ोटद भाग के पहले त से ैप करता है।
• यह ि या सूची के शेष अ ोटद भाग के िलए तब तक दोहराई जाती है जब तक िक पू री
सूची को मब नही ं कर िदया जाता।
आइए िन िल खत सरणी को एक उदाहरण के प म दे ख: {64, 25, 12, 22, 11}
पहला पास:
मब सरणी म पहली थित के िलए, पूरे सरणी को अनु िमक प से इं डे 0 से 4 तक
टे स िकया जाता है। पहली थित जहां 64 वतमान म सं हीत है, पूरे सरणी को पार करने के
बाद यह है िक 11 सबसे कम मू है।
64 25 12 22 11
इस कार, 64 को 11 से बदल। एक पुनरावृ ि 11 के बाद, जो िक सरणी म सबसे कम मान
होता है, मब सूची की पहली थित म िदखाई दे ता है।
11 25 12 22 64
दू सरा पास:
दू सरी थित के िलए, जहां 25 मौजूद है, िफर से शेष सरणी को अनु िमक तरीके से पार कर।
11 25 12 22 64
टै वस करने के बाद, हमने पाया िक 12 सरणी म दू सरा सबसे कम मान है और इसे सरणी म
दू सरे थान पर िदखाई दे ना चािहए, इस कार इन मानों को ैप कर।
11 12 25 22 64
तीसरा पास:
अब, तीसरे थान के िलए, जहां 25 मौजूद है, िफर से बाकी सरणी को पार कर और सरणी म
मौजूद तीसरा सबसे कम मान खोज।
Page 16
11 12 25 22 64
टै विसग करते समय, 22 तीसरा सबसे कम मू िनकला और यह सरणी म तीसरे थान पर
िदखाई दे ना चािहए, इस कार 22 को तीसरे थान पर मौजूद त के साथ ैप कर।
11 12 22 25 64
चौथा पास:
इसी कार, चौथे थान के िलए शेष सरणी को पार कर और सरणी म चौथा सबसे छोटा त
खोज
चूंिक 25 चौथा सबसे कम मान है, इसिलए इसे चौथे थान पर रखा जाएगा।
11 12 22 25 64
पां चवां पास:
अं त म सरणी म मौजूद सबसे बड़ा मान चािलत प से सरणी म अं ितम थान पर आ जाता
है
प रणामी सरणी मब सरणी है ।
11 12 22 25 64
1 Mark for any correct definition of sorting in data structure.
1 mark for any correct definition of selection sort.
2 marks for correctly explaining the concept of selection sort with example.
12. What is Software Engineering? Explain different phases of SDLC. 4
सॉ वेर इं जीिनय रं ग ा है ? SDLC के िविभ चरणों की ा ा कर।
Software Engineering is the branch of Engineering which uses engineering
principles and techniques to develop Software.
Different phases of SDLC are as follows:
1) Requirements gathering and analysis or Survey
2) Feasibility study or Investigation and Fact Recording
3) Software design
4) Development or Coding
5) Testing
6) Implementation
7) Maintenance
Requirements gathering and analysis or Survey: First phase of SDLC is to
collect the requirements from customer. Survey is the part of Requirement
gathering phase of SDLC. Survey is the best technique to collect the
requirements. We can do survey with following techniques:
1. Interviews
2. Questionnaires
3. Observation
Page 17
4. Sampling
Feasibility study or Investigation and fact recording: It is a part of
Requirement analysis phase of SDLC. All the requirements collected through
surveys are investigated in this part. Feasibility study means to check if it is
possible to make the software or not. After investigation of the requirements,
final facts are recorded for analysis.
Software Design: The next stage of SDLC is the Design phase. During
the design phase, developers and technical architects start the high-
level design of the software and system to be able to deliver each requirement.
Development or Coding
This phase of SDLC comes when we have gathered the requirements and when
our design is ready. The software developer starts coding according to the
requirements and the design.
Testing
Testing is done before the software is delivered to customers so that the
software exactly matches their requirements. Testers usually find errors or bugs
in the software in this phase. There are two types of testing methods:
1. Black Box testing: The technique of testing without having any knowledge
of the interior workings of the software is called black-box testing. The tester
cannot see the code but only can use the software to find any bugs or errors.
2. White Box testing: White-box testing is the detailed investigation of internal
workings of the code. White-box testing is also called glass testing or open-box
testing. In order to perform white-box testing on an application, a tester needs
to know the internal workings of the code.
Implementation
In this phase, the system is installed to support the required function for which
it is developed. It includes user notification, user training, installation of
hardware, installation of software onto production computers, and integration
of the system into daily work processes. This phase continues until the system
is operating in production in accordance with the defined user requirements.
Maintenance
The maintenance phase of the SDLC occurs after we have delivered the
software to the customers. Maintenance of software can include software
upgrades or any error or bug fixing which the customer finds.
सॉ वेयर इं जीिनय रं ग इं जीिनय रं ग की वह शाखा है जो सॉ वेयर िवकिसत करने के िलए
इं जीिनय रं ग िस ां तों और तकनीकों का उपयोग करती है।
SDLC के िविभ चरण इस कार ह:
1) आव कताएँ एक करना और िव ेषण या सव
2) िफिजिबिलटी अ यन या जां च और फै रकॉिडग
Page 18
3) सॉ वेयर िडजाइन
4) डे वलपमट या कोिडं ग
5) टे ं ग
6) इ ीमटे शन
7) मटे नस
आव कताएं एक करना और िव ेषण या सव
SDLC का पहला चरण ाहक से आव कताओं को एक करना है । सव SDLC की
आव कता सं ह चरण का िह ा है। आव कताओं को एक करने के िलए सव सबसे
अ ी तकनीक है । हम िन िल खत तकनीकों से सव कर सकते ह:
1. सा ा ार
2. ावली
3. ऑ रवे शन
4. सै िलंग
िफिजिबिलटी अ यन या जां च और फै रकॉिडग
यह SDLC की आव कता िव ेषण चरण का एक िह ा है । इस भाग म सव के मा म से
एक की गई सभी आव कताओं की जांच की जाती है। िफिजिबिलटी अ यन का अथ यह
जां चना है िक सॉ वेयर बनाना संभव है या नही।ं आव कताओं की जांच के बाद, िव ेषण
के िलए अं ितम त दज िकए जाते ह।
सॉ वे यर िडजाइन
एसडीएलसी का अगला चरण िडजाइन चरण है । िडजाइन चरण के दौरान, डे वलपस और
तकनीकी आिकटे ेक आव कता को पूरा करने म स म होने के िलए सॉ वेयर और
िस म का उ - रीय िडज़ाइन शु करते ह।
डे वलपमट या कोिडं ग
SDLC का यह चरण तब आता है जब हम आव कताओं को इक ा कर लेते ह और जब
हमारा िडज़ाइन तैयार हो जाता है। सॉ वेयर डे वलपर आव कताओं और िडजाइन के
अनुसार कोिडं ग शु करता है।
टे ंग
सॉ टवेयर को ाहकों तक प ँ चाने से पहले टे ं ग िकया जाता है तािक सॉ टवेयर उनकी
आव कताओं से िब ु ल मेल खाता हो। परी क आमतौर पर इस चरण म सॉ टवेयर म
ु िटयां या बग ढू ं ढते ह। टे ं ग िविधयाँ दो कार की होती ह:
1. ै क बॉ टे ं ग: सॉ वेयर की आं त रक काय णाली के ान के िबना टे
ं ग की
तकनीक को ैक-बॉ टे ं ग कहा जाता है । परी क कोड नहीं दे ख सकता है लेिकन
केवल बग या ुिटयों को खोजने के िलए सॉ टवेयर का उपयोग कर सकता है ।
2. ाइट बॉ टे ं ग: ाइट-बॉ टे ं ग कोड की आं त रक काय णाली की िव ृत
जां च है। ाइट-बॉ टे ं ग को ास टे ं ग या ओपन-बॉ टे ं ग भी कहा जाता है ।
िकसी ए केशन पर ाइट-बॉ टे ं ग करने के िलए, एक परी क को कोड की आं त रक
काय णाली को जानने की आव कता होती है।
इ ीमटे शन
इस चरण म, िस म को आव क फ़ं न का समथन करने के िलए थािपत िकया गया है
िजसके िलए इसे िवकिसत िकया गया है। इसम उपयोगकता अिधसूचना, उपयोगकता िश ण,
हाडवे यर की थापना, उ ादन कं ूटर पर सॉ टवेयर की थापना और दै िनक काय ि याओं
म िस म का एकीकरण शािमल है । यह चरण तब तक जारी रहता है जब तक िस म
प रभािषत उपयोगकता आव कताओं के अनुसार उ ादन म काम नही ं कर रहा है।
मटे नस
एसडीएलसी का रखरखाव चरण हमारे ारा ाहकों को सॉ वेयर िवत रत करने के बाद होता
Page 19
है । सॉ टवेयर के रखरखाव म सॉ टवेयर अप ेड या कोई ुिट या बग िफ ंग शािमल हो
सकती है जो ाहक को िमलती है ।
½ marks for any correct definition of software engineering
½ marks for full form of SDLC.
1 mark for writing correct SDLC phases.
2 marks for correct explanation of all the phases of SDLC.
Deduct ½ marks for wrong sequence of SDLC phases.
Ignore any spelling mistakes in Hindi as well as in English if the meaning of
the word is understood.
Do not deduct any marks if the English version of the word is written in Hindi.
i.e. consider Software or सॉ वेयर both as correct.
OR
What is software testing? Explain different levels of software testing.
सॉ वेयर टे ंग ा है? सॉ वेयर टे ं ग के िविभ रों की ा ा कीिजए।
Software testing: It is the process of evaluating and verifying that a software
does what it is supposed to do.
There are four main stages of testing
1) Unit testing
2) Integration testing
3) System testing
4) Acceptance testing.
Unit Testing
Unit testing is testing the smallest testable unit of software. It is done during the
coding phase by the developers. To perform unit testing, a developer writes a
piece of code (unit tests) to verify the code is correct.
Integration Testing
Integration testing is the second level of the software testing process comes
after unit testing. In this testing, units or individual components of the software
are tested in a group. The focus of the integration testing level is to expose
defects at the time of interaction between integrated components or units.
Integration testing can be carried out by two different approaches:
o Top-Down approach: Testing higher level modules to lower level
modules
o Bottom-Up approach: Testing lower level modules to higher level
modules
System Testing
System testing is the first level in which the complete application is tested as a
whole. The goal at this level is to check whether the system is working as per
the requirements. System Testing is very important because it verifies that the
software meets the technical and functional requirements that were set by the
customer.
Acceptance Testing
The final level, Acceptance testing (or User Acceptance Testing), is conducted
to check whether the system is ready for release. During this final phase, the
user will test the system to find out whether the application meets their needs.
सॉ वे यर टे ं ग/टे ं ग: यह मू ांकन और स ापन करने की ि या है िक एक
Page 20
सॉ वेयर वह करता है जो उसे करना चािहए।
टे ं ग के चार मु चरण ह
1) यूिनट टे ं ग
2) एकीकरण/इं टी ेशन टे ं ग
3) िस म टे ं ग
4) ीकृित/ ऐ े टे ं ग
यू िनट टे ं ग/टे ंग
यह प र ण सॉ वेयर की सबसे छोटी टे ं ग यो इकाई का टे ं ग करता है। यह डे वलपस
ारा कोिडं ग चरण के दौरान िकया जाता है। यू िनट टे ं ग करने के िलए, कोड सही है यह
स ािपत करने के िलए एक डे वलपर कोड का एक टु कड़ा (यू िनट टे ं ग) िलखता है।
एकीकरण/इं टी ेशन टे ंग
एकीकरण टे ं ग सॉ वेयर टे ं ग ि या का दू सरा र है जो इकाई टे ं ग के बाद आता
है । इस टे ं ग म, सॉ वेयर की इकाइयों या गत घटकों का एक समू ह म टे ं ग िकया
जाता है। एकीकरण टे ं ग र का ान एकीकृत घटकों या इकाइयों के बीच बातचीत के
समय दोषों को उजागर करना है।
एकीकरण टे ं ग दो अलग-अलग तरीकों से िकया जा सकता है:
टॉप-डाउन अ ोच: िन र के मॉ ूल के िलए उ रीय मॉ ूल का टे ं ग
करना
बॉटम-अप अ ोच: िनचले र के मॉ ूल से उ र के मॉ ूल का टे ं ग
िस म टे ंग
िस म टे ं ग पहला र है िजसम संपूण ए केशन का सम प से टे ं ग िकया जाता है ।
इस र पर ल यह जांचना है िक िस म आव कताओं के अनु सार काम कर रहा है या
नहीं। िस म टे ं ग ब त मह पूण है ोंिक यह स ािपत करता है िक सॉ वेयर ाहक
ारा िनधा रत तकनीकी और काया क आव कताओं को पूरा करता है।
ीकृित/ ऐ े टे ंग
यह अंितम र है, ीकृित टे ं ग (या उपयोगकता ीकृित टे ं ग), यह जां चने के िलए
आयोिजत िकया जाता है िक िस म रलीज के िलए तैयार है या नहीं। इस अं ितम चरण के
दौरान, उपयोगकता यह पता लगाने के िलए िस म का टे ं ग करे गा िक ए केशन उनकी
आव कताओं को पूरा करता है या नही।ं
½ marks for any correct definition of software testing.
1 mark for naming all the levels of testing.
2 marks for correct explanation of all level of testing.
Deduct ½ marks for wrong sequence of levels of testing.
Ignore any spelling mistakes in Hindi as well as in English if the meaning of
the word is understood.
Do not deduct any marks if the English version of the word is written in Hindi.
i.e. consider Testing or टे ं ग both as correct.
13. What is a computer network? Why do we need networking in computers? 4
Explain different types of computer networks.
कं ूटर ने टवक ा है? हम कं ूटर म ने टविकग की आव कता ों है ? क ूटर ने टवक
के िविभ कारों को समझाइए।
Computer Network: When two or more computers or devices are
connected to each other to communicate and share resources then it is
Page 21
called a computer network.
network It is a system in which multiple
/computing devices/nodes/peripheral devices are connected to
computers/computing
each other to share information and resources.
Need of Networking: We need networking in computer
omputers to share
resources such as Data files, Network connections and peripheral devices
like printer, scanner etc.
Types of computer network are:
(LAN): The computer network that links
1. Local area Network (LAN):
devices within a building or group of adjacent buildings,
especially one with a radius of less than 1 km.
2. Metropolitan area Network (MAN): The computer network that
connects computers in a metropolitan area,
area, such as a large city or a
university.
3. Wide area Network (WAN): The computer uter network that covers
a large geographical area comprising a region, a country, a
continent or even the whole world.
कं ूटर ने टवक: जब दो या दो से अिधक कं ूटर या िडवाइस संचार और संसाधनों को साझा
करने के िलए एक दू सरे से जुड़े होते ह तो इसे कं ूटर ने टवक कहा जाता है। यह एक ऐसी
णाली है िजसम सूचना और संसाधनों को साझा करने के िलए कई कं ूटरर/कं ूिटं ग
िडवाइस/नोड् स/पे
पे रफेरल िडवा
िडवाइस एक दू सरे से जुड़े होते ह।
कता हम डे टा फ़ाइलों, नेटवक कने न और ि ंटर,
नेटविकग की आव कता: र ै नर इ ािद जैसे
प रधीय उपकरणों/ पे रफेरल िडवाइस जैसे सं साधनों को साझा करने के िलए कं ूटर म
ने टविकग की आव कता होती है ।
कं ूटर ने टवक के कार
1. लोकल ए रया नेटवक (LAN): कं ूटर ने टवक जो एक इमारत या आस
आस-पास की इमारतों के
समू ह के भीतर उपकरणों को जोड़ता है, िवशेष प से 1 िकमी से कम के दायरे के साथ।
2. मे टोपॉिलटन ए रया नेटवक (MAN): कं ूटर ने टवक जो एक महानगरीय े म कं ूटरों
को जोड़ता है, जैसे िक एक बड़ा शहर या एक िव िव ालय।
वाइड ए रया नेटवक (WAN): कं ूटर ने टवक जो एक े , एक दे श, एक महा ीप या यहां
3.वाइड
तक िक पूरी दु िनया के एक बड़े भौगोिलक े को कवर करता है।
कं ूटर नेटवक
के कार
½ mark for any correct definition of computer network.
½ mark for any correct need of computer networking
1 mark for writing names with full forms of the 3 computer network types.
types
2 marks for explaining all three network types.
Page 22
Do not deduct any marks for including any other type of network after
including these three.
Deduct ½ marks for writing incorrect full forms.
OR
Explain each:
i. HTTP ii.URL
iii.FTP iv.WWW
ेक की ा ा कर:
i. HTTP ii.URL
iii.FTP iv.WWW
Ans i. HTTP (Hypertext Transfer Protocol) is the set of rules for
transferring files such as text, images, sound, video and other
multimedia files over the web. As soon as a user opens their
web browser, they are indirectly using HTTP. HTTP is an
application protocol that runs on top of the TCP/IP suite of
protocols, which forms the foundation of the internet.
ii. URL (Uniform Resource Locator) is a unique identifier used to
locate a resource on the Internet. Every webpage on internet have
unique address to help people locate it. It is also referred to as a web
address. URLs consist of multiple parts i.e. including a protocol and
domain name.
iii. FTP (File Transfer Protocol): FTP is a standard internet protocol
provided by TCP/IP used for transmitting the files from one host to
another. It is mainly used for transferring the web page from servers
to other computers on the internet. It is also used for downloading
the files to computer from other servers.
iv. WWW (World Wide Web): It is a collection of documents and
other web resources which are identified by URLs and can be
accessed and searched by web browsers via the Internet. WWW is
also called the Web and it was invented by Tim Berners-Lee in
1989. All the web pages can be viewed only with the help of web
browser.
i. HTTP (हाइपरटे टां सफर ोटोकॉल) वेब पर टे , इमेज, िन, वीिडयो और
अ म ीमीिडया फ़ाइलों जैसी फ़ाइलों को थानांत रत करने के िनयमों का से ट
है । जैसे ही कोई उपयोगकता अपना वेब ाउज़र खोलता है, वे अ प से
HTTP का उपयोग कर रहे होते ह। HTTP एक ए केशन ोटोकॉल है जो
ोटोकॉल के टीसीपी/आईपी सू ट के शीष पर चलता है, जो इं टरनेट की नींव
बनाता है।
ii. URL (यू िनफ़ॉम रसोस लोकेटर) एक िविश पहचानकता है िजसका उपयोग
Page 23
इं टरने ट पर िकसी सं साधन का पता लगाने के िलए िकया जाता है । इं टरने ट पर हर
वे बपेज का अपना िविश पता होता है िजससे लोगों को उसका पता लगाने म
मदद िमलती है। इसे वेब एडे स भी कहा जाता है। URL म कई भाग होते ह: एक
ोटोकॉल और डोमेन नाम सिहत।
iii. FTP (फाइल टां सफर ोटोकॉल): एफ़टीपी एक मानक इं टरने ट ोटोकॉल है जो
टीसीपी/आईपी ारा दान िकया जाता है िजसका उपयोग फाइलों को एक हो
से दू सरे म थानां त रत करने के िलए िकया जाता है। यह मु प से वेब पेज
को सवर से इं टरने ट पर अ कं ूटरों म थानां त रत करने के िलए उपयोग िकया
जाता है। इसका उपयोग अ सवरों से कं ूटर म फाइल डाउनलोड करने के
िलए भी िकया जाता है ।
iv. WWW (व वाइड वेब): यह द ावेजों और अ वेब संसाधनों का एक सं ह है
जो URL ारा पहचाने जाते ह और इं टरने ट के मा म से वेब ाउज़र ारा ए ेस
और खोजे जा सकते ह। WWW को वेब भी कहा जाता है और इसका आिव ार
िटम बनस-ली ने 1989 म िकया था। सभी वे ब पेजों को केवल वे ब ाउज़र की
मदद से ही दे खा जा सकता है ।
½ marks for full form of HTTP without spelling mistake
½ marks for any correct explanation of HTTP
½ marks for full form of URL without spelling mistake
½ marks for any correct explanation of URL
½ marks for full form of FTP without spelling mistake
½ marks for any correct explanation of FTP
½ marks for full form of FTP without spelling mistake
½ marks for any correct explanation of WWW
14. Define Inheritance in C++. Explain any 3 types of inheritance. 4
C++ म इनहे रटस को प रभािषत कीिजये I इनहे रटस के िक ी 3 कारों को समझाइए I
Ans Inheritance is the ability of a class to inherit all the properties and
characteristics of another class. The class that inherits the properties from
another class is known as child or derived class. The class from which the
properties is being derived and inherited is known as the parent or base class.
Derived class can inherit data members, member functions of the base class.
Real life example of Inheritance: A child inherits properties and characteristics
from his/her parents, like, color, height, weight etc.
There are 5 types of inheritances which are:
1) Single Inheritance
2) Multiple Inheritance
3) Multi level Inheritance
4) Hierarchal Inheritance
5) Hybrid Inheritance
इनहे रटस एक ास की अ ास के सभी गुणों और िवशेषताओं को ा करने की मता
है । वह ास जो िकसी अ ास से गुण ा करती है, उसे चाइ या डीराई ड ास के
प म जाना जाता है । िजस ास से गुण ा िकए जा रहे ह और िवरासत म िमले ह, उ
पैरट या बेस ास के प म जाना जाता है । चाइ ास डे टा सद ों, बेस ास के
Page 24
मे रऔर फं न को ा कर सकता है ।
इनहे रटस का वा िवक जीवन उदाहरण: एक ब े को अपने माता-िपता से गुण और
िवशेषताएं िवरासत म िमलती ह, जैसे रं ग, ऊंचाई, वजन आिद।
इनहे रटस 5 कार के होते ह जो इस कार ह:
1) िसं गल िवरासत
2) म ीपल इनहे रटस
3) म ी लेवल इनहे रटस
4) िहरा रकल इनहे रटस
5) हाइि ड इनहे रटस
Single Inheritance: In this inheritance, a single class inherits the properties of
a base class. All the data members of the base class are accessed by the derived
class according to the visibility mode (i.e., private, protected, and public).
िसं गल इनहे रटस: इस इनहे रटस म, एक िसं गल ास बेस ास के गुणों को ा करता है ।
बेस ास के सभी डे टा सद ों को िविसिबिलटी मोड (यानी ाइवे ट, ोटे े ड और प क)
के अनु सार डीराई ड ास ारा ए ेस िकया जाता है ।
Multiple Inheritance: The inheritance in which a class can inherit or derive
the characteristics of multiple classes, or a derived class can have over one base
class, is known as Multiple Inheritance. The derived class can derive the joint
features of all these classes and the data members of all the base classes.
म ीपल इनहे रटस: वह इनहे रटस िजसम एक ास कई ास की िवशेषताओं को ा
कर सकती है, या एक डीराई ड ास म एक से अिधक बेस ास हो सकती ह, म ीपल
इनहे रटस के प म जानी जाती है । डीराई ड ास इन सभी ास की संयु िवशेषताओं
और सभी बेस ास के डे टा सद ों को ा कर सकती है ।
Multilevel Inheritance: The inheritance in which a class can be derived from
another derived class is known as Multilevel Inheritance. Suppose there are
three classes A, B, and C. B is the base class that is derived from class A. Now,
C is the class that is derived from class B. This makes class B, the base class for
class C but is the derived class of class A. This scenario is known as the
Multilevel Inheritance.
Page 25
म ीले वल इनहे रटस: वह इनहे रटस िजसम एक ास िकसी अ डीराई ड ास से ा
की जा सकती है, म ी ले वल इनहे रटस के प म जानी जाती है । मान लीिजए िक तीन ास
A, B और C ह। B एक ास है जो ास A से ा होती है। अब, C वह ास है जो ास
B से ा होती है। ास B, ासC के िलए बेस ास है ले िकन ास A की डीराई ड
ास है। इसे म ीलेवल इनहे रटस के प म जाना जाता है।
Hierarchical Inheritance: The inheritance in which a single base class inherits
multiple derived classes is known as the Hierarchical Inheritance. This
inheritance has a tree-like structure since every class act as a base class for one
or more child classes.
िहरा रकल इनहे रटस: वह इनहे रटस िजसम एक िसं गल बेस ास कई डीराई ड ास से
गुणों को ा करती है, उसे िहरा रकल इनहे रटस कहा जाता है। इस इनहे रटस म एक पेड़
जैसी संरचना होती है ोंिक ेक ास एक या अिधक ास के िलए बेस ास के पम
काय करती है।
Hybrid Inheritance: As the name suggests, is the combination of two or more
types of inheritances. For example, the classes in a program are in such an
arrangement that they show both single inheritance and hierarchical inheritance
at the same time. Such an arrangement is known as the Hybrid Inheritance.
हाइि ड इनहे रटस: जैसा िक नाम से पता चलता है, दो या अिधक कार की इनहे रटस का
संयोजन है । उदाहरण के िलए, एक ो ाम म ास ऐसी व था म ह िक वे एक ही समय म
िसं गल इनहे रटस और म ीपल इनहे रटस दोनों िदखाते ह। ऐसी व था को हाइि ड
इनहे रटस के प म जाना जाता है ।
1 Mark for correctly defining Inheritance concept.
Page 26
1mark for writing names of any 3 types of inheritances.
2 marks for explaining any 3 type of inheritances.
Do not deduct any marks for not drawing diagrams.
Give 1 mark for only making correct diagrams.
OR
Write a C++ program to define a class employee having
Emp-id
Members Emp-name
basic salary
accept()
Functions display()
Calculate DA=25% of basic salary, HRA=800, I-tax=15% of basic salary.
Display the payslip using appropriate output format.
ास employee को िडफाइन करने के िलए एक C++ ो ाम िल खए िजसमे
Member Emp-id
मे र Emp-name
basic salary
Function accept()
फं न display()
DA = बेिसक पे का 25%, HRA = 800, I-टै = बेिसक पे का 15% की गणना कर।
उपयु आउटपुट प का उपयोग करके पे प दिशत कर।
Following program is defining a class Employee and calculating DA, HRA, tax
of his/her basic salary and also displaying the payslip of an employee.
िन िल खत ो ाम एक ास Employee को िडफाइन कर रहा है और DA, HRA उसके
बे िसक वेतन पर tax की गणना कर रहा है और एक कमचारी की payslip को भी दिशत कर
रहा है ।
#include<iostream>
using namespace std;
class Employee
{
int eid;
char ename[100];
float basic_salary, hra, da, i_tax, net_salary;
public:
void accept_details()
{
cout<<"\n Enter Employee Id : ";
cin>>eid;
cout<<"\n Enter Employee Name : ";
cin>>ename;
cout<<"\n Enter Basic Salary : ";
cin>>basic_salary;
Page 27
hra = 800;
da = 0.25 * basic_salary;
i_tax = 0.15 * basic_salary;
net_salary = basic_salary + da + hra - i_tax;
}
void display_details()
{
cout<<"\n ----------------------- ";
cout<<"\n Employee Id : "<<eid;
cout<<"\n Employee Name : "<<ename;
cout<<"\n Basic Salary : "<<basic_salary;
cout<<"\n HRA : "<<hra;
cout<<"\n DA : "<<da;
cout<<"\n I-Tax : "<<i_tax;
cout<<"\n Net Salary : "<<net_salary;
}
};
int main()
{
Employee e;
e.accept_details();
e.display_details();
return 0;
}
Output of the above c++ program:
उपरो c++ ो ाम का आउटपुट:
Enter Employee Id : 1001
Enter Employee Name : xyz
Enter Basic Salary : 45000
-----------------------
Employee Id : 1001
Employee Name : xyz
Basic Salary : 45000
HRA : 800
DA : 11250
I-Tax : 6750
Net Salary : 50300
½ marks for correct header file inclusion.
½ marks for defining class employee.
½ marks for declaring class variables/members.
½ marks for defining accept_details() function.
½ marks for defining display_details() function.
½ marks for defining main() function.
½ marks for creating object in main function.
½ marks for correct output of the program.
Do not deduct any marks for case sensitivity issue (if any).
Do not deduct any marks for spelling mistakes in variable names.