This test may have a higher chance of receiving a reward. Nominated for:
Educational explanations. 👍 Explanations cover why the correct answers are correct and why the wrong answers are wrong (when appropriate). E.g.: #q1, #q2, #q3
Hardy Snail
Nice quiz. Helped me refresh some of my C++ knowledge.
Holy Muleمنشئ الاختبار
I’m glad it helped! 💪
Little Skunk
question 12 with wrong explanation (variable x does not exist)
Holy Muleمنشئ الاختبار
You’re right. In the explanation it should be “a”, not “x”.
Quirky Quokka
Very nice! Remembered me I still have to revise my c++ basics😂
Small Lizard
How can you set the size of a static array? You can use an int variable too. Example: https://ideone.com/R8mreY
Holy Muleمنشئ الاختبار
Yes, but it is not a standard. Some compilers compile that, but the program would not be portable anymore, since it could give some problems on another machine with a different compiler.
Small Lizard
Holy MuleSo I think the answer is ambiguous and it is bad
Small Lizard
The memory for an object, dinamically created in a function: Can be deallocated only using delete operator. It is NOT deallocated at the end of the program, if not explicitly done before Proof: https://ideone.com/lWKjfJ. In this code, destructor won't be called.
Holy Muleمنشئ الاختبار
As well explained here https://www.cplusplus.com/forum/general/263564/, "[...] deallocation is separate from destruction. Destruction is not actually about deallocation, but about releasing resources an object owns". Every object allocated in the memory from the program, once it ends, is deallocated from the memory, since the stack is removed.
#27 "What is the correct symbol to get the reference of an object?" Operator & returns pointer, not reference. You don't need any operators at all to get reference to object.
Educational explanations. 👍 Explanations cover why the correct answers are correct and why the wrong answers are wrong (when appropriate). E.g.: #q1, #q2, #q3
You can use an int variable too.
Example: https://ideone.com/R8mreY
Can be deallocated only using delete operator. It is NOT deallocated at the end of the program, if not explicitly done before
Proof: https://ideone.com/lWKjfJ. In this code, destructor won't be called.
Every object allocated in the memory from the program, once it ends, is deallocated from the memory, since the stack is removed.
Operator & returns pointer, not reference. You don't need any operators at all to get reference to object.