Semester : SEMESTER 2
Subject : Problem Solving using C
Year : 2015
Term : MAY
Branch : COMPUTER SCIENCE
Scheme : 2020 Full Time
Course Code : BCS 2B 02
Page:2
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
27.
29.
30.
31.
How will you represent a queue in computers memory ?
Write the C++ code to check whether a linked list is circular or not.
(5 x 2 = 10 marks)
Part C
Answer any five questions.
Each question carries 4 marks.
How does a class enforce data hiding, abstraction and encapsulation ?
By applying the concept of friend functions, write a C++ program to add two complex numbers.
With the help of a C++ program, explain the use of virtual functions in implementing runtime
polymorphism.
What is this pointer ? What is its significance ? Illustrate the use of this pointer with the help of an
example.
Write an algorithm to find the transpose of a given matrix.
Explain how PUSH and POP operations are performed on a STACK ?
Write a C++ program to add an element into a circular linked list.
What is hashing ? Explain any three commonly used methods used to implement hashing.
(5 x 4 = 20 marks)
Part D
Answer any five questions.
Each question carries 8 marks.
Compare and contrast the object oriented programming methodology with procedure oriented
programming methodology.
Create a virtual base class Student that stores rollno with member function get number() and
putnumber( ). From this derive a class Test with data members marki and mark2 and member
functions getmarks( ) and putmarks( ). Create a class Sports that stores sports marks. From Test
and Sports classes derive the class Result that stores total mark. Write a program to display the
total mark with other student details.
Explain the use of copy constructor and dynamic constructors with the help of examples.
Write short notes on :
(a) Inline functions.
(b) Dynamic memory management in C++.
Write a program in C++ to add two polynomials.
Write an algorithm to convert an infix expression to postfix form using stacks. Explain the algorithm
with the help of an example. рдо
Write an algorithm to insert a given element into a sorted linked list.
Write a program in C++ to implement Selection sort and explain the sorting process with the help
of an example.
(5 x 8 = 40 marks)