Save as PDF

Opens your browser print dialog — select "Save as PDF" to download.

Total No. of Questions : 8
Total No. of Printed Pages : 6
Roll No. ........................
IT-304 (GS)
B.Tech., III Semester
Examination, November 2022
Grading System (GS)
Object Oriented Programming and Methodology
Time: Three Hours
Maximum Marks : 70
Note: i) Attempt any five questions.

किन्हीं पाँच प्रश्नों को हल कीजिए।

ii) All questions carry equal marks.

सभी प्रश्नों के समान अंक हैं।

iii) In case of any doubt or dispute the English version question should be treated as final.

किसी भी प्रकार के संदेह अथवा विवाद की स्थिति में अंग्रेजी भाषा के प्रश्न को अंतिम माना जावेगा।

1.
a)
What is inheritance? What is the importance of inheritance? Differentiate between multilevel and multiple inheritance with suitable example.

इनहेरिटेंस क्या है? इनहेरिटेंस का क्या महत्व है? उपयुक्त उदाहरण की सहायता से मल्टीलेवल और मल्टीपल इनहेरिटेंस में अंतर स्पष्ट कीजिए।

b)
How is Data Encapsulation different from Information Hiding? Explain with example.

सूचना छिपाने से डाटा एन्कैप्सुलेशन कैसे अलग है? उदाहरण सहित समझाइये।

2.
a)
What is the difference between overloading and overriding? How is binding used in polymorphism? Explain with example

ओवरलोडिंग और ओवरराइडिंग के बीच क्या अंतर है? बहुरूपता में बाधकारी कैसे प्रयोग किया जाता है? उदाहरण सहित समझाइए।

b)
What are the concepts or techniques used in object-oriented concept to handling complexity of system?

सिस्टम की जटिलता की संभालने के लिए ऑब्जेक्ट-ओरिएंटेड कॉन्सेप्ट में कौन-कौन सी कांसेप्ट या तकनीक का इस्तेमाल किया जाता है?

3.
a)
Write a C++ function to overloaded versions of a Max function which compares two integers, two reals, or two strings, and returns the 'larger' one.

मैक्स फंक्शन के ओवरलोडेड संस्करणों के लिए C++ फंक्शन लिखें जो दो पूर्णांक, दो वास्तविक, या दो तारों की तुलना करता है, और 'बड़ा' लौटाता है?

b)
What is friend function? Explain application of friend function with the suitable example?

फ्रेंड फंक्शन क्या है? उपयुक्त उदाहरण के साथ फ्रेंड फंक्शन के अनुप्रयोग को समझाइए।

4.
a)
Write C++ programs to validation of the examination marks is to be done. The range of exam marks is between 65 and 100 (both inclusive). This is to be done by including a validate method in Student class.

C++ प्रोग्राम लिखिये के लिए परीक्षा के अंकों का सत्यापन किया जाना है। परीक्षा के अंकों की सीमा 65 और 100 (दोनों सम्मिलित) के बीच है। यह विद्यार्थी वर्ग में एक मान्य पद्धति को शामिल करके किया जाना है।

b)
Define a class named Complex for representing complex numbers. A complex number has the general form a + ib, where a is the real part and b is the imaginary part (i stands for imaginary). Complex arithmetic rules are as follows:
  • (a + ib) + (c + id) = (a + c) + i(b + d)
  • (a + ib) – (c + id) = (a – c) + i(b – d)
  • (a + ib) * (c + id) = (ac – bd) + i(bc + ad)
Define these operations as member functions of Complex.

सम्मिश्र संख्याओं का प्रतिनिधित्व करने के लिए कॉम्प्लेक्स नामक वर्ग को परिभाषित करें। एक सम्मिश्र संख्या का सामान्य रूप a + ib होता है, जहाँ a वास्तविक भाग होता है और b काल्पनिक भाग होता है (i का अर्थ काल्पनिक होता है)। जटिल अंकगणितीय नियम इस प्रकार हैं:

  • (a + ib) + (c + id) = (a + c) + i(b + d)
  • (a + ib) – (c + id) = (a – c) + i(b – d)
  • (a + ib) * (c + id) = (ac – bd) + i(bc + ad)

इन परिचालनों को कॉम्प्लेक्स के सदस्य कार्यों के रूप में परिभाषित करें।

5.
a)
We had several Branch Id's related to the various branches of engineering in the college. The fees to be paid are different for different branches. Write C++ programs to calculate the fees based on branch using an array.

हमारे पास कॉलेज में इंजीनियर���ंग की विभिन्न शाखाओं से संबंधित कई शाखा पहचान पत्र थे। भुगतान की जाने वाली फीस अलग-अलग शाखाओं के लि��� अलग-अलग है। एक सारणी का उपयोग करके शाखा के आधार पर शुल्क की गणना करने के लिए C++ प्रोग्राम लिखें।

b)
Diagram for Question
Write a class program in C++ which stores the marks of 3 subjects of a student. Provide methods to set the marks and get the values of the marks. Also, provide a method called getResults(), which prints the grade of the students. Grade is calculated as shown in the table given below:

C++ में एक कक्षा लिखिए जो एक छात्र के 3 विषयों के अंकों को संग्र��ित करती है। अंक निर्धारित करने और अंकों के मान प्राप्त करने के तरीके प्रदान करें। साथ ही, getResults(), नामक एक विधि प्रदान करें, जो छात्रों के ग्रेड को प्रिंट करती है। ग्रेड की गणना नीचे दी गई तालिका में दर्शाई गई है।

Diagram for Question
6.
a)
Write a class Survey Operator derived from Person. This class has the following additional members: Data Members:
  • NumberOfCalls, NumberOfSuccessfulCalls, TotalTime, Available
Operations:
  • GetNumberOfCalls, GetNumberOfSuccessfulCalls, SetAvailable, MakeCall
Define appropriate constructors for this class. Remember the fact that the base class Person does not have a default constructor and needs an explicit invocation using super().

व्यक्ति से प्राप्त एक वर्ग सर्वे ऑपरेटर लिखें। इस वर्ग में निम्नलिखित अतिरिक्त सदस्य हैं:

डेटा सदस्य:

  • नंबरऑफ़कॉल्स, नंबरऑफ़सक्सेसफुलकॉल्स, टोटलटाइम, उपलब्ध

ऑपरेशंस:

  • गेटनंबरऑफ़कॉल्स, गेटनंबरऑफ़सक्सेसफुलकॉल्स, सेटउपलब्ध, मेककॉल

इस वर्ग के लिए उपयुक्त कंस्ट्रक्टर्स को परिभाषित करें। इस तथ्य को याद रखें कि बेस क्लास व्यक्ति के पास डिफ़ॉल्ट कंस्ट्रक्टर नहीं है और super() का उपयोग करके स्पष्ट आह्वान की आवश्यकता है।

b)
Create a class called Employee whose objects are records for an employee. This class will be derived of the class Person which you will have to copy into a file of your own and compile. An employee record has an employee's name (inherited from the class Person), an annual salary represented as a single value of type double, a year the employee started work as a single value of type int and a national insurance number, which is a single value of type String. Your class should have a reasonable number of constructors and accessor methods, as well as an equals method. Write a main() method to fully test your class definition.

एक कर्मचारी नामक वर्ग बनाएं जिसके वस्तुएँ किसी कर्मचारी के लिए रिकॉर्ड हों। यह क्लास पर्सन क्लास की व्युत्पन्न क्लास होगी जिसे आपको अपनी खुद की फ़ाइल में कॉपी करना होगा और कंपाइल करना होगा। एक कर्मचारी रिकॉर्ड में एक कर्मचारी का नाम होता है (वर्ग व्यक्ति से विरासत में मिला), एक वार्षिक वे���न टाइप डबल के एक मूल्य के रूप में दर्शाया जाता है, जिस वर्ष कर्मचारी ने टाइप int के एक मूल्य और एक राष्ट्रीय बीमा संख्या के रूप में काम करना शुरू किया, जो एक स्ट्रिंग के लिए प्रकार का है। आपकी कक्षा में उचित संख्या में कंस्ट्रक्टर और एक्सेसर्स विधियों के साथ-साथ एक समान विधि होनी चाहिए। अपनी कक्षा परिभाषा का पूर्ण परीक्षण करने के लिए एक main() विधि लिखें।

7.
a)
Write a C++ program to initialize base class members through a derived class constructor.

व्युत्पन्न वर्ग निर्माता के माध्यम से आधार वर्ग के सदस्यों को प्रारंभ करने के लिए C++ प्रोग्राम लिखें।

b)
What is the ambiguity that arises in multiple inheritance? How it can be overcome. Explain with example.

एकाधिक वंशानुक्रम में उत्पन्न होने वाली अस्पष्टता क्या है? इसे कैसे दूर किया जा सकता है? उदाहरण सहित समझाइए।

8.
Create a base class, Telephone, and derive a class ElectronicPhone from it. In Telephone, create a protected string member phonetype, and a public method Ring() that outputs a text message like this: "Ringing the <phonetype>.". In ElectronicPhone, the constructor should set the phonetype to "Digital.". In the Run() method, call Ring() on the ElectronicPhone to test the inheritance. For above specification to illustrate a polymorphic method. Have the derived class override the Ring() method to display a different message.

एक बेस क्लास, टेलीफोन बनाएँ और उससे एक क्लास इलेक्ट्रॉनिक फोन प्राप्त करें। टेलीफोन में, एक संरक्षित स्ट्रिंग सदस्य फोन प्रकार और एक सार्वजनिक विध��� Ring() बनाएँ जो इस तरह का पाठ संदेश देता है: "Ringing the <phonetype>."। इलेक्ट्रॉनिक फोन में, निर्माता को फोन प्रकार को "Digital." पर सेट करना चाहिए। Run() विधि में, इनहेरिटेंस का परीक्षण करने के लिए इलेक्ट्रॉनिक फोन पर Ring() को कॉल करें। उपरोक्त विनिर्देश के लिए बहुरूपी विधि का वर्णन करने के लिए। व्युत्पन्न वर्ग को एक अलग संदेश प्रदर्शित करने के लिए Ring() विधि को ओवरराइड करना है।

******