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
796
EN + हिं Medium
GB The number of digits in integer n is:
IN पूर्णांक n में अंकों की संख्या है:
A
n एन
B
floor(log10(n))+1 मंजिल(लॉग10(एन))+1
C
log2(n) लॉग2(एन)
D
n/10 एन/10
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) digits = floor(log10(n))+1 for n>0.
व्याख्या (हिन्दी) अंक = मंजिल(लॉग10(एन))+1 n>0 के लिए।
797
EN + हिं
GB The output of: cout<<(int)(log10(12345))+1;
IN का आउटपुट: कॉउट
A
5 5
B
4 4
C
6 6
D
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) log10(12345)≈4.09; (int)=4; 4+1=5 digits.
व्याख्या (हिन्दी) लॉग10(12345)≈4.09; (int)=4; 4+1=5 अंक.
798
EN + हिं Easy
GB What is Eulers totient function phi(6)?
IN यूलर्स टोटिएंट फंक्शन फाई(6) क्या है?
A
2 2
B
3 3
C
4 4
D
6 6
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Numbers coprime to 6 and ≤6: {1,5}; phi(6)=2.
व्याख्या (हिन्दी) 6 और ≤6 से सहअभाज्य संख्याएँ: {1,5}; फ़ि(6)=2.
799
EN + हिं
GB The output of: int a=2,b=5,m=7; int result=1; while(b>0){if(b&1)result=result*a%m; a=a*a%m; b>>=1;} cout<
IN का आउटपुट: int a=2,b=5,m=7; पूर्णांक परिणाम=1; जबकि(b>0){if(b&1)result=result*a%m; a=a*a%m; b>>=1;} कोउट
A
4 4
B
2 2
C
3 3
D
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Fast modular exponentiation: 2^5 mod 7 = 32 mod 7 = 4.
व्याख्या (हिन्दी) तेज़ मॉड्यूलर घातांक: 2^5 मॉड 7 = 32 मॉड 7 = 4।
800
EN + हिं Medium
GB Modular arithmetic: (a+b) mod m equals:
IN मॉड्यूलर अंकगणित: (ए+बी) मॉड एम बराबर है:
A
(a mod m + b mod m) (ए मॉड एम + बी मॉड एम)
B
(a mod m + b mod m) mod m (ए मॉड एम + बी मॉड एम) मॉड एम
C
(a+b) only (ए+बी) केवल
D
Not defined परिभाषित नहीं
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Mod distributes: (a+b)%m = ((a%m)+(b%m))%m.
व्याख्या (हिन्दी) मॉड वितरित करता है: (a+b)%m = ((a%m)+(b%m))%m।
801
EN + हिं
GB The output of: int a=INT_MIN; cout<<(a<0?"negative":"positive");
IN का आउटपुट: int a=INT_MIN; अदालत
A
positive सकारात्मक
B
negative नकारात्मक
C
zero शून्य
D
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) INT_MIN is the most negative int; it is negative.
व्याख्या (हिन्दी) INT_MIN सबसे नकारात्मक int है; यह नकारात्मक है.
802
EN + हिं
GB What is the output: cout<::max();
IN आउटपुट क्या है: cout
A
2147483647 2147483647
B
INT_MAX INT_MAX
C
2^31-1 2^31-1
D
All correct सभी सही
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) All represent the same maximum int value.
व्याख्या (हिन्दी) सभी समान अधिकतम पूर्णांक मान का प्रतिनिधित्व करते हैं।
803
EN + हिं
GB The output of: double x=1.0/3.0; cout<
IN का आउटपुट: डबल x=1.0/3.0; अदालत
A
0.333333333333333 0.333333333333333
B
0.333 0.333
C
1.0 1.0
D
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) High precision shows repeating decimal pattern.
व्याख्या (हिन्दी) उच्च परिशुद्धता दोहराए जाने वाले दशमलव पैटर्न को दर्शाती है।
804
EN + हिं Easy
GB What is epsilon comparison for floating point?
IN फ़्लोटिंग पॉइंट के लिए ईपीएसलॉन तुलना क्या है?
A
a==b ए==बी
B
abs(a-b)<epsilon (for small epsilon) पेट(ए-बी)
C
a-b==0 ए-बी==0
D
(float)a==(float)b (फ्लोट)ए==(फ्लोट)बी
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Floating point equality: compare difference to small epsilon.
व्याख्या (हिन्दी) फ़्लोटिंग पॉइंट समानता: अंतर की तुलना छोटे ईपीएसलॉन से करें।
805
EN + हिं
GB The output of: cout<<(0.1+0.2==0.3);
IN का आउटपुट: कॉउट
A
1 1
C
Error गलती
D
True सत्य
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Floating point precision: 0.1+0.2 ≠ 0.3 exactly.
व्याख्या (हिन्दी) फ़्लोटिंग पॉइंट परिशुद्धता: 0.1+0.2 ≠ 0.3 बिल्कुल।
806
EN + हिं
GB Which is the output: double a=0.1+0.2; cout<
IN आउटपुट कौन सा है: डबल a=0.1+0.2; अदालत
A
0.30000000000000000000 0.30000000000000000
B
0.30000000000000004440 0.300000000000000004440
C
0.30000000000000001110 0.3000000000000001110
D
0.30000000000000000001 0.30000000000001
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) IEEE 754 double precision shows small error.
व्याख्या (हिन्दी) आईईईई 754 दोहरी परिशुद्धता छोटी त्रुटि दिखाती है।
807
EN + हिं
GB The output of: int n=5; string s(n,*); cout<
IN का आउटपुट: int n=5; स्ट्रिंग एस(एन,*); अदालत
A
***** *****
B
n एन
C
5 5
D
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) string(5,*) creates "****".
व्याख्या (हिन्दी) स्ट्रिंग(5,*) "****" बनाता है।
808
EN + हिं
GB The output of: string s="Hello"; s.insert(5," World"); cout<
IN इसका आउटपुट: स्ट्रिंग s='हैलो'; s.insert(5," विश्व"); अदालत
A
Hello World हैलो वर्ल्ड
B
WorldHello विश्वनमस्कार
C
HelloWorld हैलो वर्ल्ड
D
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Insert " World" at position 5 (end of "Hello").
व्याख्या (हिन्दी) स्थिति 5 ("हैलो" के अंत में) "वर्ल्ड" डालें।
809
EN + हिं
GB The output of: string s="Hello World"; s.replace(6,5,"C++"); cout<
IN इसका आउटपुट: स्ट्रिंग s='हैलो वर्ल्ड'; s.replace(6,5,"C++"); अदालत
A
Hello C++ नमस्ते सी++
B
Hello World हैलो वर्ल्ड
C
C++ World सी++ विश्व
D
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Replace 5 chars starting at 6 ("World") with "C++".
व्याख्या (हिन्दी) 6 ("विश्व") से शुरू होने वाले 5 वर्णों को "C++" से बदलें।
810
EN + हिं Easy
GB What does string::npos equal?
IN स्ट्रिंग::npos किसके बराबर है?
B
-1 as size_t (maximum size_t value) -1 size_t के रूप में (अधिकतम size_t मान)
C
NULL व्यर्थ
D
Empty string खाली स्ट्रिंग
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) npos = (size_t)-1 = maximum value of size_t.
व्याख्या (हिन्दी) npos = (size_t)-1 = size_t का अधिकतम मान।
796–810 of 1018