You are on page 1of 2

Question Bank: Object Oriented Programming (9036)

Class: SYIF (Semester – III)


Chapter No. 05 Pointers in C++
Summer 2004 (Yearly Pattern): Marks=24
1. Write the declaration for an array ‘int_array’ of int type and the pointer that
point to it. Also initialize the array. 4
2. Describe the function performed by following statements. 4
char *city;
city = new char[20];
double *k;
k = new double[10];
3. Find out errors, if any, in the following program – 4
#include<iostream.h>
class emp
{
private:
char name[10];
char city[10];
public:
emp(char *a, char *b)
{
strcpy(name, a);
strcpy (city, b);
}
}
void main()
{
emp my(“John”, “London”);
}
4. Write the program to copy the contents of string to another string using
pointer to string. 4
5. Explain the function of ‘this’ pointer. 4
6. Write a program to count number of characters in a word using pointer to
string. 4

Summer 2005 (Yearly Pattern): Marks=20


1. Illustrate use of ‘this’ pointer with suitable code. 4
2. Explain the syntax and use of ‘new’ operator. Give one example. 4
3. Write the program to find length of a string using pointer to string. 4
4. Write the program to compare two strings using pointer to string. 4
5. If int array is an array of integers, why the expression int array++ is illegal?
Justify your answer. 4

Summer 2006 (Yearly Pattern): Marks=16


1. Explain pointer variable with suitable example. 4
2. Write a program to find length of the string using pointer string. 4
3. If int array is an array of integers, why the expression int array++ is illegal?
Justify your answer. 4
4. Write a program to interchange two strings using pointer to string. 4

Question Bank (OOP): Chapter No. 5 -1-


Winter 2007 (Semester Pattern): Marks=18
1. Give significance of ‘&’ operator and ‘*’ operator. 2
2. Can we use base class pointer for accessing member function of derived
class? Explain with suitable example. 4
3. Differentiate between calling function by value and calling function by
reference. Give suitable examples. 4
4. Write a program to find length of string (without using strlen( )
function) 4
5. Write a program that counts number of vowels in a string. 4

Summer 2008 (Semester Pattern): Marks=18


1. Write the advantages of pointer. 2
2. In how many ways we can use pointer in functions definitions?
explain it. 4
3. What do you mean by pointer? Which are the pointer operators present?
Give it’s example? 4
4. Write a program to find sum of three numbers using pointer to function
method. 4
5. Describe memory allocation and de-allocation operators. 4

Other:
1. How to pass function as an argument to another function? Explain. 4
2. Illustrate the concept of pointer to objects with suitable example. 4
3. Describe the process of creating the pointer to derived class. How it is
applicable in the program? 4
4. Explain how the relation between the array and pointer is maintained in the
program. 4

Question Bank (OOP): Chapter No. 5 -2-

You might also like