Monday 31 January 2022

Vmou june -2019 Question 1 Opps Programming with c++ and java


1. What do you mean by applets?

An applet is a Java program that can be embedded into a web page. It runs inside the web browser and works at client side. An applet is embedded in an HTML page using the APPLET or OBJECT tag and hosted on a web server. Applets are used to make the website more dynamic and entertaining.

एप्लेट एक जावा प्रोग्राम है जिसे वेब पेज में जोडा(embed) जा सकता है। यह वेब ब्राउजर(Google Chrome etc.) के अंदर चलता है और क्लाइंट साइड(User Computer) अर्थात यूजर के सिस्‍टम पर काम करता है। APPLET या OBJECT  टैग का उपयोग करके HTML पेज में एक एप्लेट को जोडा जाता है और वेब सर्वर पर एप्लेट होस्ट किया जाता है। वेबसाइट को अधिक गतिशील और मनोरंजक बनाने के लिए एप्लेट्स का उपयोग किया जाता है।

 

2. Is c++ a platform independent language?

C++ Not a platform independent language. This is because in C++, when we compile a program, it is first translated into Assembly Language and then to Machine Language. In the machine language code, the instructions are suitable only for the machine you compiled. You can’t run the same exe file of that program in another computer because architectures of computers differ.

सी ++ ऑपरेटिंग सिस्‍टम पर dependent भाषा है। ऐसा इसलिए है क्योंकि C++ में, जब हम किसी प्रोग्राम को कंपाइल करते हैं, तो उसका पहले असेंबली लैंग्वेज और फिर मशीन लैंग्वेज में अनुवाद किया जाता है। मशीन भाषा कोड में,  निर्देश केवल आपके द्वारा संकलित मशीन के लिए उपयुक्त हैं। आप उस प्रोग्राम की वही exe फ़ाइल दूसरे कंप्यूटर/ऑपरेटिंग सिस्‍टम में नहीं चला सकते क्योंकि कंप्यूटर के आर्किटेक्चर अलग-अलग होते हैं।

 

3. What do you understand by virtual functions in c++?

A virtual function is a member function that is declared within a base class and redefined by a derived class. It is declared using the virtual keyword. It is used to tell the compiler to perform late binding on the function.

वर्चुअल फ़ंक्शन एक सदस्य फ़ंक्शन है जिसे बेस क्लास के भीतर घोषित किया जाता है और व्युत्पन्न द्वारा फिर से परिभाषित किया जाता है। इसे वर्चुअल कीवर्ड का उपयोग करके घोषित किया जाता है। इसका उपयोग लेट बाइंडिंग(डायनेमिक बाइडिंग) करने के लिए किया जाता है।

 


4. How do you declare an array to integer variable in c++?

Following ways to declare array as integer variable

1
2

3

4

int jimmy [3][5];   // is equivalent to

int jimmy [15];     // (3 * 5 = 15)

int foo [5] = { 16, 2, 77, 40, 12071 }; 
int foo [] = { 16, 2, 77, 40, 12071 };

 

5. What output following statement would print in c++?

int b;

b=6;

cout<<(b<<2);

Output:-

 

(vi) What do you mean by implicit type conversation in java?

Converting one data to another data type is called type conversion or type casting.

एक डेटा को दूसरे डेटा प्रकार में कनवर्ट करना टाइप रूपांतरण या टाइप कास्टिंग कहलाता है।

 

Two types of type conversion

1. Implicit(अंतर्निहित) :-( Automatic done by compiler, No requirement of programming or coding)

It converts small data types to big data types

(कंपाइलर द्वारा स्वचालित, प्रोग्रामिंग या कोडिंग की कोई आवश्यकता नहीं)

यह छोटे डेटा प्रकारों को बड़े डेटा प्रकारों में परिवर्तित करता है।

Example in Java: -

 

2. Explicit(प्रकट, प्रकाशित) :-( Programming Required)

It is just opposite of implicit type casting. It converts big data type to small data type.

:-( प्रोग्रामिंग आवश्यक)

यह Implicit प्रकार की कास्टिंग के ठीक विपरीत है। यह बड़े डेटा प्रकार को छोटे डेटा प्रकार में परिवर्तित करता है।


Example in Java: -

 

(Vii):- what do you understand by event listener in java?

                An event listener in Java is designed to process some kind of event — it "listens" for an event, such as a user's mouse click or a key press, and then it responds accordingly.  

                An event listener must be connected to an event object that defines the event. A listener is an object that is notified when an event occurs. Event listener receives the event object and handles it. So Event Listener interface is provided in java.util package and is responsible for handling events.

                जावा में event listener किसी प्रकार की घटना को संसाधित करने के लिए डिज़ाइन किया गया है - यह किसी घटना के लिए "सुनता है(एक्टिव होता है)", जैसे कि उपयोगकर्ता का माउस क्लिक या कुंजी प्रेस, और फिर यह तदनुसार प्रतिक्रिया करता है।

Event listener किसी ऐसे ईवेंट ऑब्जेक्ट से कनेक्टेड होना चाहिए है जो कि ईवेंट को परिभाषित करता हो। Listner एक ऐसा ओबजेक्‍ट है जिसे किसी घटना के होने पर सूचित किया जाता है। Event listener ईवेंट ऑब्जेक्ट को प्राप्त करता है और इसे संभालता है। जावा में Event listener इंटरफ़ेस java.util  पैकेज में प्रदान किया गया है और घटनाओं को संभालने के लिए ज़िम्मेदार है।

 

(viii) What is major difference between Runnable and thread in java?


A thread allows a program to operate more efficiently by doing multiple things at the same time. Threads can be used to perform complicated tasks in the background without interrupting the main program.

एक थ्रेड एक प्रोग्राम को एक ही समय में कई चीजें करते हुए अधिक कुशलता से संचालित करने की अनुमति देता है। मुख्य प्रोग्राम/सॉफ्टवेयर को बाधित किए बिना बैकग्राउण्‍ड/ पृष्ठभूमि में जटिल कार्यों को करने के लिए थ्रेड्स का उपयोग किया जा सकता है।

We have two options when we want to execute a piece of code. We can extend Thread class or implement Runnable interface and pass our runnable object to some other thread.

जब हम कोड का एक टुकड़ा निष्पादित करना चाहते हैं तो हमारे पास दो विकल्प होते हैं। हम थ्रेड क्लास का विस्तार कर सकते हैं या रननेबल इंटरफ़ेस को लागू कर सकते हैं और अपनी रननेबल ऑब्जेक्ट को किसी अन्य थ्रेड में पास कर सकते हैं।

 

Thread

·         It is a class.

·         It has multiple methods such as ‘start’ and ‘run’.

·         It requires more memory space.

·         Since multiple inheritance is not allowed in Java, hence, after a class extends the Thread class, it can’t extend to any other class.

·         Every thread creates a unique object and associates with it.

Runnable

·         It is a functional interface.

·         It has a single abstract method ‘run’.

·         It requires less memory space.

·       When a class implements the ‘runnable’ interface, the class can extend to other classes.

·         Multiple threads can share the same objects.

 

No comments:

Post a Comment