You are on page 1of 2

Model Examination

Examination type:
1. Error correction
2. Output
3. Write codes
4. Concept explanation
Sample questions
1. Suppose memory address of variable data is FFF4
1. #include <iostream.h>
2. void main()
3. {
4. float data = 50.8;
5. float *ptr;
6. ptr = &data;
7. cout << ptr << &ptr << endl;
8. cout << ptr << *ptr << endl;
9. *ptr = 27.4;
10. cout << *ptr << endl;
11. cout << data << endl;
12. }
What is the output displayed by line 7, 8 , 10 and 11
2. What is the output of the following lines of code
int data[]={10,20,30,40,50};
*(data+2)=70;
for(int i=0;i<5,i++)
cout<<*(data+i)<<endl;

3. What is the output of the following lines of code
int data[]={10,20,30,40,50};
int *p=data;
for(int i=0;i<5,i++)
cout<<*(p+i)<<endl;

4. Compare and contrast array and linked list

5. List and describe types of linked list.

6. Write a C++ program that accepts fist name, last name and age of students using linked list. Your
program should display the input records.

7. What is the output of the following line of codes if p is 4?
int print(int p) {
if (p==0)
return 0;
cout<<p;
return 2*print(p-1);

}

8. What is the output of the following line codes if p is 4?
int print(int p) {
if (p==0)
return 0;
return 2*print(p-1);
cout<<p;
}

9. What is the output of the following line codes if n is 4?
long fact( long n ){
if(n= = 1 || n==0)
return 1;
return n*fact(n-1);
}

10. Compare and contrast main memory and secondary memory in terms of programming.

11. Write a C++ program that accepts fist name, last name and age of 10 students from key board.
Your program should store the input records in a file named test.txt, located in C:\.

12. Write a C++ program that reads fist name, last name and age of 10 students from a file named
test.txt, located in C:\. Your program should display the input records from the file on the
screen.

13. What Are Pointers?

14. What is the data type of the value stored on a pointer variable?

15. Suppose memory address of the first element of data is FFE1. What is the value of num+1?
double data{}={10,20,30,40,60};
double *num=data;

You might also like