c c++ Interview questions Programs to write

c c++ Interview questions Programs to write

Q.) Write a program to display the address of an array of integers (the array element values are entered by the user).

Q.)Use pointers to reverse a given array of integers.

Q.)Sort an array in descending order using pointers.

Q.) Write a program to set the value of the entire array to some user-defined value (use an integer array).

Q.) Create a class for complex numbers. It should have two member data (for the real and imaginary parts of a complex number). The class should have functions for calculating the magnitude of the number, displaying the complex number and also for obtaining inputs from the user and setting the values for the real and imaginary parts.

Q.) Create a class called ‘batsman’ which should contain member data for keeping track of his name, highest and lowest score, number of matches etc. There should be a function to obtain these values from the user and another function to display the details.

Q.) Create an employee class which models a real life employee and make use of appropriate class members. Provide parameter and parameter-less constructors for the class. The class should at least consist of the following: employee ID, department, age, salary and experience. Also include a function to calculate bonus for an employee (bonus=10% of salary * experience).

Q.) Create a class called ‘student’. It should have provision for the following:

· Obtaining the name, date of birth and marks in 5 subjects for the student.

· Calculating the current age of the student.

· Calculating the average marks of the student.

Q.) Create a class called ‘time’. This should have 3 member data: hours,minutes and seconds. There should be functions to reset the time, to add user-entered minutes to the time and calculate the new time (for example if the user inputs 70 minutes then the member function should add 1 hour and 10 minutes to the present time). A function should exist to display the current time.

Q.) Write a class to model a 3x3 matrix. This class should have functions to obtain the elements of the matrix, to find the inverse of the matrix and also to find the determinant of the matrix.


0 comments:

Post a Comment