1) What are the things contains in .obj file ? ( compiled result of .cpp file )
Answer :C++ .obj file holds code and data suitable for linking with other object files to create an executable or a shared object file.
2)What is difference between followin intialization.
int iVar1;
int iVar2 = int();
and which one of two should we prefer always and why?
Answer :In first case a variable will be create in memeory with the default base type value (depending upon compiler 2 compiler) bcoz it is not initialized. in second case the variable will be created in the memory with the value retuned by the function int() (if int is a user define function) the second statement should have been int *i = new int();
3)What is the difference between Object and Instance?
Answer :An instance of a user-defined type (i.e., a class) is called an object. We can instantiate many objects from one class.An object is an instance or occurrence of a class.
4) How is static variable stored in the memory?
(if there are 2 functions in a file, and the static variable name is same (ex var) in both the function. how is it keep separately in the memory).
Answer: C++ uses name mangling when storing both local and global static varibales at the same place. The local static variables have function name and the global variables will have file name. Essentially the compiler uses namespace to distinguish between local and global static variables.
5)what is the difference betwen wait() and delay()?
Answer :Wait() and delay() works same but works on different platforms. Wait(2) will wait processing fro 2 second on Linux/Unix while delay(2000) with wait for 2 second but on DOS or Windows. so wait(2) on linux == delay(2000) on DOS Delay() is under while one can directly use wait in his/her program.
No comments:
Post a Comment