ABASYN UNIVERSITY, ISLAMABAD CAMPUS ISLAMABAD, PAKISTAN DEPARTMENT OF COMPUTING Home Task 1: Spring 2021 Subject: Data Structures and Algorithms Topics Covered Total Marks Due-Date: 03 February, 2021 Pointers and its applications 10 Late submission under any circumstances is not allowed. It is strongly recommended that you attempt and submit all the questions. Plagiarized code will get zero. Question 1 Write a C++ program that add two numbers using pointers. Question 2 Write a C++ program that store n elements in an array and print the elements using pointer. Question 3 Write a C++ program to reverse the digits a number using pointers. Question 4 Write a C++ program that asks the user to enter two integers as inputs to be stored in the variables 'x' and 'y' respectively. There are also two integer pointers named P1 and P2. Assign the values of 'x' and 'y' to P1 and P2 respectively, and display them. Question 5 Write a C++ program to find the max integer from given dataset. The program will ask the user to input the number of integer values in the dataset. The program prints on screen a pointer that points to the max value. Question 6 What will be the output of the following program? Justify with strong arguments. #include <iostream> using namespace std; int main() { int a = 32, *ptr = &a; char ch = 'A', &cho = ch; cho += a; *ptr += ch; cout << a << ", " << ch << endl; return 0; } Question 7 What will be the output of the following program? Justify with strong arguments. #include <iostream> using namespace std; int main() { const int i = 20; const int* const ptr = &i; (*ptr)++; int j = 15; ptr = &j; cout << i; return 0; } Question 8 What will be the output of the following program? Justify with strong arguments. #include <iostream> using namespace std; int main() { int num[5]; int* p; p = num; *p = 10; p++; *p = 20; p = &num[2]; *p = 30; p = num + 3; *p = 40; p = num; *(p + 4) = 50; for (int i = 0; i < 5; i++) cout << num[i] << ", "; return 0; } Question 9 Create a class called Student_Club, which will store information on student clubs. The Student_Club class should have as fields: President Vice-President Secretary Treasurer All of which should be pointers to a student object. In this way, a student could hold offices in many different clubs and we would not have to keep separate information about that student in each instance of Student_Club. Your class definition should also include constructors as well as accessor functions.