D
Q. Suppose the integers take 4 bytes, what is the output of the following code?
#include<iostream> using namespace std; class MyClass { static int a; int b; }; int MyClass::a; int main() { cout << sizeof(MyClass); return 0; }
Static data members do not contribute to the size of an object. So, “a” is not considered in the size of “MyClass”. By the way, not all functions (static and non-static) contribute to the size.
You must be Logged in to update hint/solution
Be the first to start discuss.
Q. It is guaranteed that a ____ has at least 8 bits and a ____ has at least 16 bits.
Q. What is the value of z in the following C++ code snippet?
Q. Can we alter/modify the values of data members of a class inside const member function?
Q. Identify the correct definition of ‘*’ operator in pointer.
Q. Which of the following C++ operators is used to dereference a pointer?
Q. Which of the following is the correct way to define a const member function in C++?
Q. What is used to write multi line comment in c++?
Q. Which looping process checks the test condition at the end of the loop?
Discusssion
Login to discuss.