1. Create a class with one integer instance variable. Initialize the variable using                 [2]
    • Default constructor
    • Parameterized constructor.
  2. State two features of a constructor.                                                  [2]
  3. What is a static function?                                                        [1]
  4. Write a function to find the sum of the digits of an integer that is input.                           [10]

Sample Input:    15390
Sample output:    Sum of digits=18
Define a class student having the following description    

Data members
String name-> to store name
int roll-> to store roll no.
int p,c,b-> to store physics, chemistry ,bio marks
double avg-> to store average of science marks
Member function
Input()-> to accept details of student from user
Calculate()-> to calculate science marks
Display()-> to display name, rollno, science marks, average


LEAVE A REPLY

Please enter your comment!
Please enter your name here