Data Structures and Algorithms — MCQ Practice

Hindi aur English dono mein practice karo — click karo answer check karne ke liye

📚 1018 Questions 🌐 Hindi + English ✅ Free
भाषा / Language:
1018 questions
1
EN + हिं
GB Which keyword defines a class in Python?
IN कौन सा कीवर्ड पायथन में एक क्लास को परिभाषित करता है?
A
define परिभाषित करना
B
class कक्षा
C
struct struct
D
object वस्तु
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) The 'class' keyword is used to define a class in Python.
व्याख्या (हिन्दी) पायथन में क्लास को परिभाषित करने के लिए 'क्लास' कीवर्ड का उपयोग किया जाता है।
2
EN + हिं Easy
GB What is an object in Python OOP?
IN पायथन OOP में एक ऑब्जेक्ट क्या है?
A
A blueprint of a class एक कक्षा का खाका
B
A function inside a module एक मॉड्यूल के अंदर एक फ़ंक्शन
C
An instantiation of a class एक वर्ग की एक तात्कालिकता
D
A global variable एक वैश्विक चर
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) An object is an instantiation of a class — created when class() is called.
व्याख्या (हिन्दी) एक ऑब्जेक्ट एक क्लास का इन्स्टेन्शियेशन है - जब क्लास() कहा जाता है तब बनाया जाता है।
3
EN + हिं Medium
GB Which method is called automatically when an object is created?
IN जब कोई ऑब्जेक्ट बनाया जाता है तो कौन सी विधि स्वचालित रूप से कॉल की जाती है?
A
__create__() __बनाएं__()
B
__start__() __शुरू करना__()
C
__init__() __इस में__()
D
__new__() __नया__()
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) __init__() is the constructor, called automatically on object creation.
व्याख्या (हिन्दी) __init__() कंस्ट्रक्टर है, जिसे ऑब्जेक्ट निर्माण पर स्वचालित रूप से कॉल किया जाता है।
4
EN + हिं
GB What does 'self' represent in a Python class method?
IN पायथन क्लास विधि में 'स्वयं' क्या दर्शाता है?
A
Static reference to class कक्षा का स्थैतिक संदर्भ
B
Current instance of the class कक्षा का वर्तमान उदाहरण
C
A global variable एक वैश्विक चर
D
A built-in keyword एक अंतर्निहित कीवर्ड
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 'self' refers to the current instance of the class.
व्याख्या (हिन्दी) 'स्वयं' वर्ग के वर्तमान उदाहरण को संदर्भित करता है।
5
EN + हिं
GB What is a class variable in Python?
IN पायथन में क्लास वेरिएबल क्या है?
A
Defined inside __init__ with self स्वयं के साथ __init__ के अंदर परिभाषित
B
Shared by all instances, defined outside constructor सभी उदाहरणों द्वारा साझा किया गया, बाहरी कंस्ट्रक्टर द्वारा परिभाषित
C
A local variable in a method एक विधि में एक स्थानीय चर
D
An imported variable एक आयातित चर
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Class variables are shared among all instances; defined outside any method.
व्याख्या (हिन्दी) वर्ग चर सभी उदाहरणों के बीच साझा किए जाते हैं; किसी भी विधि के बाहर परिभाषित।
6
EN + हिं Medium
GB Which keyword makes a local variable refer to the global variable?
IN कौन सा कीवर्ड स्थानीय वैरिएबल को वैश्विक वैरिएबल का संदर्भ देता है?
A
extern बाहरी
B
static स्थिर
C
global वैश्विक
D
nonlocal गैर स्थानीय
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) The 'global' keyword inside a function refers to the global variable.
व्याख्या (हिन्दी) किसी फ़ंक्शन के अंदर 'वैश्विक' कीवर्ड वैश्विक चर को संदर्भित करता है।
7
EN + हिं Medium
GB Which type of method requires an object to be called?
IN किस प्रकार की विधि के लिए किसी ऑब्जेक्ट को कॉल करने की आवश्यकता होती है?
A
Static method स्थैतिक विधि
B
Class method वर्ग विधि
C
Instance method उदाहरण विधि
D
Abstract method सार विधि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Instance methods use 'self' and require an object.
व्याख्या (हिन्दी) इंस्टेंस विधियाँ 'स्वयं' का उपयोग करती हैं और एक वस्तु की आवश्यकता होती है।
8
EN + हिं
GB Which decorator defines a class method?
IN कौन सा डेकोरेटर क्लास पद्धति को परिभाषित करता है?
A
@staticmethod @staticmethod
B
@instancemethod @instancemethod
C
@classmethod @classmethod
D
@abstractmethod @abstractmethod
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) @classmethod with 'cls' as first parameter defines a class method.
व्याख्या (हिन्दी) पहले पैरामीटर के रूप में 'cls' के साथ @classmethod एक क्लास विधि को परिभाषित करता है।
9
EN + हिं Medium
GB Which decorator defines a static method?
IN कौन सा डेकोरेटर स्थैतिक विधि को परिभाषित करता है?
A
@classmethod @classmethod
B
@staticmethod @staticmethod
C
@property @संपत्ति
D
@abstract @अमूर्त
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) @staticmethod defines methods that need no self or cls.
व्याख्या (हिन्दी) @staticmethod उन तरीकों को परिभाषित करता है जिनके लिए self या cls की आवश्यकता नहीं होती है।
10
EN + हिं
GB What parameter is the first argument in a class method?
IN क्लास विधि में पहला तर्क कौन सा पैरामीटर है?
A
self खुद
B
this यह
C
cls सीएलएस
D
class कक्षा
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 'cls' refers to the class itself in class methods.
व्याख्या (हिन्दी) 'सीएलएस' क्लास विधियों में क्लास को ही संदर्भित करता है।
11
EN + हिं Easy
GB What is a mutator (setter)?
IN म्यूटेटर (सेटर) क्या है?
A
Fetches value of instance variable इंस्टेंस वेरिएबल का मान प्राप्त करता है
B
Modifies value of instance variable इंस्टेंस वेरिएबल का मान संशोधित करता है
C
Creates objects वस्तुएं बनाता है
D
Decorates class methods वर्ग विधियों को सजाता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) A setter/mutator modifies the value of an instance variable.
व्याख्या (हिन्दी) एक सेटर/म्यूटेटर एक इंस्टेंस वेरिएबल के मान को संशोधित करता है।
12
EN + हिं Medium
GB How many types of inheritance are there in Python?
IN पाइथॉन में इनहेरिटेंस कितने प्रकार के होते हैं?
A
3 3
B
4 4
C
5 5
D
6 6
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Five: Single, Multiple, Multi-Level, Hierarchical, Hybrid.
व्याख्या (हिन्दी) पाँच: एकल, एकाधिक, बहु-स्तरीय, श्रेणीबद्ध, संकर।
13
EN + हिं Medium
GB In single inheritance, how many parent classes does a child have?
IN एकल वंशानुक्रम में, एक बच्चे के पास कितने मूल वर्ग होते हैं?
A
Two दो
B
Three तीन
C
One एक
D
Zero शून्य
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Single inheritance: one child class from exactly one parent class.
व्याख्या (हिन्दी) एकल वंशानुक्रम: बिल्कुल एक मूल वर्ग से एक बच्चा वर्ग।
14
EN + हिं Medium
GB Which inheritance has one child from two or more parents?
IN दो या दो से अधिक माता-पिता से एक बच्चे को कौन सी विरासत प्राप्त होती है?
A
Single अकेला
B
Multi-Level मल्टी लेवल
C
Multiple विभिन्न
D
Hierarchical श्रेणीबद्ध
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Multiple Inheritance: class Child(Parent1, Parent2).
व्याख्या (हिन्दी) एकाधिक वंशानुक्रम: वर्ग बाल (अभिभावक1, अभिभावक2)।
15
EN + हिं Medium
GB In multi-level inheritance, the structure is:
IN बहु-स्तरीय विरासत में, संरचना है:
A
One parent two children एक माता-पिता दो बच्चे
B
A child derived from another child class एक बच्चा दूसरे बच्चे वर्ग से प्राप्त हुआ
C
Two parents one child दो माता-पिता एक बच्चा
D
All from single root सभी एक ही जड़ से
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Multi-level: chain A→B→C where each derives from previous.
व्याख्या (हिन्दी) बहु-स्तरीय: श्रृंखला A→B→C जहां प्रत्येक पिछले से प्राप्त होता है।
1–15 of 1018