Answers for C

The C programming language was developed at Be...Image via Wikipedia

1.(i) in c there is no oop concept but in c++ have oop concept
(ii) In C program divide into number of sub-parts called function.but in C++ program divide into number of sub-parts called methods

2. Yes we can pass arguments to main

3.Even though static and constant variable are common for all a objects the value of static variable can be increased in time being but it cannot be increased in constant variable

4. void main()
{ if(printf("Hello world")){}}

5.The answer is 44..
As the space is an empty character and one the compiler counts one more character for the Null character constant '/0' And the space that Null takes in memory is 4 bytes same as int but this value depends on the Compiler that you use

6.2 bytes of memory because the pointer variable, whatever data type it maybe pointing to is always an unsigned integer as the address is always a positive integer, hence requiring 2 bytes of memory

7.option c is wrong i.e. a1->p1. Because a1 is not a pointer you can not refer its member through -> operator

8.The major difference between methods and functions is that methods called by the reference variables called objects where as the functions do not having any reference variables.

9.We can list as:

i. In classes the default scope is private whereas in structures u have public.equir

ii.Also u can define the scope according to is requirements in classes.

iii. In classes u can create functions and methods which is not so in the case of structures.

iv.You can also do operator overloading in case of classes which is not so in d case of structures.

v.Various other object - oriented features are found in classes and not in structures wherin u can create objects which is not possible in structures.

10.if both the base class and derived class can have the constructors,if the derived class is to call the constructor of its own using its object,it can.but when it calls its destructor,the compiler calls the destructor of base class.thats why the virtual destructor concept is coined. but there are no virtual constructors
Reblog this post [with Zemanta]

0 comments:

Post a Comment