Professional Documents
Culture Documents
-1-
{ int d1;
float d2;
public:
void data();
void putdata();
}
void main()
{ sample s;
s.data putdata();
return(0);
}
Winter 2007 (Semester Pattern): Marks=20
1. What is class? Give examples. 2
2. How memory is allocated when multiple objects of class are created?
Explain with suitable example. 2
3. Can we create object of one class in definition of another class?
Explain with suitable example. 4
4. Write a program to declare a class student containing data members
roll number, name and percentage of marks. Read data for two students
and display data of student having highest percentage. 4
5. Explain differences between structure and class with example 4
6. Find errors from following code and rectify the code: 4
class complex
{
int real, imaginary;
public:
void complex();
void Readdata();
void Showdata();
}
void main()
{
complex c1;
c1.Readdata();
c1.Displaydata();
}
-2-