University : Gauhati University
Degree : PGDCA
Question Paper Subject:PROGRAMMING IN C++ AND DATA STRUCTURE
Question Paper Year : 2008
Question Paper Details : Previous Years Question Papers Types Version
Degree : PGDCA
Question Paper Subject:PROGRAMMING IN C++ AND DATA STRUCTURE
Question Paper Year : 2008
Question Paper Details : Previous Years Question Papers Types Version
PROGRAMMING IN C++ AND DATA STRUCTURE
THIRD PAPER
Full Marks : 70
Time :3 hours
The figures in the margin indicate full marks for the questions
1. (a) Draw a flowchart to read n integers and print the sum of the positive and
negative integers separately. 8
(b) Describe the different parts of a function in C++ with the help of a suitable
example. 4
(c) What do you mean by default constructor and parameterized constructor? 3
2. Write down the outputs of the following C++ statements:
(a) for (i= 1; i<2; i++)
cout<< “PGCS, GAUHATI UNIVERSITY”; 2
(b) for (i=10; i<10; ++i);
cout<<”PGCS, GAUHATI UNIVERSITY”; 2
(c) char str[50] = “ASSAM”;
str[1] = ‘A’;
cout<(d) char arr[30] = “Brahmaputra”;
int 1;
1 = strlen(arr);
1--;
while (1>=0)
{
cout<1--;
} 3
3. Give answers to any five of the following questions: 5×5=25
(a) Write a program in C++ to display all the numbers divisible by 5 between
a range, whose starting value and the ending values are to be given as
input by the user.
(b) Write a function in C++ to return the minimum of an array of integers,
which takes the array and its size as parameters.
(c) Write a function in C++ to implement the binary search technique for
sorted array of integers.
(d) What do you mean by variable? Write down the rules for naming a
variable in C++.
(e) What are the advantages of using loops? Describe the syntax of the ‘for’
loop and ‘while’ loop.
(f) Explain the linear search technique for an ordered array with the help of
an example.
(g) Write a function in C++ which returns the length of the string passed as
parameter to it. [Do not use the ‘strlen()’ library function]
4. Give answers to any three of the following questions: 7×3=21
(a) Describe the use of the following functions with the help of an example:
(i) Strlen()
(ii) Clrscr()
(iii)Strcpy()
(b) Write a program in C++ which will read two strings from the user and
concatenate the strings into a third string.
(c) Create a class called “book”, whose data members are (i) book_name, (ii)
book_no, (iii) author, (iv) price. Write two member functions, one to read
the information of a book and another to display the information of a
book.
(d) Using a class definition, show how to implement a singly linked list. Write
functions for inserting elements at the starting and ending positions of a
linked list. Also write a function to traverse through a linked list.
(e) What is function overloading? Explain with a suitable example.
0 comments:
Pen down your valuable important comments below