C++ Basics MCQs | C++ प्रोग्रामिंग के Multiple Choice Questions (Beginners के लिए) – Online Test

Timed practice test • Results after submission

← View MCQ Question Paper

Share this online test

Invite friends to practice, compare scores, or save this page.

Important Instructions

  • • Total Questions: 50
  • • Time Limit: 90 minutes
  • • No negative marking
  • • Do not refresh the page
Time Left: 00:00

1. C++ में RAII का पूरा नाम क्या है और यह किस सिद्धांत पर आधारित है?

  • AResource Allocation Is Initialization
  • BResource Acquisition Is Initialization
  • CRuntime Allocation In Inheritance
  • DResource Access In Interface

2. unique_ptr और shared_ptr में मुख्य अंतर क्या है?

  • Aunique_ptr की copy बनाई जा सकती है
  • Bshared_ptr exclusive ownership रखता है
  • Cunique_ptr केवल एक owner रखता है, जबकि shared_ptr कई owners को allow करता है
  • Dदोनों same reference counting इस्तेमाल करते हैं

3. Move semantics C++ में किस version में introduce हुए?

  • AC++98
  • BC++03
  • CC++11
  • DC++14

4. std::move() function का असली काम क्या है?

  • AObject को physically move करता है
  • BObject को rvalue reference में cast करता है
  • CMemory copy करता है
  • DObject को delete कर देता है

5. Rvalue reference का syntax क्या होता है?

  • A&
  • B&&
  • C*&
  • Dconst&

6. Smart pointers किस header में define होते हैं?

  • A<iostream>
  • B<memory>
  • C<vector>
  • D<string>

7. weak_ptr का मुख्य उपयोग क्या है?

  • AMemory allocate करना
  • BReference cycle break करना
  • CObject copy करना
  • DPointer delete करना

8. Lambda expression C++ में किस version से available है?

  • AC++98
  • BC++03
  • CC++11
  • DC++17

9. Modern C++ में auto keyword का उपयोग मुख्य रूप से किस लिए होता है?

  • AVariable type automatically deduce करने के लिए
  • BPointer बनाने के लिए
  • CConstant बनाने के लिए
  • DFunction return type बदलने के लिए

10. constexpr functions का मुख्य लाभ क्या है?

  • ARuntime पर execute होते हैं
  • BCompile-time पर evaluate हो सकते हैं
  • Cकेवल void return करते हैं
  • DMemory usage बढ़ाते हैं

11. std::make_unique और new में क्या advantage है?

  • AFaster execution
  • BException safety प्रदान करता है
  • Cअधिक memory उपयोग करता है
  • DCopy create करता है

12. Perfect forwarding का उपयोग मुख्य रूप से किस लिए होता है?

  • ATemplates में arguments forward करने के लिए
  • BPointers delete करने के लिए
  • CClasses inherit करने के लिए
  • DLoops optimize करने के लिए

13. Rule of Five किसको refer करता है?

  • A5 constructors बनाना
  • BCopy constructor, copy assignment, move constructor, move assignment, destructor implement करना
  • C5 inheritance rules
  • D5 STL containers

14. Base class में virtual destructor क्यों जरूरी होता है?

  • AMemory leak से बचने के लिए
  • BPolymorphic deletion सही तरीके से करने के लिए
  • CSpeed बढ़ाने के लिए
  • DCode छोटा करने के लिए

15. std::enable_if का उपयोग क्या है?

  • ACompile-time type checking के लिए
  • BRuntime error throw करने के लिए
  • CMemory allocate करने के लिए
  • DLoop break करने के लिए

16. Concepts C++ में किस version में officially introduce हुए?

  • AC++11
  • BC++14
  • CC++17
  • DC++20

17. auto&& का मतलब universal reference में क्या होता है?

  • Aकेवल rvalue bind होता है
  • Blvalue और rvalue दोनों bind हो सकते हैं
  • CConstant reference
  • DPointer reference

18. std::forward का सामान्य syntax क्या है?

  • Astd::forward(arg)
  • Bstd::forward<T>(arg)
  • Cstd::move<T>(arg)
  • Dstd::cast<T>(arg)

19. std::variant किस header में define है?

  • A<memory>
  • B<variant>
  • C<optional>
  • D<utility>

20. std::optional का उपयोग कब करते हैं?

  • Aजब value हो या न हो (nullable)
  • Bजब multiple values रखने हों
  • CException handling के लिए
  • DPointer इस्तेमाल करने के लिए

21. Thread-local storage के लिए keyword क्या है?

  • Astatic
  • Bthread_local
  • Cmutable
  • Dvolatile

22. std::mutex किस header में है?

  • A<thread>
  • B<mutex>
  • C<future>
  • D<atomic>

23. std::lock_guard का मुख्य लाभ क्या है?

  • AManual unlock करना पड़ता है
  • BRAII style में automatic unlock
  • CMultiple mutex lock करता है
  • DDeadlock create करता है

24. std::atomic का उपयोग किस लिए होता है?

  • AThread-safe variable operations के लिए
  • BFile handling के लिए
  • CString manipulation के लिए
  • DVector resize के लिए

25. Three-way comparison operator (spaceship) किस version में आया?

  • AC++11
  • BC++14
  • CC++17
  • DC++20

26. std::span किस लिए उपयोगी है?

  • AContiguous memory का non-owning view देने के लिए
  • BDynamic array के लिए
  • CLinked list के लिए
  • DMap container के लिए

27. CRTP का पूरा नाम और उपयोग क्या है?

  • ACuriously Recurring Template Pattern – static polymorphism
  • BCopy Runtime Template Pointer
  • CClass Runtime Template Pattern
  • DCompile Resource Type Pointer

28. SFINAE का पूरा नाम क्या है?

  • ASubstitution Failure Is Not An Error
  • BSyntax Failure In Name Argument
  • CStatic Function In Namespace Error
  • DSimple Failure In New Expression

29. std::decay_t का उपयोग क्या है?

  • AReference और cv-qualifiers remove करने के लिए
  • BPointer बनाने के लिए
  • CConst बनाने के लिए
  • DArray को pointer में convert करने के लिए

30. std::is_same_v किस header में है?

  • A<type_traits>
  • B<memory>
  • C<concepts>
  • D<utility>

31. noexcept specifier का मतलब क्या है?

  • AFunction exception नहीं throw करेगा
  • BFunction हमेशा exception throw करेगा
  • CFunction virtual है
  • DFunction static है

32. final keyword class पर लगाने का मतलब?

  • AClass inherit नहीं हो सकती
  • BFunction override नहीं हो सकता
  • CVariable constant है
  • DPointer delete नहीं हो सकता

33. override keyword का लाभ क्या है?

  • AVirtual function सही override होने की confirmation देता है
  • BFunction delete करता है
  • CMemory allocate करता है
  • DLoop break करता है

34. Default member initializer किस version से उपलब्ध है?

  • AC++98
  • BC++11
  • CC++14
  • DC++17

35. Aggregate initialization किस तरह से होती है?

  • ABraces {} से
  • BParentheses () से
  • CEqual = से
  • DColon : से

36. std::string_view का मुख्य लाभ क्या है?

  • ANo copy, lightweight string reference
  • BMutable string
  • COwned string
  • Dहमेशा null-terminated

37. std::byte का उपयोग किस लिए है?

  • ARaw memory byte represent करने के लिए
  • BCharacter store करने के लिए
  • CInteger value के लिए
  • DFloat value के लिए

38. if constexpr किस version में introduce हुआ?

  • AC++11
  • BC++14
  • CC++17
  • DC++20

39. std::filesystem किस version से standard library का हिस्सा है?

  • AC++11
  • BC++14
  • CC++17
  • DC++20

40. Coroutines C++ में किस version में officially आए?

  • AC++14
  • BC++17
  • CC++20
  • DC++23

41. std::jthread का मुख्य लाभ क्या है?

  • ADestructor में automatically join होता है
  • BDetach होता है
  • CMutex lock करता है
  • DAtomic operation करता है

42. std::format() function किस version में आया?

  • AC++17
  • BC++20
  • CC++23
  • DC++11

43. requires clause का उपयोग क्या है?

  • AConcepts के साथ template constraints define करने के लिए
  • BException throw करने के लिए
  • CMemory allocate करने के लिए
  • DLoop control के लिए

44. std::ranges::sort किस version में बेहतर support मिलता है?

  • AC++17
  • BC++20
  • CC++14
  • DC++11

45. Deduction guides किसके लिए उपयोग होते हैं?

  • AClass template arguments deduce करने के लिए
  • BFunction return type deduce करने के लिए
  • CVariable type deduce करने के लिए
  • DPointer type deduce करने के लिए

46. std::source_location किस लिए उपयोगी है?

  • ALogging में file, line, function information capture करने के लिए
  • BMemory address लेने के लिए
  • CTime measurement के लिए
  • DThread ID लेने के लिए

47. consteval keyword का मतलब क्या है?

  • AFunction केवल compile-time पर call हो सकती है
  • BFunction runtime पर call होगी
  • CFunction virtual है
  • DFunction deleted है

48. std::bit_cast() का उपयोग क्या है?

  • AType punning को type-safe तरीके से करना
  • BPointer cast करना
  • CDynamic cast करना
  • DStatic cast करना

49. std::midpoint और std::lerp किस header में हैं?

  • A<numeric>
  • B<cmath>
  • C<algorithm>
  • D<ranges>

50. std::is_constant_evaluated() का उपयोग क्या है?

  • ACompile-time vs runtime call detect करने के लिए
  • BException check करने के लिए
  • CPointer check करने के लिए
  • DType check करने के लिए


Question Map