R4RIN
Articles
Java 8
MCQS
C/C MCQ Quiz Hub
C Programming MCQS Set-2
Choose a topic to test your knowledge and improve your C/C skills
1. Which of the following is correct about new and malloc?
Both are available in C
Pointer object initialization of a class with both new and malloc calls the constructor of that class
Pointer object initialization of a class using new involves constructor call whereas using malloc does not involve constructor call
Pointer object initialization of a class using malloc involves constructor call whereas using new does not involve constructor call
2. What is virtual inheritance?
C++ technique to avoid multiple copies of the base class into children/derived class
C++ technique to avoid multiple inheritances of classes
C++ technique to enhance multiple inheritance
C++ technique to ensure that a private member of the base class can be accessed somehow
3. What is the difference between delete and delete[] in C++?
delete is used to delete normal objects whereas delete[] is used to pointer objects
delete is a keyword whereas delete[] is an identifier
delete is used to delete single object whereas delete[] is used to multiple(array/pointer of) objects
delete is syntactically correct but delete[] is wrong and hence will give an error if used in any case
4. Which of the following is correct about new and malloc? i) new is an operator whereas malloc is a function ii) new calls constructor malloc does not iii) new returns required pointer whereas malloc returns void pointer and needs to be typecast
i and ii
ii and iii
i and iii
i ii and iii
Submit