are the expressions arr and &arr same for an array of integers?
Code
#include stdarg.h
stdarg.h
answer for 1 & 2 are same
Hi shilpagore,
Thank u for ans's but there totally 5 questions in that. so if u don't mind pls do read question carefully and can u post the ans's please.
Thank you.
Why we need to create object for final class and what are its benefits?
What is memset, and why it is used, when it is used?
I need a simple example progam for this with clear definition
This code gives warnings which is not the good sign while dealing with the network programming.
How will this memset() function willl handle the worst case (ie) when the string is lesser than the given length
If my string is
char string[]="i love my india";
If I use the function memset(string, '*' , 20);
Will it handle these type of complexities?
printf means it prints the user statements
Printf is a Variadic function. Variadic functions are functions which may take a variable number of arguments and are declared with an ellipsis in place of the last parameter. int printf(char *, ...);...
what are the different types of polymorphism?
Two:
Ad-hoc polymorphism and universal polymorphism
how to write a simple java programs for overloading & overriding
Merits and demerits of friend function
1) Sometimes a friend function allows a more obvious syntax for calling a function rather than what a member function can do.
2) Friend function is used to increase versatility of overload operator.
merits: we can able to access the other class members in our class if,we use friend keyword. we CAN access the members without inheriting the class.demerits: Maximum size...
write a program to interchange 2 variables without using the third one.
with output
#include<stdio.h>
#include<conio.h>
void main
{
int a,b;
printf("enter the two no");
scanf("%d%d",&a,&b);
a=a+b;
b=a-b;
a=a-b;
printf("a=%d,b=%d",a,b);
getch();
}
how can I call a function, given its name as a string?
ya it possible by using macro
Code
#include<stdio.h> #define string sum1() int main(){ int k=string; getch(); return 0; } sum1() { int c=6; int d=7; return(c+d); }
Hi, This is a typical example of reflection. If you are using .NET then use reflection for this purpose. In this case you create an object of a particular type and the invoke methods at run time by passing function name.
What is the difference between the object based language and object oriented langauage?
The object oriented language support the extra two concept that is dynamic binding and inheritance..but in second case they do not support these 2 features...
The main diffrence between object oriented and object based languages is object based languages doesnt support Inheritance where as object oriented supports. C# is a object oriented language because it supports inheritance and ASP.Net is not a langugae it is a technology.
write a program to find the factorial of a number
Code
class fact { { int n,fact=1; for(a=n;a>0;a--) { fact=fact*n; system.out.println("factorial of the no is"+fact); } } }
//program to find the factorial of a number
Code
#include<stdio.h> #include<conio.h> void main() { int a,fact=1; for(a=1;a<=5;a++) fact=fact*a; } getch(); }
Explain the advantages of OOPS with the examples.
The main advantage is that it uses real world object and generic programming approach
It is good because it is totally based on objects. It provides the concept of inheritance, encapsulation, polymorphism. With the help of this concepts the code is reusable, get in many forms. Classes support encapsulation.
How to design coffee vending machine in Java
what are the advantages of inheritance?
1) Inheritance is the concept where the child class can concentrate on new features that it want. because all the basic features it will get it from its parent class.
2) It is about re-usability of features.
Helps in reusability of code.
Program development time is reduced.
Helps as security purpose.
Abstract class is a class which contains atleast one abstract method.
Abstract method-method whose body is not defined.
Object of abstract class cannot be created.
abstract class is a base class. It is only declare a method and implement this method in a derived class using the override method.
it is declare a abstract keyword, and no need for create object for abstract class.
Difference between dispose()and close() method
The basic difference b/w close() & dispose() method is , when a close() method is called , any manage resource can be close temporarily and can e opened once again. It means that, with the same objec...
What are the types of inheritance?
Creating a new classes from exiting classes
5 type
There are 5 types of inheritance: -
1. Single inheritance
2. Multilevel inheritance
3. Multiple inheritance
4. Hierarchical inheritance
5. Hybrid inheritance
Why we use static destructor? What is its scope and what is its implementation?
You cannot declare destructor as static.
Destructors cannot be declared const, volatile, const volatile or static.
Refer:
http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=%2Fcom.ibm.xlcpp8a.doc%2Flanguage%2Fref%2Fcplr380.htm
static ~Sample()
{
std::cout<<"Destructor
";
}
The above code snippet shows following error.
error C2574: 'Sample::~Sample(void)' : cannot be declared static
explain one method to process an entire string as one unit?
using gets we can enter the entire string
there is no way to process an entire string.it has to be done char by char
Actually arr and &arr are different. arr holds the base address of the array arr[], but &arr holds the address of the entire array. but both expressions points to the same base address.{geshibot langu...
Arr and &Arr both are same, which will return the address of first element of the array. For example
void main()
{
char arr[10] = "Kishore";
printf("n%u : %u", a, &a);
}
Output:
~~~~~
65516 : 65516