Blog - C ++ Language Quiz 1

C ++ Language Quiz 1

C ++ Language Quiz 1

C++language

1. What does C++ stand for?

C++ का क्या अर्थ है?

a) Compact Languag

b) Computer Languag

c) C Plus Language

d) C with Classes

 

2. In C++, which of the following is a correct way to declare an integer variable named "num"?

C++ में, "num" नामक पूर्णांक वैरिएबल घोषित करने का सही तरीका निम्नलिखित में से कौन सा है?

a) num : int;

b) var num = int;

c) int num;

d) num int;

 

3. What is the purpose of the "cin" object in C++?

C++ में "cin" ऑब्जेक्ट का उद्देश्य क्या है?

a) To display output on the console

b) To read input from the user

c) To perform mathematical calculations

d) To declare a variable

 

4. Which C++ operator is used for assignment?

असाइनमेंट के लिए किस C++ ऑपरेटर का उपयोग किया जाता है?

a) ==

b) =

c) :=

d) => 

 

5. What is the output of the following C++ code snippet?

cppCopy code

int x = 5; int y = 10; int z = x + y; cout << z;

निम्नलिखित C++ कोड स्निपेट का आउटपुट क्या है?

सीपीपीकोड कॉपी करें

पूर्णांक x = 5; पूर्णांक y = 10; पूर्णांक z = x + y; cout << z;

a) 15

b) "15"

c) The code has a syntax error

d) None of the above

 

6.  In C++, which keyword is used to define a class

C++ में क्लास को परिभाषित करने के लिए किस कीवर्ड का उपयोग किया जाता है?

a) class

b) struct

c) object

d) define

 

7 . What is the purpose of a constructor in C++?

C++ में कंस्ट्रक्टर का उद्देश्य क्या है?

a) To destroy an object

b) To create an object

c) To hide data members

d) To access private members

 

8. What is the default access modifier for class members in C++ if not specified?

यदि निर्दिष्ट नहीं है तो C++ में क्लास सदस्यों के लिए डिफ़ॉल्ट एक्सेस संशोधक क्या है?

a) public

b) private

c) protected

d) friend

 

9. In C++, what is operator overloading?

C++ में, ऑपरेटर ओवरलोडिंग क्या है?

a) Using too many operators in a single statement

b) Defining multiple operators with the same functionality

c) Extending the functionality of existing operators

d) Using operators in an illegal way

 

10. What is the purpose of the "this" pointer in C++?

C++ में "इस" पॉइंटर का उद्देश्य क्या है?

a) It points to the next memory location.

b) It points to the previous memory location.

c) It points to the current object.

d) It points to the main() function.

 

11. What is the output of the following C++ code snippet?

cppCopy codeint

 x = 5; int& ref = x; ref = 10; cout << x;

 निम्नलिखित C++ कोड स्निपेट का आउटपुट क्या है?

सीपीपीकोड कॉपी करें

पूर्णांक x = 5; पूर्णांक एवं रेफरी = एक्स; रेफरी = 10; cout << x;

a) 5

b) 10

c) The code has a syntax error

d) None of the above

 

12. In C++, what is the purpose of the "new" operator?

C++ में, "नए" ऑपरेटर का उद्देश्य क्या है?

a) To deallocate memory

b) To create a new object

c) To delete an object

d) To allocate memory for an object on the heap

 

13. What does "polymorphism" mean in C++?

C++ में "बहुरूपता" का क्या अर्थ है?

a) Having multiple constructors in a class

b) The ability of objects of different classes to be treated as objects of a common base class

c) Using multiple inheritance

d) The ability to create multiple objects

 

14. What is the correct syntax for inheriting a class in C++?

C++ में किसी क्लास को इनहेरिट करने के लिए सही सिंटैक्स क्या है?

a) class SubClass : public BaseClass

b) class SubClass :: BaseClass

c) class SubClass <- BaseClass

d) class SubClass extends BaseClass

 

15. In C++, what is the purpose of the "virtual" keyword when used with functions?

C++ में, फ़ंक्शंस के साथ उपयोग किए जाने पर "वर्चुअल" कीवर्ड का उद्देश्य क्या है?

a) To declare a function as private

b) To indicate that the function can be overridden in derived classes

c) To declare a function as static

d) To define a pure virtual function

 

16.  What is the scope resolution operator in C++ used for?

C++ में स्कोप रेज़ोल्यूशन ऑपरेटर का उपयोग किसके लिए किया जाता है?

a) To define a function

b) To access the properties of an object

c) To specify the base class in inheritance

d) To declare a constant 

 

17. What is the primary use of the "static" keyword in C++?

C++ में "स्थैतिक" कीवर्ड का प्राथमिक उपयोग क्या है?

a) To create an object

b) To declare a function as private

c) To specify that a member variable belongs to the class, not to objects of the class

d) To allocate memory for an object 

 

18.  In C++, how is function overloading different from operator overloading?

C++ में, फ़ंक्शन ओवरलोडिंग ऑपरेटर ओवरलोडिंग से किस प्रकार भिन्न है?

a) Function overloading allows the same function name with different parameter lists, while operator overloading allows defining the behavior of operators for user-defined types.

b) Function overloading allows defining the behavior of operators for user-defined types, while operator overloading allows the same function name with different parameter lists.

c) Function overloading and operator overloading are the same.

d) Neither function overloading nor operator overloading is allowed in C++.

 

19. What is the purpose of the "try," "catch," and "throw" keywords in C++?

C++ में "कोशिश करें," "पकड़ें," और "फेंक" कीवर्ड का उद्देश्य क्या है?

a) To create classes

b) To handle exceptions in code

c) To define constructors

d) To define destructors

 

20. What is the output of the following C++ code snippet?

cppCopy code

int x = 5; int y = 0; try { if (y == 0) { throw "Division by zero!"; } int result = x / y; cout << result; } catch (const char* error) { cout << error; }

निम्नलिखित C++ कोड स्निपेट का आउटपुट क्या है?

सीपीपीकोड कॉपी करें

पूर्णांक x = 5; पूर्णांक y = 0; प्रयास करें { यदि (y == 0) { फेंकें "शून्य से विभाजन!"; } पूर्णांक परिणाम = x/y; cout << परिणाम; } पकड़ें (स्थिरांक चार* त्रुटि) { कोउट << त्रुटि; }

a) "Division by zero!"

b) 0

c) The code has a syntax error

d) None of the above

 

21. What is the purpose of the "friend" keyword in C++?

C++ में "मित्र" कीवर्ड का उद्देश्य क्या है?

a) To declare a function as static

b) To specify that a function can access private members of a class

c) To create a new class

d) To declare a constant variable

 

22. What is the purpose of the "namespace" keyword in C++?

C++ में "नेमस्पेस" कीवर्ड का उद्देश्य क्या है?

a) To define a class

b) To define a constant

c) To group related identifiers and prevent naming conflicts

d) To specify the base class in inheritance

 

23.  In C++, what is a template class?

C++ में, टेम्पलेट क्लास क्या है?

a) A class that can be used as a template to create objects of any type

b) A class that can only have one instance

c) A class that cannot be inherited

d) A class that cannot have member functions

 

24. What is a constructor initializer list in C++?

C++ में कंस्ट्रक्टर इनिशियलाइज़र सूची क्या है?

a) A list of constructors in a class

b) A list of member functions that can be called from a constructor

c) A list of member variables that are initialized in a constructor

d) A list of function prototypes

 

25. In C++, what is the purpose of the "typename" keyword?

C++ में, "टाइपनेम" कीवर्ड का उद्देश्य क्या है?

a) To specify the data type of a variable

b) To indicate that a type is a class

c) To define a constant

d) To declare a function as a template function

 


200 1 year ago